@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
92 lines (91 loc) • 3.33 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/v24/common/feed_common.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Money = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
function createBaseMoney() {
return { currency_code: undefined, amount_micros: undefined };
}
exports.Money = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.currency_code !== undefined) {
writer.uint32(26).string(message.currency_code);
}
if (message.amount_micros !== undefined) {
writer.uint32(32).int64(message.amount_micros);
}
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 = createBaseMoney();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.currency_code = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.amount_micros = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
currency_code: isSet(object.currency_code) ? globalThis.String(object.currency_code) : undefined,
amount_micros: isSet(object.amount_micros) ? globalThis.String(object.amount_micros) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.currency_code !== undefined) {
obj.currency_code = message.currency_code;
}
if (message.amount_micros !== undefined) {
obj.amount_micros = message.amount_micros;
}
return obj;
},
create(base) {
return exports.Money.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseMoney();
message.currency_code = (_a = object.currency_code) !== null && _a !== void 0 ? _a : undefined;
message.amount_micros = (_b = object.amount_micros) !== null && _b !== void 0 ? _b : 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;
}