UNPKG

@htdangkhoa/google-ads

Version:
111 lines (110 loc) 4.51 kB
"use strict"; // 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/geographic_view.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.GeographicView = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_js_1 = __importDefault(require("protobufjs/minimal.js")); const geo_targeting_type_js_1 = require("../enums/geo_targeting_type.js"); function createBaseGeographicView() { return { resource_name: "", location_type: 0, country_criterion_id: undefined }; } exports.GeographicView = { 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.location_type !== undefined && message.location_type !== 0) { writer.uint32(24).int32(message.location_type); } if (message.country_criterion_id !== undefined) { writer.uint32(40).int64(message.country_criterion_id); } 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 = createBaseGeographicView(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 3: if (tag !== 24) { break; } message.location_type = reader.int32(); continue; case 5: if (tag !== 40) { break; } message.country_criterion_id = longToString(reader.int64()); 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) : "", location_type: isSet(object.location_type) ? (0, geo_targeting_type_js_1.geoTargetingTypeEnum_GeoTargetingTypeFromJSON)(object.location_type) : 0, country_criterion_id: isSet(object.country_criterion_id) ? globalThis.String(object.country_criterion_id) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.location_type !== undefined && message.location_type !== 0) { obj.location_type = (0, geo_targeting_type_js_1.geoTargetingTypeEnum_GeoTargetingTypeToJSON)(message.location_type); } if (message.country_criterion_id !== undefined) { obj.country_criterion_id = message.country_criterion_id; } return obj; }, create(base) { return exports.GeographicView.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c; const message = createBaseGeographicView(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.location_type = (_b = object.location_type) !== null && _b !== void 0 ? _b : 0; message.country_criterion_id = (_c = object.country_criterion_id) !== 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; }