UNPKG

@htdangkhoa/google-ads

Version:
839 lines (838 loc) 35.4 kB
"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/services/incentive_service.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.IncentiveServiceClient = exports.IncentiveServiceService = exports.ApplyIncentiveResponse = exports.ApplyIncentiveRequest = exports.FetchIncentiveResponse = exports.IncentiveOffer = exports.CyoIncentives = exports.Incentive_Requirement_Spend = exports.Incentive_Requirement = exports.Incentive = exports.FetchIncentiveRequest = exports.IncentiveOffer_OfferType = exports.FetchIncentiveRequest_IncentiveType = void 0; exports.fetchIncentiveRequest_IncentiveTypeFromJSON = fetchIncentiveRequest_IncentiveTypeFromJSON; exports.fetchIncentiveRequest_IncentiveTypeToJSON = fetchIncentiveRequest_IncentiveTypeToJSON; exports.incentiveOffer_OfferTypeFromJSON = incentiveOffer_OfferTypeFromJSON; exports.incentiveOffer_OfferTypeToJSON = incentiveOffer_OfferTypeToJSON; /* eslint-disable */ const grpc_js_1 = require("@grpc/grpc-js"); const long_1 = __importDefault(require("long")); const minimal_js_1 = __importDefault(require("protobufjs/minimal.js")); const money_js_1 = require("../../../../type/money.js"); /** Types of incentives offered */ 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 || (exports.FetchIncentiveRequest_IncentiveType = FetchIncentiveRequest_IncentiveType = {})); 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; } } 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. */ 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 || (exports.IncentiveOffer_OfferType = IncentiveOffer_OfferType = {})); 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; } } 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 }; } exports.FetchIncentiveRequest = { encode(message, writer = minimal_js_1.default.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 minimal_js_1.default.Reader ? input : minimal_js_1.default.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 exports.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, }; } exports.Incentive = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.incentive_id !== undefined) { writer.uint32(8).int64(message.incentive_id); } if (message.requirement !== undefined) { exports.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 minimal_js_1.default.Reader ? input : minimal_js_1.default.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 = exports.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) ? exports.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 = exports.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 exports.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) ? exports.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 }; } exports.Incentive_Requirement = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.spend !== undefined) { exports.Incentive_Requirement_Spend.encode(message.spend, writer.uint32(10).fork()).ldelim(); } 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 = createBaseIncentive_Requirement(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.spend = exports.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) ? exports.Incentive_Requirement_Spend.fromJSON(object.spend) : undefined }; }, toJSON(message) { const obj = {}; if (message.spend !== undefined) { obj.spend = exports.Incentive_Requirement_Spend.toJSON(message.spend); } return obj; }, create(base) { return exports.Incentive_Requirement.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { const message = createBaseIncentive_Requirement(); message.spend = (object.spend !== undefined && object.spend !== null) ? exports.Incentive_Requirement_Spend.fromPartial(object.spend) : undefined; return message; }, }; function createBaseIncentive_Requirement_Spend() { return { award_amount: undefined, required_amount: undefined }; } exports.Incentive_Requirement_Spend = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.award_amount !== undefined) { money_js_1.Money.encode(message.award_amount, writer.uint32(10).fork()).ldelim(); } if (message.required_amount !== undefined) { money_js_1.Money.encode(message.required_amount, writer.uint32(18).fork()).ldelim(); } 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 = createBaseIncentive_Requirement_Spend(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.award_amount = money_js_1.Money.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } message.required_amount = money_js_1.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_js_1.Money.fromJSON(object.award_amount) : undefined, required_amount: isSet(object.required_amount) ? money_js_1.Money.fromJSON(object.required_amount) : undefined, }; }, toJSON(message) { const obj = {}; if (message.award_amount !== undefined) { obj.award_amount = money_js_1.Money.toJSON(message.award_amount); } if (message.required_amount !== undefined) { obj.required_amount = money_js_1.Money.toJSON(message.required_amount); } return obj; }, create(base) { return exports.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_js_1.Money.fromPartial(object.award_amount) : undefined; message.required_amount = (object.required_amount !== undefined && object.required_amount !== null) ? money_js_1.Money.fromPartial(object.required_amount) : undefined; return message; }, }; function createBaseCyoIncentives() { return { low_offer: undefined, medium_offer: undefined, high_offer: undefined }; } exports.CyoIncentives = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.low_offer !== undefined) { exports.Incentive.encode(message.low_offer, writer.uint32(10).fork()).ldelim(); } if (message.medium_offer !== undefined) { exports.Incentive.encode(message.medium_offer, writer.uint32(18).fork()).ldelim(); } if (message.high_offer !== undefined) { exports.Incentive.encode(message.high_offer, writer.uint32(26).fork()).ldelim(); } 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 = createBaseCyoIncentives(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.low_offer = exports.Incentive.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } message.medium_offer = exports.Incentive.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } message.high_offer = exports.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) ? exports.Incentive.fromJSON(object.low_offer) : undefined, medium_offer: isSet(object.medium_offer) ? exports.Incentive.fromJSON(object.medium_offer) : undefined, high_offer: isSet(object.high_offer) ? exports.Incentive.fromJSON(object.high_offer) : undefined, }; }, toJSON(message) { const obj = {}; if (message.low_offer !== undefined) { obj.low_offer = exports.Incentive.toJSON(message.low_offer); } if (message.medium_offer !== undefined) { obj.medium_offer = exports.Incentive.toJSON(message.medium_offer); } if (message.high_offer !== undefined) { obj.high_offer = exports.Incentive.toJSON(message.high_offer); } return obj; }, create(base) { return exports.CyoIncentives.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { const message = createBaseCyoIncentives(); message.low_offer = (object.low_offer !== undefined && object.low_offer !== null) ? exports.Incentive.fromPartial(object.low_offer) : undefined; message.medium_offer = (object.medium_offer !== undefined && object.medium_offer !== null) ? exports.Incentive.fromPartial(object.medium_offer) : undefined; message.high_offer = (object.high_offer !== undefined && object.high_offer !== null) ? exports.Incentive.fromPartial(object.high_offer) : undefined; return message; }, }; function createBaseIncentiveOffer() { return { type: undefined, consolidated_terms_and_conditions_url: undefined, cyo_incentives: undefined }; } exports.IncentiveOffer = { encode(message, writer = minimal_js_1.default.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) { exports.CyoIncentives.encode(message.cyo_incentives, writer.uint32(26).fork()).ldelim(); } 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 = 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 = exports.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) ? exports.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 = exports.CyoIncentives.toJSON(message.cyo_incentives); } return obj; }, create(base) { return exports.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) ? exports.CyoIncentives.fromPartial(object.cyo_incentives) : undefined; return message; }, }; function createBaseFetchIncentiveResponse() { return { incentive_offer: undefined }; } exports.FetchIncentiveResponse = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.incentive_offer !== undefined) { exports.IncentiveOffer.encode(message.incentive_offer, writer.uint32(10).fork()).ldelim(); } 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 = createBaseFetchIncentiveResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.incentive_offer = exports.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) ? exports.IncentiveOffer.fromJSON(object.incentive_offer) : undefined, }; }, toJSON(message) { const obj = {}; if (message.incentive_offer !== undefined) { obj.incentive_offer = exports.IncentiveOffer.toJSON(message.incentive_offer); } return obj; }, create(base) { return exports.FetchIncentiveResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { const message = createBaseFetchIncentiveResponse(); message.incentive_offer = (object.incentive_offer !== undefined && object.incentive_offer !== null) ? exports.IncentiveOffer.fromPartial(object.incentive_offer) : undefined; return message; }, }; function createBaseApplyIncentiveRequest() { return { selected_incentive_id: undefined, customer_id: undefined, country_code: undefined }; } exports.ApplyIncentiveRequest = { encode(message, writer = minimal_js_1.default.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 minimal_js_1.default.Reader ? input : minimal_js_1.default.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 exports.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 }; } exports.ApplyIncentiveResponse = { encode(message, writer = minimal_js_1.default.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 minimal_js_1.default.Reader ? input : minimal_js_1.default.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 exports.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; }, }; exports.IncentiveServiceService = { /** Returns incentives for a given user. */ fetchIncentive: { path: "/google.ads.googleads.v24.services.IncentiveService/FetchIncentive", requestStream: false, responseStream: false, requestSerialize: (value) => Buffer.from(exports.FetchIncentiveRequest.encode(value).finish()), requestDeserialize: (value) => exports.FetchIncentiveRequest.decode(value), responseSerialize: (value) => Buffer.from(exports.FetchIncentiveResponse.encode(value).finish()), responseDeserialize: (value) => exports.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(exports.ApplyIncentiveRequest.encode(value).finish()), requestDeserialize: (value) => exports.ApplyIncentiveRequest.decode(value), responseSerialize: (value) => Buffer.from(exports.ApplyIncentiveResponse.encode(value).finish()), responseDeserialize: (value) => exports.ApplyIncentiveResponse.decode(value), }, }; exports.IncentiveServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.IncentiveServiceService, "google.ads.googleads.v24.services.IncentiveService"); 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; }