@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
2,817 lines • 135 kB
JavaScript
"use strict";
// Code generated by protoc-gen-ts_proto. DO NOT EDIT.
// versions:
// protoc-gen-ts_proto v1.181.2
// protoc v3.21.12
// source: google/ads/googleads/v20/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.AudienceInsightsAttributeMetadata.encode(v, writer.uint32(82).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 10:
if (tag !== 82) {
break;
}
message.user_interests.push(audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.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.AudienceInsightsAttributeMetadata.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.AudienceInsightsAttributeMetadata.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.AudienceInsightsAttributeMetadata.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) {
var _a;
const message = createBaseListAudienceInsightsAttributesResponse();
message.attributes = ((_a = object.attributes) === null || _a === void 0 ? void 0 : _a.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromPartial(e))) || [];
return message;
},
};
function createBaseListInsightsEligibleDatesRequest() {
return { insights_application_info: undefined };
}
exports.ListInsightsEligibleDatesRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.insights_application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.insights_application_info, 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 = createBaseListInsightsEligibleDatesRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
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 {
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.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.ListInsightsEligibleDatesRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseListInsightsEligibleDatesRequest();
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 createBaseListInsightsEligibleDatesResponse() {
return { data_months: [], last_thirty_days: undefined };
}
exports.ListInsightsEligibleDatesResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.data_months !== undefined && message.data_months.length !== 0) {
for (const v of message.data_months) {
writer.uint32(10).string(v);
}
}
if (message.last_thirty_days !== undefined) {
dates_js_1.DateRange.encode(message.last_thirty_days, 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 = createBaseListInsightsEligibleDatesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.data_months.push(reader.string());
continue;
case 2:
if (tag !== 18) {
break;
}
message.last_thirty_days = dates_js_1.DateRange.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
data_months: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.data_months)
? object.data_months.map((e) => globalThis.String(e))
: [],
last_thirty_days: isSet(object.last_thirty_days) ? dates_js_1.DateRange.fromJSON(object.last_thirty_days) : undefined,
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.data_months) === null || _a === void 0 ? void 0 : _a.length) {
obj.data_months = message.data_months;
}
if (message.last_thirty_days !== undefined) {
obj.last_thirty_days = dates_js_1.DateRange.toJSON(message.last_thirty_days);
}
return obj;
},
create(base) {
return exports.ListInsightsEligibleDatesResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListInsightsEligibleDatesResponse();
message.data_months = ((_a = object.data_months) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
message.last_thirty_days = (object.last_thirty_days !== undefined && object.last_thirty_days !== null)
? dates_js_1.DateRange.fromPartial(object.last_thirty_days)
: undefined;
return message;
},
};
function createBaseGenerateAudienceOverlapInsightsRequest() {
return {
customer_id: "",
country_location: undefined,
primary_attribute: undefined,
dimensions: [],
customer_insights_group: "",
insights_application_info: undefined,
};
}
exports.GenerateAudienceOverlapInsightsRequest = {
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.country_location !== undefined) {
criteria_js_1.LocationInfo.encode(message.country_location, writer.uint32(18).fork()).ldelim();
}
if (message.primary_attribute !== undefined) {
audience_insights_attribute_js_1.AudienceInsightsAttribute.encode(message.primary_attribute, writer.uint32(50).fork()).ldelim();
}
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 = createBaseGenerateAudienceOverlapInsightsRequest();
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.country_location = criteria_js_1.LocationInfo.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
message.primary_attribute = audience_insights_attribute_js_1.AudienceInsightsAttribute.decode(reader, reader.uint32());
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) : "",
country_location: isSet(object.country_location) ? criteria_js_1.LocationInfo.fromJSON(object.country_location) : undefined,
primary_attribute: isSet(object.primary_attribute)
? audience_insights_attribute_js_1.AudienceInsightsAttribute.fromJSON(object.primary_attribute)
: undefined,
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.country_location !== undefined) {
obj.country_location = criteria_js_1.LocationInfo.toJSON(message.country_location);
}
if (message.primary_attribute !== undefined) {
obj.primary_attribute = audience_insights_attribute_js_1.AudienceInsightsAttribute.toJSON(message.primary_attribute);
}
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.GenerateAudienceOverlapInsightsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseGenerateAudienceOverlapInsightsRequest();
message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : "";
message.country_location = (object.country_location !== undefined && object.country_location !== null)
? criteria_js_1.LocationInfo.fromPartial(object.country_location)
: undefined;
message.primary_attribute = (object.primary_attribute !== undefined && object.primary_attribute !== null)
? audience_insights_attribute_js_1.AudienceInsightsAttribute.fromPartial(object.primary_attribute)
: undefined;
message.dimensions = ((_b = object.dimensions) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || [];
message.customer_insights_group = (_c = object.customer_insights_group) !== null && _c !== void 0 ? _c : "";
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 createBaseGenerateAudienceOverlapInsightsResponse() {
return { primary_attribute_metadata: undefined, dimension_results: [] };
}
exports.GenerateAudienceOverlapInsightsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.primary_attribute_metadata !== undefined) {
audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.encode(message.primary_attribute_metadata, writer.uint32(26).fork()).ldelim();
}
if (message.dimension_results !== undefined && message.dimension_results.length !== 0) {
for (const v of message.dimension_results) {
exports.DimensionOverlapResult.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 = createBaseGenerateAudienceOverlapInsightsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.primary_attribute_metadata = audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.dimension_results.push(exports.DimensionOverlapResult.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
primary_attribute_metadata: isSet(object.primary_attribute_metadata)
? audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromJSON(object.primary_attribute_metadata)
: undefined,
dimension_results: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.dimension_results)
? object.dimension_results.map((e) => exports.DimensionOverlapResult.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.primary_attribute_metadata !== undefined) {
obj.primary_attribute_metadata = audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.toJSON(message.primary_attribute_metadata);
}
if ((_a = message.dimension_results) === null || _a === void 0 ? void 0 : _a.length) {
obj.dimension_results = message.dimension_results.map((e) => exports.DimensionOverlapResult.toJSON(e));
}
return obj;
},
create(base) {
return exports.GenerateAudienceOverlapInsightsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseGenerateAudienceOverlapInsightsResponse();
message.primary_attribute_metadata =
(object.primary_attribute_metadata !== undefined && object.primary_attribute_metadata !== null)
? audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromPartial(object.primary_attribute_metadata)
: undefined;
message.dimension_results = ((_a = object.dimension_results) === null || _a === void 0 ? void 0 : _a.map((e) => exports.DimensionOverlapResult.fromPartial(e))) || [];
return message;
},
};
function createBaseDimensionOverlapResult() {
return { dimension: 0, items: [] };
}
exports.DimensionOverlapResult = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.dimension !== undefined && message.dimension !== 0) {
writer.uint32(8).int32(message.dimension);
}
if (message.items !== undefined && message.items.length !== 0) {
for (const v of message.items) {
exports.AudienceOverlapItem.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 = createBaseDimensionOverlapResult();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.dimension = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.items.push(exports.AudienceOverlapItem.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
dimension: isSet(object.dimension)
? (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionFromJSON)(object.dimension)
: 0,
items: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.items)
? object.items.map((e) => exports.AudienceOverlapItem.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.dimension !== undefined && message.dimension !== 0) {
obj.dimension = (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionToJSON)(message.dimension);
}
if ((_a = message.items) === null || _a === void 0 ? void 0 : _a.length) {
obj.items = message.items.map((e) => exports.AudienceOverlapItem.toJSON(e));
}
return obj;
},
create(base) {
return exports.DimensionOverlapResult.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseDimensionOverlapResult();
message.dimension = (_a = object.dimension) !== null && _a !== void 0 ? _a : 0;
message.items = ((_b = object.items) === null || _b === void 0 ? void 0 : _b.map((e) => exports.AudienceOverlapItem.fromPartial(e))) || [];
return message;
},
};
function createBaseAudienceOverlapItem() {
return { attribute_metadata: undefined, potential_youtube_reach_intersection: "0" };
}
exports.AudienceOverlapItem = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.attribute_metadata !== undefined) {
audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.encode(message.attribute_metadata, writer.uint32(26).fork()).ldelim();
}
if (message.potential_youtube_reach_intersection !== undefined && message.potential_youtube_reach_intersection !== "0") {
writer.uint32(16).int64(message.potential_youtube_reach_intersection);
}
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 = createBaseAudienceOverlapItem();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.attribute_metadata = audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.potential_youtube_reach_intersection = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
attribute_metadata: isSet(object.attribute_metadata)
? audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromJSON(object.attribute_metadata)
: undefined,
potential_youtube_reach_intersection: isSet(object.potential_youtube_reach_intersection)
? globalThis.String(object.potential_youtube_reach_intersection)
: "0",
};
},
toJSON(message) {
const obj = {};
if (message.attribute_metadata !== undefined) {
obj.attribute_metadata = audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.toJSON(message.attribute_metadata);
}
if (message.potential_youtube_reach_intersection !== undefined && message.potential_youtube_reach_intersection !== "0") {
obj.potential_youtube_reach_intersection = message.potential_youtube_reach_intersection;
}
return obj;
},
create(base) {
return exports.AudienceOverlapItem.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseAudienceOverlapItem();
message.attribute_metadata = (object.attribute_metadata !== undefined && object.attribute_metadata !== null)
? audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromPartial(object.attribute_metadata)
: undefined;
message.potential_youtube_reach_intersection = (_a = object.potential_youtube_reach_intersection) !== null && _a !== void 0 ? _a : "0";
return message;
},
};
function createBaseGenerateTargetingSuggestionMetricsRequest() {
return { customer_id: "", audiences: [], customer_insights_group: "", insights_application_info: undefined };
}
exports.GenerateTargetingSuggestionMetricsRequest = {
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.audiences !== undefined && message.audiences.length !== 0) {
for (const v of message.audiences) {
exports.BasicInsightsAudience.encode(v, writer.uint32(18).fork()).ldelim();
}
}
if (message.customer_insights_group !== undefined && message.customer_insights_group !== "") {
writer.uint32(26).string(message.customer_insights_group);
}
if (message.insights_application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.insights_application_info, writer.uint32(34).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 = createBaseGenerateTargetingSuggestionMetricsRequest();
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.audiences.push(exports.BasicInsightsAudience.decode(reader, reader.uint32()));
continue;
case 3:
if (tag !== 26) {
break;
}
message.customer_insights_group = reader.string();
continue;
case 4:
if (tag !== 34) {
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) : "",
audiences: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.audiences)
? object.audiences.map((e) => exports.BasicInsightsAudience.fromJSON(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 ((_a = message.audiences) === null || _a === void 0 ? void 0 : _a.length) {
obj.audiences = message.audiences.map((e) => exports.BasicInsightsAudience.toJSON(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.GenerateTargetingSuggestionMetricsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseGenerateTargetingSuggestionMetricsRequest();
message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : "";
message.audiences = ((_b = object.audiences) === null || _b === void 0 ? void 0 : _b.map((e) => exports.BasicInsightsAudience.fromPartial(e))) || [];
message.customer_insights_group = (_c = object.customer_insights_group) !== null && _c !== void 0 ? _c : "";
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 createBaseGenerateTargetingSuggestionMetricsResponse() {
return { suggestions: [] };
}
exports.GenerateTargetingSuggestionMetricsResponse = {
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 = createBaseGenerateTargetingSuggestionMetricsResponse();
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.GenerateTargetingSuggestionMetricsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseGenerateTargetingSuggestionMetricsResponse();
message.suggestions = ((_a = object.suggestions) === null || _a === void 0 ? void 0 : _a.map((e) => exports.TargetingSuggestionMetrics.fromPartial(e))) || [];
return message;
},
};
function createBaseBasicInsightsAudience() {
return {
country_location: [],
sub_country_locations: [],
gender: undefined,
age_ranges: [],
user_interests: [],
topics: [],
};
}
exports.BasicInsightsAudience = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.country_location !== undefined && message.country_location.length !== 0) {
for (const v of message.country_location) {
criteria_js_1.LocationInfo.encode(v, writer.uint32(10).fork()).ldelim();
}
}
if (message.sub_country_locations !== undefined && message.sub_country_locations.length !== 0) {
for (const v of message.sub_country_locations) {
criteria_js_1.LocationInfo.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.age_ranges !== undefined && message.age_ranges.length !== 0) {
for (const v of message.age_ranges) {
criteria_js_1.AgeRangeInfo.encode(v, writer.uint32(34).fork()).ldelim();
}
}
if (message.user_interests !== undefined && message.user_interests.length !== 0) {
for (const v of message.user_interests) {
criteria_js_1.UserInterestInfo.encode(v, writer.uint32(42).fork()).ldelim();
}
}
if (message.topics !== undefined && message.topics.length !== 0) {
for (const v of message.topics) {
audience_insights_attribute_js_1.AudienceInsightsTopic.encode(v, 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 = createBaseBasicInsightsAudience();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.country_location.push(criteria_js_1.LocationInfo.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 18) {
break;
}
message.sub_country_locations.push(criteria_js_1.LocationInfo.decode(reader, reader.uint32()));
continue;
case 3:
if (tag !== 26) {
break;
}
message.gender = criteria_js_1.GenderInfo.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.age_ranges.push(criteria_js_1.AgeRangeInfo.decode(reader, reader.uint32()));
continue;
case 5:
if (tag !== 42) {
break;
}
message.user_interests.push(criteria_js_1.UserInterestInfo.decode(reader, reader.uint32()));
continue;
case 7:
if (tag !== 58) {
break;
}
message.topics.push(audience_insights_attribute_js_1.AudienceInsightsTopic.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
country_location: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.country_location)
? object.country_location.map((e) => criteria_js_1.LocationInfo.fromJSON(e))
: [],
sub_country_locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sub_country_locations)
? object.sub_country_locations.map((e) => criteria_js_1.LocationInfo.fromJSON(e))
: [],
gender: isSet(object.gender) ? criteria_js_1.GenderInfo.fromJSON(object.gender) : undefined,
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))
: [],
user_interests: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_interests)
? object.user_interests.map((e) => criteria_js_1.UserInterestInfo.fromJSON(e))
: [],
topics: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.topics)
? object.topics.map((e) => audience_insights_attribute_js_1.AudienceInsightsTopic.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a, _b, _c, _d, _e;
const obj = {};
if ((_a = message.country_location) === null || _a === void 0 ? void 0 : _a.length) {
obj.country_location = message.country_location.map((e) => criteria_js_1.LocationInfo.toJSON(e));
}
if ((_b = message.sub_country_locations) === null || _b === void 0 ? void 0 : _b.length) {
obj.sub_country_locations = message.sub_country_locations.map((e) => criteria_js_1.LocationInfo.toJSON(e));
}
if (message.gender !== undefined) {
obj.gender = criteria_js_1.GenderInfo.toJSON(message.gender);
}
if ((_c = message.age_ranges) === null || _c === void 0 ? void 0 : _c.length) {
obj.age_ranges = message.age_ranges.map((e) => criteria_js_1.AgeRangeInfo.toJSON(e));
}
if ((_d = message.user_interests) === null || _d === void 0 ? void 0 : _d.length) {
obj.user_interests = message.user_interests.map((e) => criteria_js_1.UserInterestInfo.toJSON(e));
}
if ((_e = message.topics) === null || _e === void 0 ? void 0 : _e.length) {
obj.topics = message.topics.map((e) => audience_insights_attribute_js_1.AudienceInsightsTopic.toJSON(e));
}
return obj;
},
create(base) {
return exports.BasicInsightsAudience.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBaseBasicInsightsAudience();
message.country_location = ((_a = object.country_location) === null || _a === void 0 ? void 0 : _a.map((e) => criteria_js_1.LocationInfo.fromPartial(e))) || [];
message.sub_country_locations = ((_b = object.sub_country_locations) === null || _b === void 0 ? void 0 : _b.map((e) => criteria_js_1.LocationInfo.fromPartial(e))) || [];
message.gender = (object.gender !== undefined && object.gender !== null)
? criteria_js_1.GenderInfo.fromPartial(object.gender)
: undefined;
message.age_ranges = ((_c = object.age_ranges) === null || _c === void 0 ? void 0 : _c.map((e) => criteria_js_1.AgeRangeInfo.fromPartial(e))) || [];
message.user_interests = ((_d = object.user_interests) === null || _d === void 0 ? void 0 : _d.map((e) => criteria_js_1.UserInterestInfo.fromPartial(e))) || [];
message.topics = ((_e = object.topics) === null || _e === void 0 ? void 0 : _e.map((e) => audience_insights_attribute_js_1.AudienceInsightsTopic.fromPartial(e))) || [];
return message;
},
};
function createBaseInsightsAudienceDefinition() {
return { audience: undefined, baseline_audience: undefined, data_month: "" };
}
exports.InsightsAudienceDefinition = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.audience !== undefined) {
exports.InsightsAudience.encode(message.audience, writer.uint32(10).fork()).ldelim();
}
if (message.baseline_audience !== undefined) {
exports.InsightsAudience.encode(message.baseline_audience, writer.uint32(18).fork()).ldelim();
}
if (message.data_month !== undefined && message.data_month !== "") {
writer.uint32(26).string(message.data_month);
}
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 = createBaseInsightsAudienceDefinition();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.audience = exports.InsightsAudience.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.baseline_audience = exports.InsightsAudience.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.data_month = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
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) : "",
};
},
toJSON(message) {
const obj = {};
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;
}
return obj;
},
create(base) {
return exports.InsightsAudienceDefinition.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseInsightsAudienceDefinition();
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 = (_a = object.data_month) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseInsightsAudienceDescription() {
return { country_locations: [], audience_description: "", marketing_objective: 0 };
}
exports.InsightsAudienceDescription = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.country_locations !== undefined && message.country_locations.length !== 0) {
for (const v of message.country_locations) {
criteria_js_1.LocationInfo.encode(v, writer.uint32(10).fork()).ldelim();
}
}
if (message.audience_description !== undefined && message.audience_description !== "") {
writer.uint32(18).string(message.audience_description);
}
if (message.marketing_objective !== undefined && message.marketing_objective !== 0) {
writer.uint32(24).int32(message.marketing_objective);
}
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 = createBaseInsightsAudienceDescription();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.country_locations.push(criteria_js_1.LocationInfo.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 18) {
break;
}
message.audience_description = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.marketing_objective = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
country_locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.country_locations)
? object.country_locations.map((e) => criteria_js_1.LocationInfo.fromJSON(e))
: [],
audience_description: isSet(object.audience_description) ? globalThis.String(object.audience_description) : "",
marketing_objective: isSet(object.marketing_objective)
? (0, audience_insights_marketing_objective_js_1.audienceInsightsMarketingObjectiveEnum_AudienceInsightsMarketingObjectiveFromJSON)(object.marketing_objective)
: 0,
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.country_locations) === null || _a === void 0 ? void 0 : _a.length) {
obj.country_locations = message.country_locations.map((e) => criteria_js_1.LocationInfo.toJSON(e));
}
if (message.audience_description !== undefined && message.audience_description !== "") {
obj.audience_description = message.audience_description;
}
if (message.marketing_objective !== undefined && message.marketing_objective !== 0) {
obj.marketing_objective = (0, audience_insights_marketing_objective_js_1.audienceInsightsMarketingObjectiveEnum_AudienceInsightsMarketingObjectiveToJSON)(message.marketing_objective);
}
return obj;
},
create(base) {
return exports.InsightsAudienceDescription.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseInsightsAudienceDescription();
message.country_locations = ((_a = object.country_locations) === null || _a === void 0 ? void 0 : _a.map((e) => criteria_js_1.LocationInfo.fromPartial(e))) || [];
message.audience_description = (_b = object.audience_description) !== null && _b !== void 0 ? _b : "";
message.marketing_objective = (_c = object.marketing_objective) !== null && _c !== void 0 ? _c : 0;
return message;
},
};
function createBaseInsightsAudience() {
return {
country_locations: [],
sub_country_locations: [],
gender: undefined,
age_ranges: [],
parental_status: undefined,
income_ranges: [],
lineups: [],
topic_audience_combinations: [],
};
}
exports.InsightsAudience = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.country_locations !== undefined && message.country_locations.length !== 0) {
for (const v of message.country_locations) {
criteria_js_1.LocationInfo.encode(v, writer.uint32(10).fork()).ldelim();
}
}
if (message.sub_country_locations !== undefined && message.sub_country_locations.length !== 0) {
for (const v of message.sub_country_locations) {
criteria_js_1.LocationInfo.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.age_ranges !== undefined && message.age_ranges.length !== 0) {
for (const v of message.age_ranges) {
criteria_js_1.AgeRangeInfo.encode(v, writer.uint32(34).fork()).ldelim();
}
}
if (message.parental_status !== undefined) {
criteria_js_1.ParentalStatusInfo.encode(message.parental_status, writer.uint32(42).fork()).ldelim();
}
if (message.income_ranges !== undefined && message.income_ranges.length !== 0) {
for (const v of message.income_ranges) {
criteria_js_1.IncomeRangeInfo.encode(v, writer.uint32(50).fork()).ldelim();
}
}
if (message.lineups !== undefined && message.lineups.length !== 0) {
for (const v of message.lineups) {
audience_insights_attribute_js_1.AudienceInsightsLineup.encode(v, writer.uint32(82).fork()).ldelim();
}
}
if (message.topic_audience_combinations !== undefined && message.topic_audience_combinations.length !== 0) {
for (const v of message.topic_audience_combinations) {
exports.InsightsAudienceAttributeGroup.encode(v, writer.uint32(66).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 = createBaseInsightsAudience();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.country_locations.push(criteria_js_1.LocationInfo.decode(reader, reader.uint32()));
continue;
case 2:
if (tag !== 18) {
break;
}
message.sub_country_locations.push(criteria_js_1.LocationInfo.decode(reader, reader.uint32()));
continue;
case 3:
if (tag !== 26) {
break;
}
message.gender = criteria_js_1.GenderInfo.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.age_ranges.push(criteria_js_1.AgeRangeInfo.decode(reader, reader.uint32()));
continue;
case 5:
if (tag !== 42) {
break;
}
message.parental_status = criteria_js_1.ParentalStatusInfo.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
message.income_ranges.push(criteria_js_1.IncomeRangeInfo.decode(reader, reader.uint32()));
continue;
case 10:
if (tag !== 82) {
break;
}
message.lineups.push(audience_insights_attribute_js_1.AudienceInsightsLineup.decode(reader, reader.uint32()));
continue;
case 8:
if (tag !== 66) {
break;
}
message.topic_audience_combinations.push(exports.InsightsAudienceAttributeGroup.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
country_locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.country_locations)
? object.country_locations.map((e) => criteria_js_1.LocationInfo.fromJSON(e))
: [],
sub_country_locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sub_country_locations)
? object.sub_country_locations.map((e) => criteria_js_1.LocationInfo.fromJSON(e))
: [],
gender: isSet(object.gender) ? criteria_js_1.GenderInfo.fromJSON(object.gender) : undefined,
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))
: [],
parental_status: isSet(object.parental_status) ? criteria_js_1.ParentalStatusInfo.fromJSON(object.parental_status) : undefined,
income_ranges: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.income_ranges)
? object.income_ranges.map((e) => criteria_js_1.IncomeRangeInfo.fromJSON(e))
: [],
lineups: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.lineups)
? object.lineups.map((e) => audience_insights_attribute_js_1.AudienceInsightsLineup.fromJSON(e))
: [],
topic_audience_combinations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.topic_audience_combinations)
? object.topic_audience_combinations.map((e) => exports.InsightsAudienceAttributeGroup.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a, _b, _c, _d, _e, _f;
const obj = {};
if ((_a = message.country_locations) === null || _a === void 0 ? void 0 : _a.length) {
obj.country_locations = message.country_locations.map((e) => criteria_js_1.LocationInfo.toJSON(e));
}
if ((_b = message.sub_country_locations) === null || _b === void 0 ? void 0 : _b.length) {
obj.sub_country_locations = message.sub_country_locations.map((e) => criteria_js_1.LocationInfo.toJSON(e));
}
if (message.gender !== undefined) {
obj.gender = criteria_js_1.GenderInfo.toJSON(message.gender);
}
if ((_c = message.age_ranges) === null || _c === void 0 ? void 0 : _c.length) {
obj.age_ranges = message.age_ranges.map((e) => criteria_js_1.AgeRangeInfo.toJSON(e));
}
if (message.parental_status !== undefined) {
obj.parental_status = criteria_js_1.ParentalStatusInfo.toJSON(message.parental_status);
}
if ((_d = message.income_ranges) === null || _d === void 0 ? void 0 : _d.length) {
obj.income_ranges = message.income_ranges.map((e) => criteria_js_1.IncomeRangeInfo.toJSON(e));
}
if ((_e = message.lineups) === null || _e === void 0 ? void 0 : _e.length) {
obj.lineups = message.lineups.map((e) => audience_insights_attribute_js_1.AudienceInsightsLineup.toJSON(e));
}
if ((_f = message.topic_audience_combinations) === null || _f === void 0 ? void 0 : _f.length) {
obj.topic_audience_combinations = message.topic_audience_combinations.map((e) => exports.InsightsAudienceAttributeGroup.toJSON(e));
}
return obj;
},
create(base) {
return exports.InsightsAudience.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f;
const message = createBaseInsightsAudience();
message.country_locations = ((_a = object.country_locations) === null || _a === void 0 ? void 0 : _a.map((e) => criteria_js_1.LocationInfo.fromPartial(e))) || [];
message.sub_country_locations = ((_b = object.sub_country_locations) === null || _b === void 0 ? void 0 : _b.map((e) => criteria_js_1.LocationInfo.fromPartial(e))) || [];
message.gender = (object.gender !== undefined && object.gender !== null)
? criteria_js_1.GenderInfo.fromPartial(object.gender)
: undefined;
message.age_ranges = ((_c = object.age_ranges) === null || _c === void 0 ? void 0 : _c.map((e) => criteria_js_1.AgeRangeInfo.fromPartial(e))) || [];
message.parental_status = (object.parental_status !== undefined && object.parental_status !== null)
? criteria_js_1.ParentalStatusInfo.fromPartial(object.parental_status)
: undefined;
message.income_ranges = ((_d = object.income_ranges) === null || _d === void 0 ? void 0 : _d.map((e) => criteria_js_1.IncomeRangeInfo.fromPartial(e))) || [];
message.lineups = ((_e = object.lineups) === null || _e === void 0 ? void 0 : _e.map((e) => audience_insights_attribute_js_1.AudienceInsightsLineup.fromPartial(e))) || [];
message.topic_audience_combinations =
((_f = object.topic_audience_combinations) === null || _f === void 0 ? void 0 : _f.map((e) => exports.InsightsAudienceAttributeGroup.fromPartial(e))) || [];
return message;
},
};
function createBaseInsightsAudienceAttributeGroup() {
return { attributes: [] };
}
exports.InsightsAudienceAttributeGroup = {
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.AudienceInsightsAttribute.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 = createBaseInsightsAudienceAttributeGroup();
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.AudienceInsightsAttribute.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.AudienceInsightsAttribute.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.AudienceInsightsAttribute.toJSON(e));
}
return obj;
},
create(base) {
return exports.InsightsAudienceAttributeGroup.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseInsightsAudienceAttributeGroup();
message.attributes = ((_a = object.attributes) === null || _a === void 0 ? void 0 : _a.map((e) => audience_insights_attribute_js_1.AudienceInsightsAttribute.fromPartial(e))) || [];
return message;
},
};
function createBaseAudienceCompositionSection() {
return { dimension: 0, top_attributes: [], clustered_attributes: [] };
}
exports.AudienceCompositionSection = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.dimension !== undefined && message.dimension !== 0) {
writer.uint32(8).int32(message.dimension);
}
if (message.top_attributes !== undefined && message.top_attributes.length !== 0) {
for (const v of message.top_attributes) {
exports.AudienceCompositionAttribute.encode(v, writer.uint32(26).fork()).ldelim();
}
}
if (message.clustered_attributes !== undefined && message.clustered_attributes.length !== 0) {
for (const v of message.clustered_attributes) {
exports.AudienceCompositionAttributeCluster.encode(v, writer.uint32(34).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 = createBaseAudienceCompositionSection();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.dimension = reader.int32();
continue;
case 3:
if (tag !== 26) {
break;
}
message.top_attributes.push(exports.AudienceCompositionAttribute.decode(reader, reader.uint32()));
continue;
case 4:
if (tag !== 34) {
break;
}
message.clustered_attributes.push(exports.AudienceCompositionAttributeCluster.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
dimension: isSet(object.dimension)
? (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionFromJSON)(object.dimension)
: 0,
top_attributes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.top_attributes)
? object.top_attributes.map((e) => exports.AudienceCompositionAttribute.fromJSON(e))
: [],
clustered_attributes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.clustered_attributes)
? object.clustered_attributes.map((e) => exports.AudienceCompositionAttributeCluster.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a, _b;
const obj = {};
if (message.dimension !== undefined && message.dimension !== 0) {
obj.dimension = (0, audience_insights_dimension_js_1.audienceInsightsDimensionEnum_AudienceInsightsDimensionToJSON)(message.dimension);
}
if ((_a = message.top_attributes) === null || _a === void 0 ? void 0 : _a.length) {
obj.top_attributes = message.top_attributes.map((e) => exports.AudienceCompositionAttribute.toJSON(e));
}
if ((_b = message.clustered_attributes) === null || _b === void 0 ? void 0 : _b.length) {
obj.clustered_attributes = message.clustered_attributes.map((e) => exports.AudienceCompositionAttributeCluster.toJSON(e));
}
return obj;
},
create(base) {
return exports.AudienceCompositionSection.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseAudienceCompositionSection();
message.dimension = (_a = object.dimension) !== null && _a !== void 0 ? _a : 0;
message.top_attributes = ((_b = object.top_attributes) === null || _b === void 0 ? void 0 : _b.map((e) => exports.AudienceCompositionAttribute.fromPartial(e))) || [];
message.clustered_attributes =
((_c = object.clustered_attributes) === null || _c === void 0 ? void 0 : _c.map((e) => exports.AudienceCompositionAttributeCluster.fromPartial(e))) || [];
return message;
},
};
function createBaseAudienceCompositionAttributeCluster() {
return { cluster_display_name: "", cluster_metrics: undefined, attributes: [] };
}
exports.AudienceCompositionAttributeCluster = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.cluster_display_name !== undefined && message.cluster_display_name !== "") {
writer.uint32(10).string(message.cluster_display_name);
}
if (message.cluster_metrics !== undefined) {
exports.AudienceCompositionMetrics.encode(message.cluster_metrics, writer.uint32(26).fork()).ldelim();
}
if (message.attributes !== undefined && message.attributes.length !== 0) {
for (const v of message.attributes) {
exports.AudienceCompositionAttribute.encode(v, writer.uint32(34).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 = createBaseAudienceCompositionAttributeCluster();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.cluster_display_name = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.cluster_metrics = exports.AudienceCompositionMetrics.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.attributes.push(exports.AudienceCompositionAttribute.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
cluster_display_name: isSet(object.cluster_display_name) ? globalThis.String(object.cluster_display_name) : "",
cluster_metrics: isSet(object.cluster_metrics)
? exports.AudienceCompositionMetrics.fromJSON(object.cluster_metrics)
: undefined,
attributes: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.attributes)
? object.attributes.map((e) => exports.AudienceCompositionAttribute.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.cluster_display_name !== undefined && message.cluster_display_name !== "") {
obj.cluster_display_name = message.cluster_display_name;
}
if (message.cluster_metrics !== undefined) {
obj.cluster_metrics = exports.AudienceCompositionMetrics.toJSON(message.cluster_metrics);
}
if ((_a = message.attributes) === null || _a === void 0 ? void 0 : _a.length) {
obj.attributes = message.attributes.map((e) => exports.AudienceCompositionAttribute.toJSON(e));
}
return obj;
},
create(base) {
return exports.AudienceCompositionAttributeCluster.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseAudienceCompositionAttributeCluster();
message.cluster_display_name = (_a = object.cluster_display_name) !== null && _a !== void 0 ? _a : "";
message.cluster_metrics = (object.cluster_metrics !== undefined && object.cluster_metrics !== null)
? exports.AudienceCompositionMetrics.fromPartial(object.cluster_metrics)
: undefined;
message.attributes = ((_b = object.attributes) === null || _b === void 0 ? void 0 : _b.map((e) => exports.AudienceCompositionAttribute.fromPartial(e))) || [];
return message;
},
};
function createBaseAudienceCompositionMetrics() {
return { baseline_audience_share: 0, audience_share: 0, index: 0, score: 0 };
}
exports.AudienceCompositionMetrics = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.baseline_audience_share !== undefined && message.baseline_audience_share !== 0) {
writer.uint32(9).double(message.baseline_audience_share);
}
if (message.audience_share !== undefined && message.audience_share !== 0) {
writer.uint32(17).double(message.audience_share);
}
if (message.index !== undefined && message.index !== 0) {
writer.uint32(25).double(message.index);
}
if (message.score !== undefined && message.score !== 0) {
writer.uint32(33).double(message.score);
}
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 = createBaseAudienceCompositionMetrics();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 9) {
break;
}
message.baseline_audience_share = reader.double();
continue;
case 2:
if (tag !== 17) {
break;
}
message.audience_share = reader.double();
continue;
case 3:
if (tag !== 25) {
break;
}
message.index = reader.double();
continue;
case 4:
if (tag !== 33) {
break;
}
message.score = reader.double();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
baseline_audience_share: isSet(object.baseline_audience_share)
? globalThis.Number(object.baseline_audience_share)
: 0,
audience_share: isSet(object.audience_share) ? globalThis.Number(object.audience_share) : 0,
index: isSet(object.index) ? globalThis.Number(object.index) : 0,
score: isSet(object.score) ? globalThis.Number(object.score) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.baseline_audience_share !== undefined && message.baseline_audience_share !== 0) {
obj.baseline_audience_share = message.baseline_audience_share;
}
if (message.audience_share !== undefined && message.audience_share !== 0) {
obj.audience_share = message.audience_share;
}
if (message.index !== undefined && message.index !== 0) {
obj.index = message.index;
}
if (message.score !== undefined && message.score !== 0) {
obj.score = message.score;
}
return obj;
},
create(base) {
return exports.AudienceCompositionMetrics.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseAudienceCompositionMetrics();
message.baseline_audience_share = (_a = object.baseline_audience_share) !== null && _a !== void 0 ? _a : 0;
message.audience_share = (_b = object.audience_share) !== null && _b !== void 0 ? _b : 0;
message.index = (_c = object.index) !== null && _c !== void 0 ? _c : 0;
message.score = (_d = object.score) !== null && _d !== void 0 ? _d : 0;
return message;
},
};
function createBaseAudienceCompositionAttribute() {
return { attribute_metadata: undefined, metrics: undefined };
}
exports.AudienceCompositionAttribute = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.attribute_metadata !== undefined) {
audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.encode(message.attribute_metadata, writer.uint32(26).fork()).ldelim();
}
if (message.metrics !== undefined) {
exports.AudienceCompositionMetrics.encode(message.metrics, 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 = createBaseAudienceCompositionAttribute();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 3:
if (tag !== 26) {
break;
}
message.attribute_metadata = audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.metrics = exports.AudienceCompositionMetrics.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
attribute_metadata: isSet(object.attribute_metadata)
? audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromJSON(object.attribute_metadata)
: undefined,
metrics: isSet(object.metrics) ? exports.AudienceCompositionMetrics.fromJSON(object.metrics) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.attribute_metadata !== undefined) {
obj.attribute_metadata = audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.toJSON(message.attribute_metadata);
}
if (message.metrics !== undefined) {
obj.metrics = exports.AudienceCompositionMetrics.toJSON(message.metrics);
}
return obj;
},
create(base) {
return exports.AudienceCompositionAttribute.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseAudienceCompositionAttribute();
message.attribute_metadata = (object.attribute_metadata !== undefined && object.attribute_metadata !== null)
? audience_insights_attribute_js_1.AudienceInsightsAttributeMetadata.fromPartial(object.attribute_metadata)
: undefined;
message.metrics = (object.metrics !== undefined && object.metrics !== null)
? exports.AudienceCompositionMetrics.fromPartial(object.metrics)
: undefined;
return message;
},
};
exports.AudienceInsightsServiceService = {
/**
* Creates a saved report that can be viewed in the Insights Finder tool.
*
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
generateInsightsFinderReport: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/GenerateInsightsFinderReport",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.GenerateInsightsFinderReportRequest.encode(value).finish()),
requestDeserialize: (value) => exports.GenerateInsightsFinderReportRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.GenerateInsightsFinderReportResponse.encode(value).finish()),
responseDeserialize: (value) => exports.GenerateInsightsFinderReportResponse.decode(value),
},
/**
* Searches for audience attributes that can be used to generate insights.
*
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
listAudienceInsightsAttributes: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/ListAudienceInsightsAttributes",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.ListAudienceInsightsAttributesRequest.encode(value).finish()),
requestDeserialize: (value) => exports.ListAudienceInsightsAttributesRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.ListAudienceInsightsAttributesResponse.encode(value).finish()),
responseDeserialize: (value) => exports.ListAudienceInsightsAttributesResponse.decode(value),
},
/**
* Lists date ranges for which audience insights data can be requested.
*
* List of thrown errors:
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
listInsightsEligibleDates: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/ListInsightsEligibleDates",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.ListInsightsEligibleDatesRequest.encode(value).finish()),
requestDeserialize: (value) => exports.ListInsightsEligibleDatesRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.ListInsightsEligibleDatesResponse.encode(value).finish()),
responseDeserialize: (value) => exports.ListInsightsEligibleDatesResponse.decode(value),
},
/**
* Returns a collection of attributes that are represented in an audience of
* interest, with metrics that compare each attribute's share of the audience
* with its share of a baseline audience.
*
* List of thrown errors:
* [AudienceInsightsError]()
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
generateAudienceCompositionInsights: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/GenerateAudienceCompositionInsights",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.GenerateAudienceCompositionInsightsRequest.encode(value).finish()),
requestDeserialize: (value) => exports.GenerateAudienceCompositionInsightsRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.GenerateAudienceCompositionInsightsResponse.encode(value).finish()),
responseDeserialize: (value) => exports.GenerateAudienceCompositionInsightsResponse.decode(value),
},
/**
* Returns a collection of targeting insights (e.g. targetable audiences) that
* are relevant to the requested audience.
*
* List of thrown errors:
* [AudienceInsightsError]()
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
generateSuggestedTargetingInsights: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/GenerateSuggestedTargetingInsights",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.GenerateSuggestedTargetingInsightsRequest.encode(value).finish()),
requestDeserialize: (value) => exports.GenerateSuggestedTargetingInsightsRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.GenerateSuggestedTargetingInsightsResponse.encode(value).finish()),
responseDeserialize: (value) => exports.GenerateSuggestedTargetingInsightsResponse.decode(value),
},
/**
* Returns a collection of audience attributes along with estimates of the
* overlap between their potential YouTube reach and that of a given input
* attribute.
*
* List of thrown errors:
* [AudienceInsightsError]()
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
generateAudienceOverlapInsights: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/GenerateAudienceOverlapInsights",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.GenerateAudienceOverlapInsightsRequest.encode(value).finish()),
requestDeserialize: (value) => exports.GenerateAudienceOverlapInsightsRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.GenerateAudienceOverlapInsightsResponse.encode(value).finish()),
responseDeserialize: (value) => exports.GenerateAudienceOverlapInsightsResponse.decode(value),
},
/**
* Returns potential reach metrics for targetable audiences.
*
* This method helps answer questions like "How many Men aged 18+ interested
* in Camping can be reached on YouTube?"
*
* List of thrown errors:
* [AudienceInsightsError]()
* [AuthenticationError]()
* [AuthorizationError]()
* [FieldError]()
* [HeaderError]()
* [InternalError]()
* [QuotaError]()
* [RangeError]()
* [RequestError]()
*/
generateTargetingSuggestionMetrics: {
path: "/google.ads.googleads.v20.services.AudienceInsightsService/GenerateTargetingSuggestionMetrics",
requestStream: false,
responseStream: false,
requestSerialize: (value) => Buffer.from(exports.GenerateTargetingSuggestionMetricsRequest.encode(value).finish()),
requestDeserialize: (value) => exports.GenerateTargetingSuggestionMetricsRequest.decode(value),
responseSerialize: (value) => Buffer.from(exports.GenerateTargetingSuggestionMetricsResponse.encode(value).finish()),
responseDeserialize: (value) => exports.GenerateTargetingSuggestionMetricsResponse.decode(value),
},
};
exports.AudienceInsightsServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.AudienceInsightsServiceService, "google.ads.googleads.v20.services.AudienceInsightsService");
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;
}