@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
180 lines (179 loc) • 7.23 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/v21/resources/geo_target_constant.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { geoTargetConstantStatusEnum_GeoTargetConstantStatusFromJSON, geoTargetConstantStatusEnum_GeoTargetConstantStatusToJSON, } from "../enums/geo_target_constant_status.js";
function createBaseGeoTargetConstant() {
return {
resource_name: "",
id: undefined,
name: undefined,
country_code: undefined,
target_type: undefined,
status: 0,
canonical_name: undefined,
parent_geo_target: undefined,
};
}
export const GeoTargetConstant = {
encode(message, writer = _m0.Writer.create()) {
if (message.resource_name !== undefined && message.resource_name !== "") {
writer.uint32(10).string(message.resource_name);
}
if (message.id !== undefined) {
writer.uint32(80).int64(message.id);
}
if (message.name !== undefined) {
writer.uint32(90).string(message.name);
}
if (message.country_code !== undefined) {
writer.uint32(98).string(message.country_code);
}
if (message.target_type !== undefined) {
writer.uint32(106).string(message.target_type);
}
if (message.status !== undefined && message.status !== 0) {
writer.uint32(56).int32(message.status);
}
if (message.canonical_name !== undefined) {
writer.uint32(114).string(message.canonical_name);
}
if (message.parent_geo_target !== undefined) {
writer.uint32(74).string(message.parent_geo_target);
}
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 = createBaseGeoTargetConstant();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 10:
if (tag !== 80) {
break;
}
message.id = longToString(reader.int64());
continue;
case 11:
if (tag !== 90) {
break;
}
message.name = reader.string();
continue;
case 12:
if (tag !== 98) {
break;
}
message.country_code = reader.string();
continue;
case 13:
if (tag !== 106) {
break;
}
message.target_type = reader.string();
continue;
case 7:
if (tag !== 56) {
break;
}
message.status = reader.int32();
continue;
case 14:
if (tag !== 114) {
break;
}
message.canonical_name = reader.string();
continue;
case 9:
if (tag !== 74) {
break;
}
message.parent_geo_target = 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,
name: isSet(object.name) ? globalThis.String(object.name) : undefined,
country_code: isSet(object.country_code) ? globalThis.String(object.country_code) : undefined,
target_type: isSet(object.target_type) ? globalThis.String(object.target_type) : undefined,
status: isSet(object.status) ? geoTargetConstantStatusEnum_GeoTargetConstantStatusFromJSON(object.status) : 0,
canonical_name: isSet(object.canonical_name) ? globalThis.String(object.canonical_name) : undefined,
parent_geo_target: isSet(object.parent_geo_target) ? globalThis.String(object.parent_geo_target) : 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.name !== undefined) {
obj.name = message.name;
}
if (message.country_code !== undefined) {
obj.country_code = message.country_code;
}
if (message.target_type !== undefined) {
obj.target_type = message.target_type;
}
if (message.status !== undefined && message.status !== 0) {
obj.status = geoTargetConstantStatusEnum_GeoTargetConstantStatusToJSON(message.status);
}
if (message.canonical_name !== undefined) {
obj.canonical_name = message.canonical_name;
}
if (message.parent_geo_target !== undefined) {
obj.parent_geo_target = message.parent_geo_target;
}
return obj;
},
create(base) {
return GeoTargetConstant.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h;
const message = createBaseGeoTargetConstant();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : undefined;
message.name = (_c = object.name) !== null && _c !== void 0 ? _c : undefined;
message.country_code = (_d = object.country_code) !== null && _d !== void 0 ? _d : undefined;
message.target_type = (_e = object.target_type) !== null && _e !== void 0 ? _e : undefined;
message.status = (_f = object.status) !== null && _f !== void 0 ? _f : 0;
message.canonical_name = (_g = object.canonical_name) !== null && _g !== void 0 ? _g : undefined;
message.parent_geo_target = (_h = object.parent_geo_target) !== null && _h !== void 0 ? _h : 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;
}