@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
86 lines (85 loc) • 2.91 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/v20/common/feed_common.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
function createBaseMoney() {
return { currency_code: undefined, amount_micros: undefined };
}
export const Money = {
encode(message, writer = _m0.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 _m0.Reader ? input : _m0.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 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 (_m0.util.Long !== Long) {
_m0.util.Long = Long;
_m0.configure();
}
function isSet(value) {
return value !== null && value !== undefined;
}