UNPKG

@htdangkhoa/google-ads

Version:
1,129 lines 72.8 kB
// 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/v21/services/conversion_upload_service.proto /* eslint-disable */ import { makeGenericClientConstructor, } from "@grpc/grpc-js"; import Long from "long"; import _m0 from "protobufjs/minimal.js"; import { Status } from "../../../../rpc/status.js"; import { Consent } from "../common/consent.js"; import { UserIdentifier } from "../common/offline_user_data.js"; import { conversionCustomerTypeEnum_ConversionCustomerTypeFromJSON, conversionCustomerTypeEnum_ConversionCustomerTypeToJSON, } from "../enums/conversion_customer_type.js"; import { conversionEnvironmentEnum_ConversionEnvironmentFromJSON, conversionEnvironmentEnum_ConversionEnvironmentToJSON, } from "../enums/conversion_environment_enum.js"; function createBaseUploadClickConversionsRequest() { return { customer_id: "", conversions: [], partial_failure: false, validate_only: false, job_id: undefined }; } export const UploadClickConversionsRequest = { encode(message, writer = _m0.Writer.create()) { if (message.customer_id !== undefined && message.customer_id !== "") { writer.uint32(10).string(message.customer_id); } if (message.conversions !== undefined && message.conversions.length !== 0) { for (const v of message.conversions) { ClickConversion.encode(v, writer.uint32(18).fork()).ldelim(); } } if (message.partial_failure !== undefined && message.partial_failure !== false) { writer.uint32(24).bool(message.partial_failure); } if (message.validate_only !== undefined && message.validate_only !== false) { writer.uint32(32).bool(message.validate_only); } if (message.job_id !== undefined) { writer.uint32(48).int32(message.job_id); } 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 = createBaseUploadClickConversionsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.customer_id = reader.string(); continue; case 2: if (tag !== 18) { break; } message.conversions.push(ClickConversion.decode(reader, reader.uint32())); continue; case 3: if (tag !== 24) { break; } message.partial_failure = reader.bool(); continue; case 4: if (tag !== 32) { break; } message.validate_only = reader.bool(); continue; case 6: if (tag !== 48) { break; } message.job_id = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { customer_id: isSet(object.customer_id) ? globalThis.String(object.customer_id) : "", conversions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.conversions) ? object.conversions.map((e) => ClickConversion.fromJSON(e)) : [], partial_failure: isSet(object.partial_failure) ? globalThis.Boolean(object.partial_failure) : false, validate_only: isSet(object.validate_only) ? globalThis.Boolean(object.validate_only) : false, job_id: isSet(object.job_id) ? globalThis.Number(object.job_id) : undefined, }; }, toJSON(message) { var _a; const obj = {}; if (message.customer_id !== undefined && message.customer_id !== "") { obj.customer_id = message.customer_id; } if ((_a = message.conversions) === null || _a === void 0 ? void 0 : _a.length) { obj.conversions = message.conversions.map((e) => ClickConversion.toJSON(e)); } if (message.partial_failure !== undefined && message.partial_failure !== false) { obj.partial_failure = message.partial_failure; } if (message.validate_only !== undefined && message.validate_only !== false) { obj.validate_only = message.validate_only; } if (message.job_id !== undefined) { obj.job_id = Math.round(message.job_id); } return obj; }, create(base) { return UploadClickConversionsRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseUploadClickConversionsRequest(); message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : ""; message.conversions = ((_b = object.conversions) === null || _b === void 0 ? void 0 : _b.map((e) => ClickConversion.fromPartial(e))) || []; message.partial_failure = (_c = object.partial_failure) !== null && _c !== void 0 ? _c : false; message.validate_only = (_d = object.validate_only) !== null && _d !== void 0 ? _d : false; message.job_id = (_e = object.job_id) !== null && _e !== void 0 ? _e : undefined; return message; }, }; function createBaseUploadClickConversionsResponse() { return { partial_failure_error: undefined, results: [], job_id: "0" }; } export const UploadClickConversionsResponse = { encode(message, writer = _m0.Writer.create()) { if (message.partial_failure_error !== undefined) { Status.encode(message.partial_failure_error, writer.uint32(10).fork()).ldelim(); } if (message.results !== undefined && message.results.length !== 0) { for (const v of message.results) { ClickConversionResult.encode(v, writer.uint32(18).fork()).ldelim(); } } if (message.job_id !== undefined && message.job_id !== "0") { writer.uint32(24).int64(message.job_id); } 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 = createBaseUploadClickConversionsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.partial_failure_error = Status.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } message.results.push(ClickConversionResult.decode(reader, reader.uint32())); continue; case 3: if (tag !== 24) { break; } message.job_id = longToString(reader.int64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { partial_failure_error: isSet(object.partial_failure_error) ? Status.fromJSON(object.partial_failure_error) : undefined, results: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.results) ? object.results.map((e) => ClickConversionResult.fromJSON(e)) : [], job_id: isSet(object.job_id) ? globalThis.String(object.job_id) : "0", }; }, toJSON(message) { var _a; const obj = {}; if (message.partial_failure_error !== undefined) { obj.partial_failure_error = Status.toJSON(message.partial_failure_error); } if ((_a = message.results) === null || _a === void 0 ? void 0 : _a.length) { obj.results = message.results.map((e) => ClickConversionResult.toJSON(e)); } if (message.job_id !== undefined && message.job_id !== "0") { obj.job_id = message.job_id; } return obj; }, create(base) { return UploadClickConversionsResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseUploadClickConversionsResponse(); message.partial_failure_error = (object.partial_failure_error !== undefined && object.partial_failure_error !== null) ? Status.fromPartial(object.partial_failure_error) : undefined; message.results = ((_a = object.results) === null || _a === void 0 ? void 0 : _a.map((e) => ClickConversionResult.fromPartial(e))) || []; message.job_id = (_b = object.job_id) !== null && _b !== void 0 ? _b : "0"; return message; }, }; function createBaseUploadCallConversionsRequest() { return { customer_id: "", conversions: [], partial_failure: false, validate_only: false }; } export const UploadCallConversionsRequest = { encode(message, writer = _m0.Writer.create()) { if (message.customer_id !== undefined && message.customer_id !== "") { writer.uint32(10).string(message.customer_id); } if (message.conversions !== undefined && message.conversions.length !== 0) { for (const v of message.conversions) { CallConversion.encode(v, writer.uint32(18).fork()).ldelim(); } } if (message.partial_failure !== undefined && message.partial_failure !== false) { writer.uint32(24).bool(message.partial_failure); } if (message.validate_only !== undefined && message.validate_only !== false) { writer.uint32(32).bool(message.validate_only); } 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 = createBaseUploadCallConversionsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.customer_id = reader.string(); continue; case 2: if (tag !== 18) { break; } message.conversions.push(CallConversion.decode(reader, reader.uint32())); continue; case 3: if (tag !== 24) { break; } message.partial_failure = reader.bool(); continue; case 4: if (tag !== 32) { break; } message.validate_only = reader.bool(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { customer_id: isSet(object.customer_id) ? globalThis.String(object.customer_id) : "", conversions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.conversions) ? object.conversions.map((e) => CallConversion.fromJSON(e)) : [], partial_failure: isSet(object.partial_failure) ? globalThis.Boolean(object.partial_failure) : false, validate_only: isSet(object.validate_only) ? globalThis.Boolean(object.validate_only) : false, }; }, toJSON(message) { var _a; const obj = {}; if (message.customer_id !== undefined && message.customer_id !== "") { obj.customer_id = message.customer_id; } if ((_a = message.conversions) === null || _a === void 0 ? void 0 : _a.length) { obj.conversions = message.conversions.map((e) => CallConversion.toJSON(e)); } if (message.partial_failure !== undefined && message.partial_failure !== false) { obj.partial_failure = message.partial_failure; } if (message.validate_only !== undefined && message.validate_only !== false) { obj.validate_only = message.validate_only; } return obj; }, create(base) { return UploadCallConversionsRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseUploadCallConversionsRequest(); message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : ""; message.conversions = ((_b = object.conversions) === null || _b === void 0 ? void 0 : _b.map((e) => CallConversion.fromPartial(e))) || []; message.partial_failure = (_c = object.partial_failure) !== null && _c !== void 0 ? _c : false; message.validate_only = (_d = object.validate_only) !== null && _d !== void 0 ? _d : false; return message; }, }; function createBaseUploadCallConversionsResponse() { return { partial_failure_error: undefined, results: [] }; } export const UploadCallConversionsResponse = { encode(message, writer = _m0.Writer.create()) { if (message.partial_failure_error !== undefined) { Status.encode(message.partial_failure_error, writer.uint32(10).fork()).ldelim(); } if (message.results !== undefined && message.results.length !== 0) { for (const v of message.results) { CallConversionResult.encode(v, 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 = createBaseUploadCallConversionsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.partial_failure_error = Status.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } message.results.push(CallConversionResult.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { partial_failure_error: isSet(object.partial_failure_error) ? Status.fromJSON(object.partial_failure_error) : undefined, results: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.results) ? object.results.map((e) => CallConversionResult.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if (message.partial_failure_error !== undefined) { obj.partial_failure_error = Status.toJSON(message.partial_failure_error); } if ((_a = message.results) === null || _a === void 0 ? void 0 : _a.length) { obj.results = message.results.map((e) => CallConversionResult.toJSON(e)); } return obj; }, create(base) { return UploadCallConversionsResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseUploadCallConversionsResponse(); message.partial_failure_error = (object.partial_failure_error !== undefined && object.partial_failure_error !== null) ? Status.fromPartial(object.partial_failure_error) : undefined; message.results = ((_a = object.results) === null || _a === void 0 ? void 0 : _a.map((e) => CallConversionResult.fromPartial(e))) || []; return message; }, }; function createBaseClickConversion() { return { gclid: undefined, gbraid: "", wbraid: "", conversion_action: undefined, conversion_date_time: undefined, conversion_value: undefined, currency_code: undefined, order_id: undefined, external_attribution_data: undefined, custom_variables: [], cart_data: undefined, user_identifiers: [], conversion_environment: 0, consent: undefined, customer_type: 0, user_ip_address: undefined, session_attributes_encoded: undefined, session_attributes_key_value_pairs: undefined, }; } export const ClickConversion = { encode(message, writer = _m0.Writer.create()) { if (message.gclid !== undefined) { writer.uint32(74).string(message.gclid); } if (message.gbraid !== undefined && message.gbraid !== "") { writer.uint32(146).string(message.gbraid); } if (message.wbraid !== undefined && message.wbraid !== "") { writer.uint32(154).string(message.wbraid); } if (message.conversion_action !== undefined) { writer.uint32(82).string(message.conversion_action); } if (message.conversion_date_time !== undefined) { writer.uint32(90).string(message.conversion_date_time); } if (message.conversion_value !== undefined) { writer.uint32(97).double(message.conversion_value); } if (message.currency_code !== undefined) { writer.uint32(106).string(message.currency_code); } if (message.order_id !== undefined) { writer.uint32(114).string(message.order_id); } if (message.external_attribution_data !== undefined) { ExternalAttributionData.encode(message.external_attribution_data, writer.uint32(58).fork()).ldelim(); } if (message.custom_variables !== undefined && message.custom_variables.length !== 0) { for (const v of message.custom_variables) { CustomVariable.encode(v, writer.uint32(122).fork()).ldelim(); } } if (message.cart_data !== undefined) { CartData.encode(message.cart_data, writer.uint32(130).fork()).ldelim(); } if (message.user_identifiers !== undefined && message.user_identifiers.length !== 0) { for (const v of message.user_identifiers) { UserIdentifier.encode(v, writer.uint32(138).fork()).ldelim(); } } if (message.conversion_environment !== undefined && message.conversion_environment !== 0) { writer.uint32(160).int32(message.conversion_environment); } if (message.consent !== undefined) { Consent.encode(message.consent, writer.uint32(186).fork()).ldelim(); } if (message.customer_type !== undefined && message.customer_type !== 0) { writer.uint32(208).int32(message.customer_type); } if (message.user_ip_address !== undefined) { writer.uint32(218).string(message.user_ip_address); } if (message.session_attributes_encoded !== undefined) { writer.uint32(194).bytes(message.session_attributes_encoded); } if (message.session_attributes_key_value_pairs !== undefined) { SessionAttributesKeyValuePairs.encode(message.session_attributes_key_value_pairs, writer.uint32(202).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 = createBaseClickConversion(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 9: if (tag !== 74) { break; } message.gclid = reader.string(); continue; case 18: if (tag !== 146) { break; } message.gbraid = reader.string(); continue; case 19: if (tag !== 154) { break; } message.wbraid = reader.string(); continue; case 10: if (tag !== 82) { break; } message.conversion_action = reader.string(); continue; case 11: if (tag !== 90) { break; } message.conversion_date_time = reader.string(); continue; case 12: if (tag !== 97) { break; } message.conversion_value = reader.double(); continue; case 13: if (tag !== 106) { break; } message.currency_code = reader.string(); continue; case 14: if (tag !== 114) { break; } message.order_id = reader.string(); continue; case 7: if (tag !== 58) { break; } message.external_attribution_data = ExternalAttributionData.decode(reader, reader.uint32()); continue; case 15: if (tag !== 122) { break; } message.custom_variables.push(CustomVariable.decode(reader, reader.uint32())); continue; case 16: if (tag !== 130) { break; } message.cart_data = CartData.decode(reader, reader.uint32()); continue; case 17: if (tag !== 138) { break; } message.user_identifiers.push(UserIdentifier.decode(reader, reader.uint32())); continue; case 20: if (tag !== 160) { break; } message.conversion_environment = reader.int32(); continue; case 23: if (tag !== 186) { break; } message.consent = Consent.decode(reader, reader.uint32()); continue; case 26: if (tag !== 208) { break; } message.customer_type = reader.int32(); continue; case 27: if (tag !== 218) { break; } message.user_ip_address = reader.string(); continue; case 24: if (tag !== 194) { break; } message.session_attributes_encoded = reader.bytes(); continue; case 25: if (tag !== 202) { break; } message.session_attributes_key_value_pairs = SessionAttributesKeyValuePairs.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { gclid: isSet(object.gclid) ? globalThis.String(object.gclid) : undefined, gbraid: isSet(object.gbraid) ? globalThis.String(object.gbraid) : "", wbraid: isSet(object.wbraid) ? globalThis.String(object.wbraid) : "", conversion_action: isSet(object.conversion_action) ? globalThis.String(object.conversion_action) : undefined, conversion_date_time: isSet(object.conversion_date_time) ? globalThis.String(object.conversion_date_time) : undefined, conversion_value: isSet(object.conversion_value) ? globalThis.Number(object.conversion_value) : undefined, currency_code: isSet(object.currency_code) ? globalThis.String(object.currency_code) : undefined, order_id: isSet(object.order_id) ? globalThis.String(object.order_id) : undefined, external_attribution_data: isSet(object.external_attribution_data) ? ExternalAttributionData.fromJSON(object.external_attribution_data) : undefined, custom_variables: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.custom_variables) ? object.custom_variables.map((e) => CustomVariable.fromJSON(e)) : [], cart_data: isSet(object.cart_data) ? CartData.fromJSON(object.cart_data) : undefined, user_identifiers: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_identifiers) ? object.user_identifiers.map((e) => UserIdentifier.fromJSON(e)) : [], conversion_environment: isSet(object.conversion_environment) ? conversionEnvironmentEnum_ConversionEnvironmentFromJSON(object.conversion_environment) : 0, consent: isSet(object.consent) ? Consent.fromJSON(object.consent) : undefined, customer_type: isSet(object.customer_type) ? conversionCustomerTypeEnum_ConversionCustomerTypeFromJSON(object.customer_type) : 0, user_ip_address: isSet(object.user_ip_address) ? globalThis.String(object.user_ip_address) : undefined, session_attributes_encoded: isSet(object.session_attributes_encoded) ? bytesFromBase64(object.session_attributes_encoded) : undefined, session_attributes_key_value_pairs: isSet(object.session_attributes_key_value_pairs) ? SessionAttributesKeyValuePairs.fromJSON(object.session_attributes_key_value_pairs) : undefined, }; }, toJSON(message) { var _a, _b; const obj = {}; if (message.gclid !== undefined) { obj.gclid = message.gclid; } if (message.gbraid !== undefined && message.gbraid !== "") { obj.gbraid = message.gbraid; } if (message.wbraid !== undefined && message.wbraid !== "") { obj.wbraid = message.wbraid; } if (message.conversion_action !== undefined) { obj.conversion_action = message.conversion_action; } if (message.conversion_date_time !== undefined) { obj.conversion_date_time = message.conversion_date_time; } if (message.conversion_value !== undefined) { obj.conversion_value = message.conversion_value; } if (message.currency_code !== undefined) { obj.currency_code = message.currency_code; } if (message.order_id !== undefined) { obj.order_id = message.order_id; } if (message.external_attribution_data !== undefined) { obj.external_attribution_data = ExternalAttributionData.toJSON(message.external_attribution_data); } if ((_a = message.custom_variables) === null || _a === void 0 ? void 0 : _a.length) { obj.custom_variables = message.custom_variables.map((e) => CustomVariable.toJSON(e)); } if (message.cart_data !== undefined) { obj.cart_data = CartData.toJSON(message.cart_data); } if ((_b = message.user_identifiers) === null || _b === void 0 ? void 0 : _b.length) { obj.user_identifiers = message.user_identifiers.map((e) => UserIdentifier.toJSON(e)); } if (message.conversion_environment !== undefined && message.conversion_environment !== 0) { obj.conversion_environment = conversionEnvironmentEnum_ConversionEnvironmentToJSON(message.conversion_environment); } if (message.consent !== undefined) { obj.consent = Consent.toJSON(message.consent); } if (message.customer_type !== undefined && message.customer_type !== 0) { obj.customer_type = conversionCustomerTypeEnum_ConversionCustomerTypeToJSON(message.customer_type); } if (message.user_ip_address !== undefined) { obj.user_ip_address = message.user_ip_address; } if (message.session_attributes_encoded !== undefined) { obj.session_attributes_encoded = base64FromBytes(message.session_attributes_encoded); } if (message.session_attributes_key_value_pairs !== undefined) { obj.session_attributes_key_value_pairs = SessionAttributesKeyValuePairs.toJSON(message.session_attributes_key_value_pairs); } return obj; }, create(base) { return ClickConversion.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; const message = createBaseClickConversion(); message.gclid = (_a = object.gclid) !== null && _a !== void 0 ? _a : undefined; message.gbraid = (_b = object.gbraid) !== null && _b !== void 0 ? _b : ""; message.wbraid = (_c = object.wbraid) !== null && _c !== void 0 ? _c : ""; message.conversion_action = (_d = object.conversion_action) !== null && _d !== void 0 ? _d : undefined; message.conversion_date_time = (_e = object.conversion_date_time) !== null && _e !== void 0 ? _e : undefined; message.conversion_value = (_f = object.conversion_value) !== null && _f !== void 0 ? _f : undefined; message.currency_code = (_g = object.currency_code) !== null && _g !== void 0 ? _g : undefined; message.order_id = (_h = object.order_id) !== null && _h !== void 0 ? _h : undefined; message.external_attribution_data = (object.external_attribution_data !== undefined && object.external_attribution_data !== null) ? ExternalAttributionData.fromPartial(object.external_attribution_data) : undefined; message.custom_variables = ((_j = object.custom_variables) === null || _j === void 0 ? void 0 : _j.map((e) => CustomVariable.fromPartial(e))) || []; message.cart_data = (object.cart_data !== undefined && object.cart_data !== null) ? CartData.fromPartial(object.cart_data) : undefined; message.user_identifiers = ((_k = object.user_identifiers) === null || _k === void 0 ? void 0 : _k.map((e) => UserIdentifier.fromPartial(e))) || []; message.conversion_environment = (_l = object.conversion_environment) !== null && _l !== void 0 ? _l : 0; message.consent = (object.consent !== undefined && object.consent !== null) ? Consent.fromPartial(object.consent) : undefined; message.customer_type = (_m = object.customer_type) !== null && _m !== void 0 ? _m : 0; message.user_ip_address = (_o = object.user_ip_address) !== null && _o !== void 0 ? _o : undefined; message.session_attributes_encoded = (_p = object.session_attributes_encoded) !== null && _p !== void 0 ? _p : undefined; message.session_attributes_key_value_pairs = (object.session_attributes_key_value_pairs !== undefined && object.session_attributes_key_value_pairs !== null) ? SessionAttributesKeyValuePairs.fromPartial(object.session_attributes_key_value_pairs) : undefined; return message; }, }; function createBaseCallConversion() { return { caller_id: undefined, call_start_date_time: undefined, conversion_action: undefined, conversion_date_time: undefined, conversion_value: undefined, currency_code: undefined, custom_variables: [], consent: undefined, }; } export const CallConversion = { encode(message, writer = _m0.Writer.create()) { if (message.caller_id !== undefined) { writer.uint32(58).string(message.caller_id); } if (message.call_start_date_time !== undefined) { writer.uint32(66).string(message.call_start_date_time); } if (message.conversion_action !== undefined) { writer.uint32(74).string(message.conversion_action); } if (message.conversion_date_time !== undefined) { writer.uint32(82).string(message.conversion_date_time); } if (message.conversion_value !== undefined) { writer.uint32(89).double(message.conversion_value); } if (message.currency_code !== undefined) { writer.uint32(98).string(message.currency_code); } if (message.custom_variables !== undefined && message.custom_variables.length !== 0) { for (const v of message.custom_variables) { CustomVariable.encode(v, writer.uint32(106).fork()).ldelim(); } } if (message.consent !== undefined) { Consent.encode(message.consent, writer.uint32(114).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 = createBaseCallConversion(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 7: if (tag !== 58) { break; } message.caller_id = reader.string(); continue; case 8: if (tag !== 66) { break; } message.call_start_date_time = reader.string(); continue; case 9: if (tag !== 74) { break; } message.conversion_action = reader.string(); continue; case 10: if (tag !== 82) { break; } message.conversion_date_time = reader.string(); continue; case 11: if (tag !== 89) { break; } message.conversion_value = reader.double(); continue; case 12: if (tag !== 98) { break; } message.currency_code = reader.string(); continue; case 13: if (tag !== 106) { break; } message.custom_variables.push(CustomVariable.decode(reader, reader.uint32())); continue; case 14: if (tag !== 114) { break; } message.consent = Consent.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { caller_id: isSet(object.caller_id) ? globalThis.String(object.caller_id) : undefined, call_start_date_time: isSet(object.call_start_date_time) ? globalThis.String(object.call_start_date_time) : undefined, conversion_action: isSet(object.conversion_action) ? globalThis.String(object.conversion_action) : undefined, conversion_date_time: isSet(object.conversion_date_time) ? globalThis.String(object.conversion_date_time) : undefined, conversion_value: isSet(object.conversion_value) ? globalThis.Number(object.conversion_value) : undefined, currency_code: isSet(object.currency_code) ? globalThis.String(object.currency_code) : undefined, custom_variables: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.custom_variables) ? object.custom_variables.map((e) => CustomVariable.fromJSON(e)) : [], consent: isSet(object.consent) ? Consent.fromJSON(object.consent) : undefined, }; }, toJSON(message) { var _a; const obj = {}; if (message.caller_id !== undefined) { obj.caller_id = message.caller_id; } if (message.call_start_date_time !== undefined) { obj.call_start_date_time = message.call_start_date_time; } if (message.conversion_action !== undefined) { obj.conversion_action = message.conversion_action; } if (message.conversion_date_time !== undefined) { obj.conversion_date_time = message.conversion_date_time; } if (message.conversion_value !== undefined) { obj.conversion_value = message.conversion_value; } if (message.currency_code !== undefined) { obj.currency_code = message.currency_code; } if ((_a = message.custom_variables) === null || _a === void 0 ? void 0 : _a.length) { obj.custom_variables = message.custom_variables.map((e) => CustomVariable.toJSON(e)); } if (message.consent !== undefined) { obj.consent = Consent.toJSON(message.consent); } return obj; }, create(base) { return CallConversion.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g; const message = createBaseCallConversion(); message.caller_id = (_a = object.caller_id) !== null && _a !== void 0 ? _a : undefined; message.call_start_date_time = (_b = object.call_start_date_time) !== null && _b !== void 0 ? _b : undefined; message.conversion_action = (_c = object.conversion_action) !== null && _c !== void 0 ? _c : undefined; message.conversion_date_time = (_d = object.conversion_date_time) !== null && _d !== void 0 ? _d : undefined; message.conversion_value = (_e = object.conversion_value) !== null && _e !== void 0 ? _e : undefined; message.currency_code = (_f = object.currency_code) !== null && _f !== void 0 ? _f : undefined; message.custom_variables = ((_g = object.custom_variables) === null || _g === void 0 ? void 0 : _g.map((e) => CustomVariable.fromPartial(e))) || []; message.consent = (object.consent !== undefined && object.consent !== null) ? Consent.fromPartial(object.consent) : undefined; return message; }, }; function createBaseExternalAttributionData() { return { external_attribution_credit: undefined, external_attribution_model: undefined }; } export const ExternalAttributionData = { encode(message, writer = _m0.Writer.create()) { if (message.external_attribution_credit !== undefined) { writer.uint32(25).double(message.external_attribution_credit); } if (message.external_attribution_model !== undefined) { writer.uint32(34).string(message.external_attribution_model); } 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 = createBaseExternalAttributionData(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 3: if (tag !== 25) { break; } message.external_attribution_credit = reader.double(); continue; case 4: if (tag !== 34) { break; } message.external_attribution_model = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { external_attribution_credit: isSet(object.external_attribution_credit) ? globalThis.Number(object.external_attribution_credit) : undefined, external_attribution_model: isSet(object.external_attribution_model) ? globalThis.String(object.external_attribution_model) : undefined, }; }, toJSON(message) { const obj = {}; if (message.external_attribution_credit !== undefined) { obj.external_attribution_credit = message.external_attribution_credit; } if (message.external_attribution_model !== undefined) { obj.external_attribution_model = message.external_attribution_model; } return obj; }, create(base) { return ExternalAttributionData.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseExternalAttributionData(); message.external_attribution_credit = (_a = object.external_attribution_credit) !== null && _a !== void 0 ? _a : undefined; message.external_attribution_model = (_b = object.external_attribution_model) !== null && _b !== void 0 ? _b : undefined; return message; }, }; function createBaseClickConversionResult() { return { gclid: undefined, gbraid: "", wbraid: "", conversion_action: undefined, conversion_date_time: undefined, user_identifiers: [], }; } export const ClickConversionResult = { encode(message, writer = _m0.Writer.create()) { if (message.gclid !== undefined) { writer.uint32(34).string(message.gclid); } if (message.gbraid !== undefined && message.gbraid !== "") { writer.uint32(66).string(message.gbraid); } if (message.wbraid !== undefined && message.wbraid !== "") { writer.uint32(74).string(message.wbraid); } if (message.conversion_action !== undefined) { writer.uint32(42).string(message.conversion_action); } if (message.conversion_date_time !== undefined) { writer.uint32(50).string(message.conversion_date_time); } if (message.user_identifiers !== undefined && message.user_identifiers.length !== 0) { for (const v of message.user_identifiers) { UserIdentifier.encode(v, writer.uint32(58).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 = createBaseClickConversionResult(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 4: if (tag !== 34) { break; } message.gclid = reader.string(); continue; case 8: if (tag !== 66) { break; } message.gbraid = reader.string(); continue; case 9: if (tag !== 74) { break; } message.wbraid = reader.string(); continue; case 5: if (tag !== 42) { break; } message.conversion_action = reader.string(); continue; case 6: if (tag !== 50) { break; } message.conversion_date_time = reader.string(); continue; case 7: if (tag !== 58) { break; } message.user_identifiers.push(UserIdentifier.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { gclid: isSet(object.gclid) ? globalThis.String(object.gclid) : undefined, gbraid: isSet(object.gbraid) ? globalThis.String(object.gbraid) : "", wbraid: isSet(object.wbraid) ? globalThis.String(object.wbraid) : "", conversion_action: isSet(object.conversion_action) ? globalThis.String(object.conversion_action) : undefined, conversion_date_time: isSet(object.conversion_date_time) ? globalThis.String(object.conversion_date_time) : undefined, user_identifiers: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_identifiers) ? object.user_identifiers.map((e) => UserIdentifier.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if (message.gclid !== undefined) { obj.gclid = message.gclid; } if (message.gbraid !== undefined && message.gbraid !== "") { obj.gbraid = message.gbraid; } if (message.wbraid !== undefined && message.wbraid !== "") { obj.wbraid = message.wbraid; } if (message.conversion_action !== undefined) { obj.conversion_action = message.conversion_action; } if (message.conversion_date_time !== undefined) { obj.conversion_date_time = message.conversion_date_time; } if ((_a = message.user_identifiers) === null || _a === void 0 ? void 0 : _a.length) { obj.user_identifiers = message.user_identifiers.map((e) => UserIdentifier.toJSON(e)); } return obj; }, create(base) { return ClickConversionResult.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f; const message = createBaseClickConversionResult(); message.gclid = (_a = object.gclid) !== null && _a !== void 0 ? _a : undefined; message.gbraid = (_b = object.gbraid) !== null && _b !== void 0 ? _b : ""; message.wbraid = (_c = object.wbraid) !== null && _c !== void 0 ? _c : ""; message.conversion_action = (_d = object.conversion_action) !== null && _d !== void 0 ? _d : undefined; message.conversion_date_time = (_e = object.conversion_date_time) !== null && _e !== void 0 ? _e : undefined; message.user_identifiers = ((_f = object.user_identifiers) === null || _f === void 0 ? void 0 : _f.map((e) => UserIdentifier.fromPartial(e))) || []; return message; }, }; function createBaseCallConversionResult() { return { caller_id: undefined, call_start_date_time: undefined, conversion_action: undefined, conversion_date_time: undefined, }; } export const CallConversionResult = { encode(message, writer = _m0.Writer.create()) { if (message.caller_id !== undefined) { writ