UNPKG

@htdangkhoa/google-ads

Version:
102 lines (101 loc) 3.88 kB
// 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/user_location_view.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; function createBaseUserLocationView() { return { resource_name: "", country_criterion_id: undefined, targeting_location: undefined }; } export const UserLocationView = { encode(message, writer = _m0.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 _m0.Reader ? input : _m0.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 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 (_m0.util.Long !== Long) { _m0.util.Long = Long; _m0.configure(); } function isSet(value) { return value !== null && value !== undefined; }