@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
108 lines (107 loc) • 4.31 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/user_location_view.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.UserLocationView = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
function createBaseUserLocationView() {
return { resource_name: "", country_criterion_id: undefined, targeting_location: undefined };
}
exports.UserLocationView = {
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.country_criterion_id !== undefined) {
writer.uint32(32).int64(message.country_criterion_id);
}
if (message.targeting_location !== undefined) {
writer.uint32(40).bool(message.targeting_location);
}
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 = createBaseUserLocationView();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.country_criterion_id = longToString(reader.int64());
continue;
case 5:
if (tag !== 40) {
break;
}
message.targeting_location = reader.bool();
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) : "",
country_criterion_id: isSet(object.country_criterion_id)
? globalThis.String(object.country_criterion_id)
: undefined,
targeting_location: isSet(object.targeting_location) ? globalThis.Boolean(object.targeting_location) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.country_criterion_id !== undefined) {
obj.country_criterion_id = message.country_criterion_id;
}
if (message.targeting_location !== undefined) {
obj.targeting_location = message.targeting_location;
}
return obj;
},
create(base) {
return exports.UserLocationView.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseUserLocationView();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.country_criterion_id = (_b = object.country_criterion_id) !== null && _b !== void 0 ? _b : undefined;
message.targeting_location = (_c = object.targeting_location) !== null && _c !== void 0 ? _c : 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;
}