@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
125 lines (124 loc) • 4.92 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/topic_constant.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.TopicConstant = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
function createBaseTopicConstant() {
return { resource_name: "", id: undefined, topic_constant_parent: undefined, path: [] };
}
exports.TopicConstant = {
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(40).int64(message.id);
}
if (message.topic_constant_parent !== undefined) {
writer.uint32(50).string(message.topic_constant_parent);
}
if (message.path !== undefined && message.path.length !== 0) {
for (const v of message.path) {
writer.uint32(58).string(v);
}
}
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 = createBaseTopicConstant();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 5:
if (tag !== 40) {
break;
}
message.id = longToString(reader.int64());
continue;
case 6:
if (tag !== 50) {
break;
}
message.topic_constant_parent = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.path.push(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,
topic_constant_parent: isSet(object.topic_constant_parent)
? globalThis.String(object.topic_constant_parent)
: undefined,
path: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.path) ? object.path.map((e) => globalThis.String(e)) : [],
};
},
toJSON(message) {
var _a;
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.topic_constant_parent !== undefined) {
obj.topic_constant_parent = message.topic_constant_parent;
}
if ((_a = message.path) === null || _a === void 0 ? void 0 : _a.length) {
obj.path = message.path;
}
return obj;
},
create(base) {
return exports.TopicConstant.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseTopicConstant();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined;
message.topic_constant_parent = (_c = object.topic_constant_parent) !== null && _c !== void 0 ? _c : undefined;
message.path = ((_d = object.path) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
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;
}