@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
115 lines (114 loc) • 4.61 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/v24/resources/video_enhancement.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { videoEnhancementSourceEnum_VideoEnhancementSourceFromJSON, videoEnhancementSourceEnum_VideoEnhancementSourceToJSON, } from "../enums/video_enhancement_source.js";
function createBaseVideoEnhancement() {
return { resource_name: "", duration_millis: "0", source: 0, title: "" };
}
export const VideoEnhancement = {
encode(message, writer = _m0.Writer.create()) {
if (message.resource_name !== undefined && message.resource_name !== "") {
writer.uint32(10).string(message.resource_name);
}
if (message.duration_millis !== undefined && message.duration_millis !== "0") {
writer.uint32(16).int64(message.duration_millis);
}
if (message.source !== undefined && message.source !== 0) {
writer.uint32(24).int32(message.source);
}
if (message.title !== undefined && message.title !== "") {
writer.uint32(34).string(message.title);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseVideoEnhancement();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 2:
if (tag !== 16) {
break;
}
message.duration_millis = longToString(reader.int64());
continue;
case 3:
if (tag !== 24) {
break;
}
message.source = reader.int32();
continue;
case 4:
if (tag !== 34) {
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) : "",
duration_millis: isSet(object.duration_millis) ? globalThis.String(object.duration_millis) : "0",
source: isSet(object.source) ? videoEnhancementSourceEnum_VideoEnhancementSourceFromJSON(object.source) : 0,
title: isSet(object.title) ? globalThis.String(object.title) : "",
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.duration_millis !== undefined && message.duration_millis !== "0") {
obj.duration_millis = message.duration_millis;
}
if (message.source !== undefined && message.source !== 0) {
obj.source = videoEnhancementSourceEnum_VideoEnhancementSourceToJSON(message.source);
}
if (message.title !== undefined && message.title !== "") {
obj.title = message.title;
}
return obj;
},
create(base) {
return VideoEnhancement.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseVideoEnhancement();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.duration_millis = (_b = object.duration_millis) !== null && _b !== void 0 ? _b : "0";
message.source = (_c = object.source) !== null && _c !== void 0 ? _c : 0;
message.title = (_d = object.title) !== null && _d !== void 0 ? _d : "";
return message;
},
};
function longToString(long) {
return long.toString();
}
if (_m0.util.Long !== Long) {
_m0.util.Long = Long;
_m0.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}