@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
134 lines (133 loc) • 5.2 kB
JavaScript
;
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.2
// protoc v3.21.12
// source: google/ads/googleads/v19/resources/video.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Video = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
function createBaseVideo() {
return { resource_name: "", id: undefined, channel_id: undefined, duration_millis: undefined, title: undefined };
}
exports.Video = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.resource_name !== undefined && message.resource_name !== "") {
writer.uint32(10).string(message.resource_name);
}
if (message.id !== undefined) {
writer.uint32(50).string(message.id);
}
if (message.channel_id !== undefined) {
writer.uint32(58).string(message.channel_id);
}
if (message.duration_millis !== undefined) {
writer.uint32(64).int64(message.duration_millis);
}
if (message.title !== undefined) {
writer.uint32(74).string(message.title);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVideo();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.id = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.channel_id = reader.string();
continue;
case 8:
if (tag !== 64) {
break;
}
message.duration_millis = longToString(reader.int64());
continue;
case 9:
if (tag !== 74) {
break;
}
message.title = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
resource_name: isSet(object.resource_name) ? globalThis.String(object.resource_name) : "",
id: isSet(object.id) ? globalThis.String(object.id) : undefined,
channel_id: isSet(object.channel_id) ? globalThis.String(object.channel_id) : undefined,
duration_millis: isSet(object.duration_millis) ? globalThis.String(object.duration_millis) : undefined,
title: isSet(object.title) ? globalThis.String(object.title) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.id !== undefined) {
obj.id = message.id;
}
if (message.channel_id !== undefined) {
obj.channel_id = message.channel_id;
}
if (message.duration_millis !== undefined) {
obj.duration_millis = message.duration_millis;
}
if (message.title !== undefined) {
obj.title = message.title;
}
return obj;
},
create(base) {
return exports.Video.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBaseVideo();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined;
message.channel_id = (_c = object.channel_id) !== null && _c !== void 0 ? _c : undefined;
message.duration_millis = (_d = object.duration_millis) !== null && _d !== void 0 ? _d : undefined;
message.title = (_e = object.title) !== null && _e !== void 0 ? _e : undefined;
return message;
},
};
function longToString(long) {
return long.toString();
}
if (minimal_js_1.default.util.Long !== long_1.default) {
minimal_js_1.default.util.Long = long_1.default;
minimal_js_1.default.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}