@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
829 lines (828 loc) • 33.3 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/services/incentive_service.proto
/* eslint-disable */
import { makeGenericClientConstructor, } from "@grpc/grpc-js";
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { Money } from "../../../../type/money.js";
/** Types of incentives offered */
export var FetchIncentiveRequest_IncentiveType;
(function (FetchIncentiveRequest_IncentiveType) {
/** UNSPECIFIED - Not specified. */
FetchIncentiveRequest_IncentiveType[FetchIncentiveRequest_IncentiveType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
/** UNKNOWN - Unknown incentive type. Should not be used as a value explicitly. */
FetchIncentiveRequest_IncentiveType[FetchIncentiveRequest_IncentiveType["UNKNOWN"] = 1] = "UNKNOWN";
/** ACQUISITION - An acquisition incentive. */
FetchIncentiveRequest_IncentiveType[FetchIncentiveRequest_IncentiveType["ACQUISITION"] = 2] = "ACQUISITION";
FetchIncentiveRequest_IncentiveType[FetchIncentiveRequest_IncentiveType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(FetchIncentiveRequest_IncentiveType || (FetchIncentiveRequest_IncentiveType = {}));
export function fetchIncentiveRequest_IncentiveTypeFromJSON(object) {
switch (object) {
case 0:
case "UNSPECIFIED":
return FetchIncentiveRequest_IncentiveType.UNSPECIFIED;
case 1:
case "UNKNOWN":
return FetchIncentiveRequest_IncentiveType.UNKNOWN;
case 2:
case "ACQUISITION":
return FetchIncentiveRequest_IncentiveType.ACQUISITION;
case -1:
case "UNRECOGNIZED":
default:
return FetchIncentiveRequest_IncentiveType.UNRECOGNIZED;
}
}
export function fetchIncentiveRequest_IncentiveTypeToJSON(object) {
switch (object) {
case FetchIncentiveRequest_IncentiveType.UNSPECIFIED:
return "UNSPECIFIED";
case FetchIncentiveRequest_IncentiveType.UNKNOWN:
return "UNKNOWN";
case FetchIncentiveRequest_IncentiveType.ACQUISITION:
return "ACQUISITION";
case FetchIncentiveRequest_IncentiveType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
/** Types of acquisition incentive offers. */
export var IncentiveOffer_OfferType;
(function (IncentiveOffer_OfferType) {
/** UNSPECIFIED - Unknown offer type. Should not be used as a value explicitly. */
IncentiveOffer_OfferType[IncentiveOffer_OfferType["UNSPECIFIED"] = 0] = "UNSPECIFIED";
/** UNKNOWN - Unknown offer type. */
IncentiveOffer_OfferType[IncentiveOffer_OfferType["UNKNOWN"] = 1] = "UNKNOWN";
/** NO_INCENTIVE - An offer with no incentive. */
IncentiveOffer_OfferType[IncentiveOffer_OfferType["NO_INCENTIVE"] = 2] = "NO_INCENTIVE";
/** CYO_INCENTIVE - A CYO (Choose-Your-Own) offer with multiple incentives to choose from. */
IncentiveOffer_OfferType[IncentiveOffer_OfferType["CYO_INCENTIVE"] = 3] = "CYO_INCENTIVE";
IncentiveOffer_OfferType[IncentiveOffer_OfferType["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(IncentiveOffer_OfferType || (IncentiveOffer_OfferType = {}));
export function incentiveOffer_OfferTypeFromJSON(object) {
switch (object) {
case 0:
case "UNSPECIFIED":
return IncentiveOffer_OfferType.UNSPECIFIED;
case 1:
case "UNKNOWN":
return IncentiveOffer_OfferType.UNKNOWN;
case 2:
case "NO_INCENTIVE":
return IncentiveOffer_OfferType.NO_INCENTIVE;
case 3:
case "CYO_INCENTIVE":
return IncentiveOffer_OfferType.CYO_INCENTIVE;
case -1:
case "UNRECOGNIZED":
default:
return IncentiveOffer_OfferType.UNRECOGNIZED;
}
}
export function incentiveOffer_OfferTypeToJSON(object) {
switch (object) {
case IncentiveOffer_OfferType.UNSPECIFIED:
return "UNSPECIFIED";
case IncentiveOffer_OfferType.UNKNOWN:
return "UNKNOWN";
case IncentiveOffer_OfferType.NO_INCENTIVE:
return "NO_INCENTIVE";
case IncentiveOffer_OfferType.CYO_INCENTIVE:
return "CYO_INCENTIVE";
case IncentiveOffer_OfferType.UNRECOGNIZED:
default:
return "UNRECOGNIZED";
}
}
function createBaseFetchIncentiveRequest() {
return { language_code: undefined, country_code: undefined, email: undefined, type: undefined };
}
export const FetchIncentiveRequest = {
encode(message, writer = _m0.Writer.create()) {
if (message.language_code !== undefined) {
writer.uint32(10).string(message.language_code);
}
if (message.country_code !== undefined) {
writer.uint32(18).string(message.country_code);
}
if (message.email !== undefined) {
writer.uint32(26).string(message.email);
}
if (message.type !== undefined) {
writer.uint32(32).int32(message.type);
}
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 = createBaseFetchIncentiveRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.language_code = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.country_code = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.email = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.type = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
language_code: isSet(object.language_code) ? globalThis.String(object.language_code) : undefined,
country_code: isSet(object.country_code) ? globalThis.String(object.country_code) : undefined,
email: isSet(object.email) ? globalThis.String(object.email) : undefined,
type: isSet(object.type) ? fetchIncentiveRequest_IncentiveTypeFromJSON(object.type) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.language_code !== undefined) {
obj.language_code = message.language_code;
}
if (message.country_code !== undefined) {
obj.country_code = message.country_code;
}
if (message.email !== undefined) {
obj.email = message.email;
}
if (message.type !== undefined) {
obj.type = fetchIncentiveRequest_IncentiveTypeToJSON(message.type);
}
return obj;
},
create(base) {
return FetchIncentiveRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseFetchIncentiveRequest();
message.language_code = (_a = object.language_code) !== null && _a !== void 0 ? _a : undefined;
message.country_code = (_b = object.country_code) !== null && _b !== void 0 ? _b : undefined;
message.email = (_c = object.email) !== null && _c !== void 0 ? _c : undefined;
message.type = (_d = object.type) !== null && _d !== void 0 ? _d : undefined;
return message;
},
};
function createBaseIncentive() {
return {
incentive_id: undefined,
requirement: undefined,
incentive_terms_and_conditions_url: undefined,
type: undefined,
};
}
export const Incentive = {
encode(message, writer = _m0.Writer.create()) {
if (message.incentive_id !== undefined) {
writer.uint32(8).int64(message.incentive_id);
}
if (message.requirement !== undefined) {
Incentive_Requirement.encode(message.requirement, writer.uint32(18).fork()).ldelim();
}
if (message.incentive_terms_and_conditions_url !== undefined) {
writer.uint32(26).string(message.incentive_terms_and_conditions_url);
}
if (message.type !== undefined) {
writer.uint32(32).int32(message.type);
}
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 = createBaseIncentive();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.incentive_id = longToString(reader.int64());
continue;
case 2:
if (tag !== 18) {
break;
}
message.requirement = Incentive_Requirement.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.incentive_terms_and_conditions_url = reader.string();
continue;
case 4:
if (tag !== 32) {
break;
}
message.type = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
incentive_id: isSet(object.incentive_id) ? globalThis.String(object.incentive_id) : undefined,
requirement: isSet(object.requirement) ? Incentive_Requirement.fromJSON(object.requirement) : undefined,
incentive_terms_and_conditions_url: isSet(object.incentive_terms_and_conditions_url)
? globalThis.String(object.incentive_terms_and_conditions_url)
: undefined,
type: isSet(object.type) ? fetchIncentiveRequest_IncentiveTypeFromJSON(object.type) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.incentive_id !== undefined) {
obj.incentive_id = message.incentive_id;
}
if (message.requirement !== undefined) {
obj.requirement = Incentive_Requirement.toJSON(message.requirement);
}
if (message.incentive_terms_and_conditions_url !== undefined) {
obj.incentive_terms_and_conditions_url = message.incentive_terms_and_conditions_url;
}
if (message.type !== undefined) {
obj.type = fetchIncentiveRequest_IncentiveTypeToJSON(message.type);
}
return obj;
},
create(base) {
return Incentive.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseIncentive();
message.incentive_id = (_a = object.incentive_id) !== null && _a !== void 0 ? _a : undefined;
message.requirement = (object.requirement !== undefined && object.requirement !== null)
? Incentive_Requirement.fromPartial(object.requirement)
: undefined;
message.incentive_terms_and_conditions_url = (_b = object.incentive_terms_and_conditions_url) !== null && _b !== void 0 ? _b : undefined;
message.type = (_c = object.type) !== null && _c !== void 0 ? _c : undefined;
return message;
},
};
function createBaseIncentive_Requirement() {
return { spend: undefined };
}
export const Incentive_Requirement = {
encode(message, writer = _m0.Writer.create()) {
if (message.spend !== undefined) {
Incentive_Requirement_Spend.encode(message.spend, writer.uint32(10).fork()).ldelim();
}
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 = createBaseIncentive_Requirement();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.spend = Incentive_Requirement_Spend.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { spend: isSet(object.spend) ? Incentive_Requirement_Spend.fromJSON(object.spend) : undefined };
},
toJSON(message) {
const obj = {};
if (message.spend !== undefined) {
obj.spend = Incentive_Requirement_Spend.toJSON(message.spend);
}
return obj;
},
create(base) {
return Incentive_Requirement.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseIncentive_Requirement();
message.spend = (object.spend !== undefined && object.spend !== null)
? Incentive_Requirement_Spend.fromPartial(object.spend)
: undefined;
return message;
},
};
function createBaseIncentive_Requirement_Spend() {
return { award_amount: undefined, required_amount: undefined };
}
export const Incentive_Requirement_Spend = {
encode(message, writer = _m0.Writer.create()) {
if (message.award_amount !== undefined) {
Money.encode(message.award_amount, writer.uint32(10).fork()).ldelim();
}
if (message.required_amount !== undefined) {
Money.encode(message.required_amount, writer.uint32(18).fork()).ldelim();
}
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 = createBaseIncentive_Requirement_Spend();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.award_amount = Money.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.required_amount = Money.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
award_amount: isSet(object.award_amount) ? Money.fromJSON(object.award_amount) : undefined,
required_amount: isSet(object.required_amount) ? Money.fromJSON(object.required_amount) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.award_amount !== undefined) {
obj.award_amount = Money.toJSON(message.award_amount);
}
if (message.required_amount !== undefined) {
obj.required_amount = Money.toJSON(message.required_amount);
}
return obj;
},
create(base) {
return Incentive_Requirement_Spend.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseIncentive_Requirement_Spend();
message.award_amount = (object.award_amount !== undefined && object.award_amount !== null)
? Money.fromPartial(object.award_amount)
: undefined;
message.required_amount = (object.required_amount !== undefined && object.required_amount !== null)
? Money.fromPartial(object.required_amount)
: undefined;
return message;
},
};
function createBaseCyoIncentives() {
return { low_offer: undefined, medium_offer: undefined, high_offer: undefined };
}
export const CyoIncentives = {
encode(message, writer = _m0.Writer.create()) {
if (message.low_offer !== undefined) {
Incentive.encode(message.low_offer, writer.uint32(10).fork()).ldelim();
}
if (message.medium_offer !== undefined) {
Incentive.encode(message.medium_offer, writer.uint32(18).fork()).ldelim();
}
if (message.high_offer !== undefined) {
Incentive.encode(message.high_offer, writer.uint32(26).fork()).ldelim();
}
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 = createBaseCyoIncentives();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.low_offer = Incentive.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.medium_offer = Incentive.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.high_offer = Incentive.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
low_offer: isSet(object.low_offer) ? Incentive.fromJSON(object.low_offer) : undefined,
medium_offer: isSet(object.medium_offer) ? Incentive.fromJSON(object.medium_offer) : undefined,
high_offer: isSet(object.high_offer) ? Incentive.fromJSON(object.high_offer) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.low_offer !== undefined) {
obj.low_offer = Incentive.toJSON(message.low_offer);
}
if (message.medium_offer !== undefined) {
obj.medium_offer = Incentive.toJSON(message.medium_offer);
}
if (message.high_offer !== undefined) {
obj.high_offer = Incentive.toJSON(message.high_offer);
}
return obj;
},
create(base) {
return CyoIncentives.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseCyoIncentives();
message.low_offer = (object.low_offer !== undefined && object.low_offer !== null)
? Incentive.fromPartial(object.low_offer)
: undefined;
message.medium_offer = (object.medium_offer !== undefined && object.medium_offer !== null)
? Incentive.fromPartial(object.medium_offer)
: undefined;
message.high_offer = (object.high_offer !== undefined && object.high_offer !== null)
? Incentive.fromPartial(object.high_offer)
: undefined;
return message;
},
};
function createBaseIncentiveOffer() {
return { type: undefined, consolidated_terms_and_conditions_url: undefined, cyo_incentives: undefined };
}
export const IncentiveOffer = {
encode(message, writer = _m0.Writer.create()) {
if (message.type !== undefined) {
writer.uint32(8).int32(message.type);
}
if (message.consolidated_terms_and_conditions_url !== undefined) {
writer.uint32(18).string(message.consolidated_terms_and_conditions_url);
}
if (message.cyo_incentives !== undefined) {
CyoIncentives.encode(message.cyo_incentives, writer.uint32(26).fork()).ldelim();
}
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 = createBaseIncentiveOffer();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.type = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.consolidated_terms_and_conditions_url = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.cyo_incentives = CyoIncentives.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
type: isSet(object.type) ? incentiveOffer_OfferTypeFromJSON(object.type) : undefined,
consolidated_terms_and_conditions_url: isSet(object.consolidated_terms_and_conditions_url)
? globalThis.String(object.consolidated_terms_and_conditions_url)
: undefined,
cyo_incentives: isSet(object.cyo_incentives) ? CyoIncentives.fromJSON(object.cyo_incentives) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.type !== undefined) {
obj.type = incentiveOffer_OfferTypeToJSON(message.type);
}
if (message.consolidated_terms_and_conditions_url !== undefined) {
obj.consolidated_terms_and_conditions_url = message.consolidated_terms_and_conditions_url;
}
if (message.cyo_incentives !== undefined) {
obj.cyo_incentives = CyoIncentives.toJSON(message.cyo_incentives);
}
return obj;
},
create(base) {
return IncentiveOffer.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseIncentiveOffer();
message.type = (_a = object.type) !== null && _a !== void 0 ? _a : undefined;
message.consolidated_terms_and_conditions_url = (_b = object.consolidated_terms_and_conditions_url) !== null && _b !== void 0 ? _b : undefined;
message.cyo_incentives = (object.cyo_incentives !== undefined && object.cyo_incentives !== null)
? CyoIncentives.fromPartial(object.cyo_incentives)
: undefined;
return message;
},
};
function createBaseFetchIncentiveResponse() {
return { incentive_offer: undefined };
}
export const FetchIncentiveResponse = {
encode(message, writer = _m0.Writer.create()) {
if (message.incentive_offer !== undefined) {
IncentiveOffer.encode(message.incentive_offer, writer.uint32(10).fork()).ldelim();
}
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 = createBaseFetchIncentiveResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.incentive_offer = IncentiveOffer.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
incentive_offer: isSet(object.incentive_offer) ? IncentiveOffer.fromJSON(object.incentive_offer) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.incentive_offer !== undefined) {
obj.incentive_offer = IncentiveOffer.toJSON(message.incentive_offer);
}
return obj;
},
create(base) {
return FetchIncentiveResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseFetchIncentiveResponse();
message.incentive_offer = (object.incentive_offer !== undefined && object.incentive_offer !== null)
? IncentiveOffer.fromPartial(object.incentive_offer)
: undefined;
return message;
},
};
function createBaseApplyIncentiveRequest() {
return { selected_incentive_id: undefined, customer_id: undefined, country_code: undefined };
}
export const ApplyIncentiveRequest = {
encode(message, writer = _m0.Writer.create()) {
if (message.selected_incentive_id !== undefined) {
writer.uint32(8).int64(message.selected_incentive_id);
}
if (message.customer_id !== undefined) {
writer.uint32(18).string(message.customer_id);
}
if (message.country_code !== undefined) {
writer.uint32(26).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 = createBaseApplyIncentiveRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.selected_incentive_id = longToString(reader.int64());
continue;
case 2:
if (tag !== 18) {
break;
}
message.customer_id = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.country_code = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
selected_incentive_id: isSet(object.selected_incentive_id)
? globalThis.String(object.selected_incentive_id)
: undefined,
customer_id: isSet(object.customer_id) ? globalThis.String(object.customer_id) : undefined,
country_code: isSet(object.country_code) ? globalThis.String(object.country_code) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.selected_incentive_id !== undefined) {
obj.selected_incentive_id = message.selected_incentive_id;
}
if (message.customer_id !== undefined) {
obj.customer_id = message.customer_id;
}
if (message.country_code !== undefined) {
obj.country_code = message.country_code;
}
return obj;
},
create(base) {
return ApplyIncentiveRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseApplyIncentiveRequest();
message.selected_incentive_id = (_a = object.selected_incentive_id) !== null && _a !== void 0 ? _a : undefined;
message.customer_id = (_b = object.customer_id) !== null && _b !== void 0 ? _b : undefined;
message.country_code = (_c = object.country_code) !== null && _c !== void 0 ? _c : undefined;
return message;
},
};
function createBaseApplyIncentiveResponse() {
return { coupon_code: undefined, creation_time: undefined };
}
export const ApplyIncentiveResponse = {
encode(message, writer = _m0.Writer.create()) {
if (message.coupon_code !== undefined) {
writer.uint32(10).string(message.coupon_code);
}
if (message.creation_time !== undefined) {
writer.uint32(18).string(message.creation_time);
}
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 = createBaseApplyIncentiveResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.coupon_code = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.creation_time = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
coupon_code: isSet(object.coupon_code) ? globalThis.String(object.coupon_code) : undefined,
creation_time: isSet(object.creation_time) ? globalThis.String(object.creation_time) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.coupon_code !== undefined) {
obj.coupon_code = message.coupon_code;
}
if (message.creation_time !== undefined) {
obj.creation_time = message.creation_time;
}
return obj;
},
create(base) {
return ApplyIncentiveResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseApplyIncentiveResponse();
message.coupon_code = (_a = object.coupon_code) !== null && _a !== void 0 ? _a : undefined;
message.creation_time = (_b = object.creation_time) !== null && _b !== void 0 ? _b : undefined;
return message;
},
};
export const IncentiveServiceService = {
/** Returns incentives for a given user. */
fetchIncentive: {
path: "/google.ads.googleads.v24.services.IncentiveService/FetchIncentive",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(FetchIncentiveRequest.encode(value).finish()),
requestDeserialize: (value) => FetchIncentiveRequest.decode(value),
responseSerialize: (value) => Buffer.from(FetchIncentiveResponse.encode(value).finish()),
responseDeserialize: (value) => FetchIncentiveResponse.decode(value),
},
/** Applies the incentive for the ads customer. */
applyIncentive: {
path: "/google.ads.googleads.v24.services.IncentiveService/ApplyIncentive",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(ApplyIncentiveRequest.encode(value).finish()),
requestDeserialize: (value) => ApplyIncentiveRequest.decode(value),
responseSerialize: (value) => Buffer.from(ApplyIncentiveResponse.encode(value).finish()),
responseDeserialize: (value) => ApplyIncentiveResponse.decode(value),
},
};
export const IncentiveServiceClient = makeGenericClientConstructor(IncentiveServiceService, "google.ads.googleads.v24.services.IncentiveService");
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;
}