UNPKG

@htdangkhoa/google-ads

Version:
114 lines (113 loc) 4.14 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/carrier_constant.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; function createBaseCarrierConstant() { return { resource_name: "", id: undefined, name: undefined, country_code: undefined }; } export const CarrierConstant = { 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(40).int64(message.id); } if (message.name !== undefined) { writer.uint32(50).string(message.name); } if (message.country_code !== undefined) { writer.uint32(58).string(message.country_code); } 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 = createBaseCarrierConstant(); 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 !== 40) { break; } message.id = longToString(reader.int64()); continue; case 6: if (tag !== 50) { break; } message.name = reader.string(); continue; case 7: if (tag !== 58) { break; } message.country_code = 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, }; }, 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; } return obj; }, create(base) { return CarrierConstant.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseCarrierConstant(); 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; 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; }