UNPKG

@htdangkhoa/google-ads

Version:
1,028 lines (1,027 loc) 136 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/v21/services/audience_insights_service.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AudienceInsightsServiceClient = exports.AudienceInsightsServiceService = exports.AudienceCompositionAttribute = exports.AudienceCompositionMetrics = exports.AudienceCompositionAttributeCluster = exports.AudienceCompositionSection = exports.InsightsAudienceAttributeGroup = exports.InsightsAudience = exports.InsightsAudienceDescription = exports.InsightsAudienceDefinition = exports.BasicInsightsAudience = exports.GenerateTargetingSuggestionMetricsResponse = exports.GenerateTargetingSuggestionMetricsRequest = exports.AudienceOverlapItem = exports.DimensionOverlapResult = exports.GenerateAudienceOverlapInsightsResponse = exports.GenerateAudienceOverlapInsightsRequest = exports.ListInsightsEligibleDatesResponse = exports.ListInsightsEligibleDatesRequest = exports.ListAudienceInsightsAttributesResponse = exports.ListAudienceInsightsAttributesRequest = exports.TargetingSuggestionMetrics = exports.GenerateSuggestedTargetingInsightsResponse = exports.GenerateSuggestedTargetingInsightsRequest = exports.GenerateAudienceCompositionInsightsResponse = exports.GenerateAudienceCompositionInsightsRequest = exports.GenerateInsightsFinderReportResponse = exports.GenerateInsightsFinderReportRequest = void 0; /* 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 additional_application_info_js_1 = require("../common/additional_application_info.js"); const audience_insights_attribute_js_1 = require("../common/audience_insights_attribute.js"); const criteria_js_1 = require("../common/criteria.js"); const dates_js_1 = require("../common/dates.js"); const audience_insights_dimension_js_1 = require("../enums/audience_insights_dimension.js"); const audience_insights_marketing_objective_js_1 = require("../enums/audience_insights_marketing_objective.js"); function createBaseGenerateInsightsFinderReportRequest() { return { customer_id: "", baseline_audience: undefined, specific_audience: undefined, customer_insights_group: "", insights_application_info: undefined, }; } exports.GenerateInsightsFinderReportRequest = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.customer_id !== undefined && message.customer_id !== "") { writer.uint32(10).string(message.customer_id); } if (message.baseline_audience !== undefined) { exports.BasicInsightsAudience.encode(message.baseline_audience, writer.uint32(18).fork()).ldelim(); } if (message.specific_audience !== undefined) { exports.BasicInsightsAudience.encode(message.specific_audience, writer.uint32(26).fork()).ldelim(); } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { writer.uint32(34).string(message.customer_insights_group); } if (message.insights_application_info !== undefined) { additional_application_info_js_1.AdditionalApplicationInfo.encode(message.insights_application_info, writer.uint32(42).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 = createBaseGenerateInsightsFinderReportRequest(); 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.baseline_audience = exports.BasicInsightsAudience.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } message.specific_audience = exports.BasicInsightsAudience.decode(reader, reader.uint32()); continue; case 4: if (tag !== 34) { break; } message.customer_insights_group = reader.string(); continue; case 5: if (tag !== 42) { break; } message.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32()); 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) : "", baseline_audience: isSet(object.baseline_audience) ? exports.BasicInsightsAudience.fromJSON(object.baseline_audience) : undefined, specific_audience: isSet(object.specific_audience) ? exports.BasicInsightsAudience.fromJSON(object.specific_audience) : undefined, customer_insights_group: isSet(object.customer_insights_group) ? globalThis.String(object.customer_insights_group) : "", insights_application_info: isSet(object.insights_application_info) ? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.insights_application_info) : undefined, }; }, toJSON(message) { const obj = {}; if (message.customer_id !== undefined && message.customer_id !== "") { obj.customer_id = message.customer_id; } if (message.baseline_audience !== undefined) { obj.baseline_audience = exports.BasicInsightsAudience.toJSON(message.baseline_audience); } if (message.specific_audience !== undefined) { obj.specific_audience = exports.BasicInsightsAudience.toJSON(message.specific_audience); } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { obj.customer_insights_group = message.customer_insights_group; } if (message.insights_application_info !== undefined) { obj.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.insights_application_info); } return obj; }, create(base) { return exports.GenerateInsightsFinderReportRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseGenerateInsightsFinderReportRequest(); message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : ""; message.baseline_audience = (object.baseline_audience !== undefined && object.baseline_audience !== null) ? exports.BasicInsightsAudience.fromPartial(object.baseline_audience) : undefined; message.specific_audience = (object.specific_audience !== undefined && object.specific_audience !== null) ? exports.BasicInsightsAudience.fromPartial(object.specific_audience) : undefined; message.customer_insights_group = (_b = object.customer_insights_group) !== null && _b !== void 0 ? _b : ""; message.insights_application_info = (object.insights_application_info !== undefined && object.insights_application_info !== null) ? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.insights_application_info) : undefined; return message; }, }; function createBaseGenerateInsightsFinderReportResponse() { return { saved_report_url: "" }; } exports.GenerateInsightsFinderReportResponse = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.saved_report_url !== undefined && message.saved_report_url !== "") { writer.uint32(10).string(message.saved_report_url); } 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 = createBaseGenerateInsightsFinderReportResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.saved_report_url = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { saved_report_url: isSet(object.saved_report_url) ? globalThis.String(object.saved_report_url) : "" }; }, toJSON(message) { const obj = {}; if (message.saved_report_url !== undefined && message.saved_report_url !== "") { obj.saved_report_url = message.saved_report_url; } return obj; }, create(base) { return exports.GenerateInsightsFinderReportResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseGenerateInsightsFinderReportResponse(); message.saved_report_url = (_a = object.saved_report_url) !== null && _a !== void 0 ? _a : ""; return message; }, }; function createBaseGenerateAudienceCompositionInsightsRequest() { return { customer_id: "", audience: undefined, baseline_audience: undefined, data_month: "", dimensions: [], customer_insights_group: "", insights_application_info: undefined, }; } exports.GenerateAudienceCompositionInsightsRequest = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.customer_id !== undefined && message.customer_id !== "") { writer.uint32(10).string(message.customer_id); } if (message.audience !== undefined) { exports.InsightsAudience.encode(message.audience, writer.uint32(18).fork()).ldelim(); } if (message.baseline_audience !== undefined) { exports.InsightsAudience.encode(message.baseline_audience, writer.uint32(50).fork()).ldelim(); } if (message.data_month !== undefined && message.data_month !== "") { writer.uint32(26).string(message.data_month); } if (message.dimensions !== undefined && message.dimensions.length !== 0) { writer.uint32(34).fork(); for (const v of message.dimensions) { writer.int32(v); } writer.ldelim(); } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { writer.uint32(42).string(message.customer_insights_group); } if (message.insights_application_info !== undefined) { additional_application_info_js_1.AdditionalApplicationInfo.encode(message.insights_application_info, writer.uint32(58).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 = createBaseGenerateAudienceCompositionInsightsRequest(); 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.audience = exports.InsightsAudience.decode(reader, reader.uint32()); continue; case 6: if (tag !== 50) { break; } message.baseline_audience = exports.InsightsAudience.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } message.data_month = reader.string(); continue; case 4: if (tag === 32) { message.dimensions.push(reader.int32()); continue; } if (tag === 34) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.dimensions.push(reader.int32()); } continue; } break; case 5: if (tag !== 42) { break; } message.customer_insights_group = reader.string(); continue; case 7: if (tag !== 58) { break; } message.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32()); 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) : "", audience: isSet(object.audience) ? exports.InsightsAudience.fromJSON(object.audience) : undefined, baseline_audience: isSet(object.baseline_audience) ? exports.InsightsAudience.fromJSON(object.baseline_audience) : undefined, data_month: isSet(object.data_month) ? globalThis.String(object.data_month) : "", dimensions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.dimensions) ? object.dimensions.map((e) => (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionFromJSON)(e)) : [], customer_insights_group: isSet(object.customer_insights_group) ? globalThis.String(object.customer_insights_group) : "", insights_application_info: isSet(object.insights_application_info) ? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.insights_application_info) : undefined, }; }, toJSON(message) { var _a; const obj = {}; if (message.customer_id !== undefined && message.customer_id !== "") { obj.customer_id = message.customer_id; } if (message.audience !== undefined) { obj.audience = exports.InsightsAudience.toJSON(message.audience); } if (message.baseline_audience !== undefined) { obj.baseline_audience = exports.InsightsAudience.toJSON(message.baseline_audience); } if (message.data_month !== undefined && message.data_month !== "") { obj.data_month = message.data_month; } if ((_a = message.dimensions) === null || _a === void 0 ? void 0 : _a.length) { obj.dimensions = message.dimensions.map((e) => (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionToJSON)(e)); } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { obj.customer_insights_group = message.customer_insights_group; } if (message.insights_application_info !== undefined) { obj.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.insights_application_info); } return obj; }, create(base) { return exports.GenerateAudienceCompositionInsightsRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseGenerateAudienceCompositionInsightsRequest(); message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : ""; message.audience = (object.audience !== undefined && object.audience !== null) ? exports.InsightsAudience.fromPartial(object.audience) : undefined; message.baseline_audience = (object.baseline_audience !== undefined && object.baseline_audience !== null) ? exports.InsightsAudience.fromPartial(object.baseline_audience) : undefined; message.data_month = (_b = object.data_month) !== null && _b !== void 0 ? _b : ""; message.dimensions = ((_c = object.dimensions) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; message.customer_insights_group = (_d = object.customer_insights_group) !== null && _d !== void 0 ? _d : ""; message.insights_application_info = (object.insights_application_info !== undefined && object.insights_application_info !== null) ? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.insights_application_info) : undefined; return message; }, }; function createBaseGenerateAudienceCompositionInsightsResponse() { return { sections: [] }; } exports.GenerateAudienceCompositionInsightsResponse = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.sections !== undefined && message.sections.length !== 0) { for (const v of message.sections) { exports.AudienceCompositionSection.encode(v, 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 = createBaseGenerateAudienceCompositionInsightsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.sections.push(exports.AudienceCompositionSection.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { sections: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sections) ? object.sections.map((e) => exports.AudienceCompositionSection.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.sections) === null || _a === void 0 ? void 0 : _a.length) { obj.sections = message.sections.map((e) => exports.AudienceCompositionSection.toJSON(e)); } return obj; }, create(base) { return exports.GenerateAudienceCompositionInsightsResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseGenerateAudienceCompositionInsightsResponse(); message.sections = ((_a = object.sections) === null || _a === void 0 ? void 0 : _a.map((e) => exports.AudienceCompositionSection.fromPartial(e))) || []; return message; }, }; function createBaseGenerateSuggestedTargetingInsightsRequest() { return { customer_id: "", customer_insights_group: "", insights_application_info: undefined, audience_definition: undefined, audience_description: undefined, }; } exports.GenerateSuggestedTargetingInsightsRequest = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.customer_id !== undefined && message.customer_id !== "") { writer.uint32(10).string(message.customer_id); } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { writer.uint32(42).string(message.customer_insights_group); } if (message.insights_application_info !== undefined) { additional_application_info_js_1.AdditionalApplicationInfo.encode(message.insights_application_info, writer.uint32(66).fork()).ldelim(); } if (message.audience_definition !== undefined) { exports.InsightsAudienceDefinition.encode(message.audience_definition, writer.uint32(50).fork()).ldelim(); } if (message.audience_description !== undefined) { exports.InsightsAudienceDescription.encode(message.audience_description, writer.uint32(58).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 = createBaseGenerateSuggestedTargetingInsightsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.customer_id = reader.string(); continue; case 5: if (tag !== 42) { break; } message.customer_insights_group = reader.string(); continue; case 8: if (tag !== 66) { break; } message.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32()); continue; case 6: if (tag !== 50) { break; } message.audience_definition = exports.InsightsAudienceDefinition.decode(reader, reader.uint32()); continue; case 7: if (tag !== 58) { break; } message.audience_description = exports.InsightsAudienceDescription.decode(reader, reader.uint32()); 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) : "", customer_insights_group: isSet(object.customer_insights_group) ? globalThis.String(object.customer_insights_group) : "", insights_application_info: isSet(object.insights_application_info) ? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.insights_application_info) : undefined, audience_definition: isSet(object.audience_definition) ? exports.InsightsAudienceDefinition.fromJSON(object.audience_definition) : undefined, audience_description: isSet(object.audience_description) ? exports.InsightsAudienceDescription.fromJSON(object.audience_description) : undefined, }; }, toJSON(message) { const obj = {}; if (message.customer_id !== undefined && message.customer_id !== "") { obj.customer_id = message.customer_id; } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { obj.customer_insights_group = message.customer_insights_group; } if (message.insights_application_info !== undefined) { obj.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.insights_application_info); } if (message.audience_definition !== undefined) { obj.audience_definition = exports.InsightsAudienceDefinition.toJSON(message.audience_definition); } if (message.audience_description !== undefined) { obj.audience_description = exports.InsightsAudienceDescription.toJSON(message.audience_description); } return obj; }, create(base) { return exports.GenerateSuggestedTargetingInsightsRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseGenerateSuggestedTargetingInsightsRequest(); message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : ""; message.customer_insights_group = (_b = object.customer_insights_group) !== null && _b !== void 0 ? _b : ""; message.insights_application_info = (object.insights_application_info !== undefined && object.insights_application_info !== null) ? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.insights_application_info) : undefined; message.audience_definition = (object.audience_definition !== undefined && object.audience_definition !== null) ? exports.InsightsAudienceDefinition.fromPartial(object.audience_definition) : undefined; message.audience_description = (object.audience_description !== undefined && object.audience_description !== null) ? exports.InsightsAudienceDescription.fromPartial(object.audience_description) : undefined; return message; }, }; function createBaseGenerateSuggestedTargetingInsightsResponse() { return { suggestions: [] }; } exports.GenerateSuggestedTargetingInsightsResponse = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.suggestions !== undefined && message.suggestions.length !== 0) { for (const v of message.suggestions) { exports.TargetingSuggestionMetrics.encode(v, 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 = createBaseGenerateSuggestedTargetingInsightsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.suggestions.push(exports.TargetingSuggestionMetrics.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { suggestions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.suggestions) ? object.suggestions.map((e) => exports.TargetingSuggestionMetrics.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.suggestions) === null || _a === void 0 ? void 0 : _a.length) { obj.suggestions = message.suggestions.map((e) => exports.TargetingSuggestionMetrics.toJSON(e)); } return obj; }, create(base) { return exports.GenerateSuggestedTargetingInsightsResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseGenerateSuggestedTargetingInsightsResponse(); message.suggestions = ((_a = object.suggestions) === null || _a === void 0 ? void 0 : _a.map((e) => exports.TargetingSuggestionMetrics.fromPartial(e))) || []; return message; }, }; function createBaseTargetingSuggestionMetrics() { return { locations: [], age_ranges: [], gender: undefined, parental_status: undefined, user_interests: [], coverage: 0, index: 0, potential_youtube_reach: "0", }; } exports.TargetingSuggestionMetrics = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.locations !== undefined && message.locations.length !== 0) { for (const v of message.locations) { audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.encode(v, writer.uint32(74).fork()).ldelim(); } } if (message.age_ranges !== undefined && message.age_ranges.length !== 0) { for (const v of message.age_ranges) { criteria_js_1.AgeRangeInfo.encode(v, writer.uint32(18).fork()).ldelim(); } } if (message.gender !== undefined) { criteria_js_1.GenderInfo.encode(message.gender, writer.uint32(26).fork()).ldelim(); } if (message.parental_status !== undefined) { criteria_js_1.ParentalStatusInfo.encode(message.parental_status, writer.uint32(66).fork()).ldelim(); } if (message.user_interests !== undefined && message.user_interests.length !== 0) { for (const v of message.user_interests) { audience_insights_attribute_js_1.AudienceInsightsAttributeMetadataGroup.encode(v, writer.uint32(90).fork()).ldelim(); } } if (message.coverage !== undefined && message.coverage !== 0) { writer.uint32(41).double(message.coverage); } if (message.index !== undefined && message.index !== 0) { writer.uint32(49).double(message.index); } if (message.potential_youtube_reach !== undefined && message.potential_youtube_reach !== "0") { writer.uint32(56).int64(message.potential_youtube_reach); } 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 = createBaseTargetingSuggestionMetrics(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 9: if (tag !== 74) { break; } message.locations.push(audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.decode(reader, reader.uint32())); continue; case 2: if (tag !== 18) { break; } message.age_ranges.push(criteria_js_1.AgeRangeInfo.decode(reader, reader.uint32())); continue; case 3: if (tag !== 26) { break; } message.gender = criteria_js_1.GenderInfo.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { break; } message.parental_status = criteria_js_1.ParentalStatusInfo.decode(reader, reader.uint32()); continue; case 11: if (tag !== 90) { break; } message.user_interests.push(audience_insights_attribute_js_1.AudienceInsightsAttributeMetadataGroup.decode(reader, reader.uint32())); continue; case 5: if (tag !== 41) { break; } message.coverage = reader.double(); continue; case 6: if (tag !== 49) { break; } message.index = reader.double(); continue; case 7: if (tag !== 56) { break; } message.potential_youtube_reach = longToString(reader.int64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.locations) ? object.locations.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromJSON(e)) : [], age_ranges: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.age_ranges) ? object.age_ranges.map((e) => criteria_js_1.AgeRangeInfo.fromJSON(e)) : [], gender: isSet(object.gender) ? criteria_js_1.GenderInfo.fromJSON(object.gender) : undefined, parental_status: isSet(object.parental_status) ? criteria_js_1.ParentalStatusInfo.fromJSON(object.parental_status) : undefined, user_interests: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_interests) ? object.user_interests.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadataGroup.fromJSON(e)) : [], coverage: isSet(object.coverage) ? globalThis.Number(object.coverage) : 0, index: isSet(object.index) ? globalThis.Number(object.index) : 0, potential_youtube_reach: isSet(object.potential_youtube_reach) ? globalThis.String(object.potential_youtube_reach) : "0", }; }, toJSON(message) { var _a, _b, _c; const obj = {}; if ((_a = message.locations) === null || _a === void 0 ? void 0 : _a.length) { obj.locations = message.locations.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.toJSON(e)); } if ((_b = message.age_ranges) === null || _b === void 0 ? void 0 : _b.length) { obj.age_ranges = message.age_ranges.map((e) => criteria_js_1.AgeRangeInfo.toJSON(e)); } if (message.gender !== undefined) { obj.gender = criteria_js_1.GenderInfo.toJSON(message.gender); } if (message.parental_status !== undefined) { obj.parental_status = criteria_js_1.ParentalStatusInfo.toJSON(message.parental_status); } if ((_c = message.user_interests) === null || _c === void 0 ? void 0 : _c.length) { obj.user_interests = message.user_interests.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadataGroup.toJSON(e)); } if (message.coverage !== undefined && message.coverage !== 0) { obj.coverage = message.coverage; } if (message.index !== undefined && message.index !== 0) { obj.index = message.index; } if (message.potential_youtube_reach !== undefined && message.potential_youtube_reach !== "0") { obj.potential_youtube_reach = message.potential_youtube_reach; } return obj; }, create(base) { return exports.TargetingSuggestionMetrics.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f; const message = createBaseTargetingSuggestionMetrics(); message.locations = ((_a = object.locations) === null || _a === void 0 ? void 0 : _a.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromPartial(e))) || []; message.age_ranges = ((_b = object.age_ranges) === null || _b === void 0 ? void 0 : _b.map((e) => criteria_js_1.AgeRangeInfo.fromPartial(e))) || []; message.gender = (object.gender !== undefined && object.gender !== null) ? criteria_js_1.GenderInfo.fromPartial(object.gender) : undefined; message.parental_status = (object.parental_status !== undefined && object.parental_status !== null) ? criteria_js_1.ParentalStatusInfo.fromPartial(object.parental_status) : undefined; message.user_interests = ((_c = object.user_interests) === null || _c === void 0 ? void 0 : _c.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadataGroup.fromPartial(e))) || []; message.coverage = (_d = object.coverage) !== null && _d !== void 0 ? _d : 0; message.index = (_e = object.index) !== null && _e !== void 0 ? _e : 0; message.potential_youtube_reach = (_f = object.potential_youtube_reach) !== null && _f !== void 0 ? _f : "0"; return message; }, }; function createBaseListAudienceInsightsAttributesRequest() { return { customer_id: "", dimensions: [], query_text: "", customer_insights_group: "", insights_application_info: undefined, location_country_filters: [], youtube_reach_location: undefined, }; } exports.ListAudienceInsightsAttributesRequest = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.customer_id !== undefined && message.customer_id !== "") { writer.uint32(10).string(message.customer_id); } if (message.dimensions !== undefined && message.dimensions.length !== 0) { writer.uint32(18).fork(); for (const v of message.dimensions) { writer.int32(v); } writer.ldelim(); } if (message.query_text !== undefined && message.query_text !== "") { writer.uint32(26).string(message.query_text); } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { writer.uint32(34).string(message.customer_insights_group); } if (message.insights_application_info !== undefined) { additional_application_info_js_1.AdditionalApplicationInfo.encode(message.insights_application_info, writer.uint32(58).fork()).ldelim(); } if (message.location_country_filters !== undefined && message.location_country_filters.length !== 0) { for (const v of message.location_country_filters) { criteria_js_1.LocationInfo.encode(v, writer.uint32(42).fork()).ldelim(); } } if (message.youtube_reach_location !== undefined) { criteria_js_1.LocationInfo.encode(message.youtube_reach_location, writer.uint32(50).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 = createBaseListAudienceInsightsAttributesRequest(); 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 === 16) { message.dimensions.push(reader.int32()); continue; } if (tag === 18) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.dimensions.push(reader.int32()); } continue; } break; case 3: if (tag !== 26) { break; } message.query_text = reader.string(); continue; case 4: if (tag !== 34) { break; } message.customer_insights_group = reader.string(); continue; case 7: if (tag !== 58) { break; } message.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.decode(reader, reader.uint32()); continue; case 5: if (tag !== 42) { break; } message.location_country_filters.push(criteria_js_1.LocationInfo.decode(reader, reader.uint32())); continue; case 6: if (tag !== 50) { break; } message.youtube_reach_location = criteria_js_1.LocationInfo.decode(reader, reader.uint32()); 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) : "", dimensions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.dimensions) ? object.dimensions.map((e) => (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionFromJSON)(e)) : [], query_text: isSet(object.query_text) ? globalThis.String(object.query_text) : "", customer_insights_group: isSet(object.customer_insights_group) ? globalThis.String(object.customer_insights_group) : "", insights_application_info: isSet(object.insights_application_info) ? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.insights_application_info) : undefined, location_country_filters: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.location_country_filters) ? object.location_country_filters.map((e) => criteria_js_1.LocationInfo.fromJSON(e)) : [], youtube_reach_location: isSet(object.youtube_reach_location) ? criteria_js_1.LocationInfo.fromJSON(object.youtube_reach_location) : undefined, }; }, toJSON(message) { var _a, _b; const obj = {}; if (message.customer_id !== undefined && message.customer_id !== "") { obj.customer_id = message.customer_id; } if ((_a = message.dimensions) === null || _a === void 0 ? void 0 : _a.length) { obj.dimensions = message.dimensions.map((e) => (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionToJSON)(e)); } if (message.query_text !== undefined && message.query_text !== "") { obj.query_text = message.query_text; } if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") { obj.customer_insights_group = message.customer_insights_group; } if (message.insights_application_info !== undefined) { obj.insights_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.insights_application_info); } if ((_b = message.location_country_filters) === null || _b === void 0 ? void 0 : _b.length) { obj.location_country_filters = message.location_country_filters.map((e) => criteria_js_1.LocationInfo.toJSON(e)); } if (message.youtube_reach_location !== undefined) { obj.youtube_reach_location = criteria_js_1.LocationInfo.toJSON(message.youtube_reach_location); } return obj; }, create(base) { return exports.ListAudienceInsightsAttributesRequest.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseListAudienceInsightsAttributesRequest(); message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : ""; message.dimensions = ((_b = object.dimensions) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; message.query_text = (_c = object.query_text) !== null && _c !== void 0 ? _c : ""; message.customer_insights_group = (_d = object.customer_insights_group) !== null && _d !== void 0 ? _d : ""; message.insights_application_info = (object.insights_application_info !== undefined && object.insights_application_info !== null) ? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.insights_application_info) : undefined; message.location_country_filters = ((_e = object.location_country_filters) === null || _e === void 0 ? void 0 : _e.map((e) => criteria_js_1.LocationInfo.fromPartial(e))) || []; message.youtube_reach_location = (object.youtube_reach_location !== undefined && object.youtube_reach_location !== null) ? criteria_js_1.LocationInfo.fromPartial(object.youtube_reach_location) : undefined; return message; }, }; function createBaseListAudienceInsightsAttributesResponse() { return { attributes: [] }; } exports.ListAudienceInsightsAttributesResponse = { encode(message, writer = minimal_js_1.default.Writer.create()) { if (message.attributes !== undefined && message.attributes.length !== 0) { for (const v of message.attributes) { audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.encode(v, 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 = createBaseListAudienceInsightsAttributesResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 2: if (tag !== 18) { break; } message.attributes.push(audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { attributes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.attributes) ? object.attributes.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.attributes) === null || _a === void 0 ? void 0 : _a.length) { obj.attributes = message.attributes.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.toJSON(e)); } return obj; }, create(base) { return exports.ListAudienceInsightsAttributesResponse.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) {