@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
281 lines (280 loc) • 13.1 kB
JavaScript
"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/v24/resources/applied_incentive.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AppliedIncentive = void 0;
/* eslint-disable */
const long_1 = __importDefault(require("long"));
const minimal_js_1 = __importDefault(require("protobufjs/minimal.js"));
const incentive_state_js_1 = require("../enums/incentive_state.js");
function createBaseAppliedIncentive() {
return {
resource_name: "",
coupon_code: undefined,
incentive_state: undefined,
redemption_date_time: undefined,
fulfillment_expiration_date_time: undefined,
reward_grant_date_time: undefined,
reward_expiration_date_time: undefined,
currency_code: undefined,
reward_amount_micros: undefined,
granted_amount_micros: undefined,
required_min_spend_micros: undefined,
current_spend_towards_fulfillment_micros: undefined,
reward_balance_remaining_micros: undefined,
};
}
exports.AppliedIncentive = {
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.coupon_code !== undefined) {
writer.uint32(18).string(message.coupon_code);
}
if (message.incentive_state !== undefined) {
writer.uint32(24).int32(message.incentive_state);
}
if (message.redemption_date_time !== undefined) {
writer.uint32(34).string(message.redemption_date_time);
}
if (message.fulfillment_expiration_date_time !== undefined) {
writer.uint32(42).string(message.fulfillment_expiration_date_time);
}
if (message.reward_grant_date_time !== undefined) {
writer.uint32(50).string(message.reward_grant_date_time);
}
if (message.reward_expiration_date_time !== undefined) {
writer.uint32(58).string(message.reward_expiration_date_time);
}
if (message.currency_code !== undefined) {
writer.uint32(66).string(message.currency_code);
}
if (message.reward_amount_micros !== undefined) {
writer.uint32(72).int64(message.reward_amount_micros);
}
if (message.granted_amount_micros !== undefined) {
writer.uint32(80).int64(message.granted_amount_micros);
}
if (message.required_min_spend_micros !== undefined) {
writer.uint32(88).int64(message.required_min_spend_micros);
}
if (message.current_spend_towards_fulfillment_micros !== undefined) {
writer.uint32(96).int64(message.current_spend_towards_fulfillment_micros);
}
if (message.reward_balance_remaining_micros !== undefined) {
writer.uint32(104).int64(message.reward_balance_remaining_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 = createBaseAppliedIncentive();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.resource_name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.coupon_code = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.incentive_state = reader.int32();
continue;
case 4:
if (tag !== 34) {
break;
}
message.redemption_date_time = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.fulfillment_expiration_date_time = reader.string();
continue;
case 6:
if (tag !== 50) {
break;
}
message.reward_grant_date_time = reader.string();
continue;
case 7:
if (tag !== 58) {
break;
}
message.reward_expiration_date_time = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.currency_code = reader.string();
continue;
case 9:
if (tag !== 72) {
break;
}
message.reward_amount_micros = longToString(reader.int64());
continue;
case 10:
if (tag !== 80) {
break;
}
message.granted_amount_micros = longToString(reader.int64());
continue;
case 11:
if (tag !== 88) {
break;
}
message.required_min_spend_micros = longToString(reader.int64());
continue;
case 12:
if (tag !== 96) {
break;
}
message.current_spend_towards_fulfillment_micros = longToString(reader.int64());
continue;
case 13:
if (tag !== 104) {
break;
}
message.reward_balance_remaining_micros = 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) : "",
coupon_code: isSet(object.coupon_code) ? globalThis.String(object.coupon_code) : undefined,
incentive_state: isSet(object.incentive_state)
? (0, incentive_state_js_1.incentiveStateEnum_IncentiveStateFromJSON)(object.incentive_state)
: undefined,
redemption_date_time: isSet(object.redemption_date_time)
? globalThis.String(object.redemption_date_time)
: undefined,
fulfillment_expiration_date_time: isSet(object.fulfillment_expiration_date_time)
? globalThis.String(object.fulfillment_expiration_date_time)
: undefined,
reward_grant_date_time: isSet(object.reward_grant_date_time)
? globalThis.String(object.reward_grant_date_time)
: undefined,
reward_expiration_date_time: isSet(object.reward_expiration_date_time)
? globalThis.String(object.reward_expiration_date_time)
: undefined,
currency_code: isSet(object.currency_code) ? globalThis.String(object.currency_code) : undefined,
reward_amount_micros: isSet(object.reward_amount_micros)
? globalThis.String(object.reward_amount_micros)
: undefined,
granted_amount_micros: isSet(object.granted_amount_micros)
? globalThis.String(object.granted_amount_micros)
: undefined,
required_min_spend_micros: isSet(object.required_min_spend_micros)
? globalThis.String(object.required_min_spend_micros)
: undefined,
current_spend_towards_fulfillment_micros: isSet(object.current_spend_towards_fulfillment_micros)
? globalThis.String(object.current_spend_towards_fulfillment_micros)
: undefined,
reward_balance_remaining_micros: isSet(object.reward_balance_remaining_micros)
? globalThis.String(object.reward_balance_remaining_micros)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.resource_name !== undefined && message.resource_name !== "") {
obj.resource_name = message.resource_name;
}
if (message.coupon_code !== undefined) {
obj.coupon_code = message.coupon_code;
}
if (message.incentive_state !== undefined) {
obj.incentive_state = (0, incentive_state_js_1.incentiveStateEnum_IncentiveStateToJSON)(message.incentive_state);
}
if (message.redemption_date_time !== undefined) {
obj.redemption_date_time = message.redemption_date_time;
}
if (message.fulfillment_expiration_date_time !== undefined) {
obj.fulfillment_expiration_date_time = message.fulfillment_expiration_date_time;
}
if (message.reward_grant_date_time !== undefined) {
obj.reward_grant_date_time = message.reward_grant_date_time;
}
if (message.reward_expiration_date_time !== undefined) {
obj.reward_expiration_date_time = message.reward_expiration_date_time;
}
if (message.currency_code !== undefined) {
obj.currency_code = message.currency_code;
}
if (message.reward_amount_micros !== undefined) {
obj.reward_amount_micros = message.reward_amount_micros;
}
if (message.granted_amount_micros !== undefined) {
obj.granted_amount_micros = message.granted_amount_micros;
}
if (message.required_min_spend_micros !== undefined) {
obj.required_min_spend_micros = message.required_min_spend_micros;
}
if (message.current_spend_towards_fulfillment_micros !== undefined) {
obj.current_spend_towards_fulfillment_micros = message.current_spend_towards_fulfillment_micros;
}
if (message.reward_balance_remaining_micros !== undefined) {
obj.reward_balance_remaining_micros = message.reward_balance_remaining_micros;
}
return obj;
},
create(base) {
return exports.AppliedIncentive.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
const message = createBaseAppliedIncentive();
message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : "";
message.coupon_code = (_b = object.coupon_code) !== null && _b !== void 0 ? _b : undefined;
message.incentive_state = (_c = object.incentive_state) !== null && _c !== void 0 ? _c : undefined;
message.redemption_date_time = (_d = object.redemption_date_time) !== null && _d !== void 0 ? _d : undefined;
message.fulfillment_expiration_date_time = (_e = object.fulfillment_expiration_date_time) !== null && _e !== void 0 ? _e : undefined;
message.reward_grant_date_time = (_f = object.reward_grant_date_time) !== null && _f !== void 0 ? _f : undefined;
message.reward_expiration_date_time = (_g = object.reward_expiration_date_time) !== null && _g !== void 0 ? _g : undefined;
message.currency_code = (_h = object.currency_code) !== null && _h !== void 0 ? _h : undefined;
message.reward_amount_micros = (_j = object.reward_amount_micros) !== null && _j !== void 0 ? _j : undefined;
message.granted_amount_micros = (_k = object.granted_amount_micros) !== null && _k !== void 0 ? _k : undefined;
message.required_min_spend_micros = (_l = object.required_min_spend_micros) !== null && _l !== void 0 ? _l : undefined;
message.current_spend_towards_fulfillment_micros = (_m = object.current_spend_towards_fulfillment_micros) !== null && _m !== void 0 ? _m : undefined;
message.reward_balance_remaining_micros = (_o = object.reward_balance_remaining_micros) !== null && _o !== void 0 ? _o : 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;
}