@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
114 lines (113 loc) • 4.46 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/ad_parameter.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
function createBaseAdParameter() {
return { resource_name: "", ad_group_criterion: undefined, parameter_index: undefined, insertion_text: undefined };
}
export const AdParameter = {
encode(message, writer = _m0.Writer.create()) {
if (message.resource_name !== undefined && message.resource_name !== "") {
writer.uint32(10).string(message.resource_name);
}
if (message.ad_group_criterion !== undefined) {
writer.uint32(42).string(message.ad_group_criterion);
}
if (message.parameter_index !== undefined) {
writer.uint32(48).int64(message.parameter_index);
}
if (message.insertion_text !== undefined) {
writer.uint32(58).string(message.insertion_text);
}
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 = createBaseAdParameter();
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 !== 42) {
break;
}
message.ad_group_criterion = reader.string();
continue;
case 6:
if (tag !== 48) {
break;
}
message.parameter_index = longToString(reader.int64());
continue;
case 7:
if (tag !== 58) {
break;
}
message.insertion_text = 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) : "",
ad_group_criterion: isSet(object.ad_group_criterion) ? globalThis.String(object.ad_group_criterion) : undefined,
parameter_index: isSet(object.parameter_index) ? globalThis.String(object.parameter_index) : undefined,
insertion_text: isSet(object.insertion_text) ? globalThis.String(object.insertion_text) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.ad_group_criterion !== undefined) {
obj.ad_group_criterion = message.ad_group_criterion;
}
if (message.parameter_index !== undefined) {
obj.parameter_index = message.parameter_index;
}
if (message.insertion_text !== undefined) {
obj.insertion_text = message.insertion_text;
}
return obj;
},
create(base) {
return AdParameter.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseAdParameter();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.ad_group_criterion = (_b = object.ad_group_criterion) !== null && _b !== void 0 ? _b : undefined;
message.parameter_index = (_c = object.parameter_index) !== null && _c !== void 0 ? _c : undefined;
message.insertion_text = (_d = object.insertion_text) !== null && _d !== void 0 ? _d : undefined;
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;
}