@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
1,097 lines (1,096 loc) • 171 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/v21/services/reach_plan_service.proto
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReachPlanServiceClient = exports.ReachPlanServiceService = exports.TargetFrequencySettings = exports.SurfaceTargeting = exports.SurfaceTargetingCombinations = exports.YouTubeSelectLineUp = exports.YouTubeSelectSettings = exports.AdvancedProductTargeting = exports.AudienceTargeting = exports.ForecastMetricOptions = exports.EffectiveFrequencyBreakdown = exports.OnTargetAudienceMetrics = exports.PlannedProductForecast = exports.PlannedProductReachForecast = exports.Forecast = exports.ReachForecast = exports.ReachCurve = exports.GenerateReachForecastResponse = exports.PlannedProduct = exports.CampaignDuration = exports.Targeting = exports.FrequencyCap = exports.EffectiveFrequencyLimit = exports.GenerateReachForecastRequest = exports.PlannableUserInterest = exports.ListPlannableUserInterestsResponse = exports.ListPlannableUserInterestsRequest = exports.PlannableTargeting = exports.PlannableUserList = exports.ListPlannableUserListsResponse = exports.ListPlannableUserListsRequest = exports.ProductMetadata = exports.ListPlannableProductsResponse = exports.ListPlannableProductsRequest = exports.PlannableLocation = exports.ListPlannableLocationsResponse = exports.ListPlannableLocationsRequest = exports.ConversionRateSuggestion = exports.GenerateConversionRatesResponse = exports.GenerateConversionRatesRequest = 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 criteria_js_1 = require("../common/criteria.js");
const dates_js_1 = require("../common/dates.js");
const frequency_cap_time_unit_js_1 = require("../enums/frequency_cap_time_unit.js");
const reach_plan_age_range_js_1 = require("../enums/reach_plan_age_range.js");
const reach_plan_conversion_rate_model_js_1 = require("../enums/reach_plan_conversion_rate_model.js");
const reach_plan_network_js_1 = require("../enums/reach_plan_network.js");
const reach_plan_plannable_user_list_status_js_1 = require("../enums/reach_plan_plannable_user_list_status.js");
const reach_plan_surface_js_1 = require("../enums/reach_plan_surface.js");
const target_frequency_time_unit_js_1 = require("../enums/target_frequency_time_unit.js");
const user_interest_taxonomy_type_js_1 = require("../enums/user_interest_taxonomy_type.js");
const user_list_type_js_1 = require("../enums/user_list_type.js");
function createBaseGenerateConversionRatesRequest() {
return { customer_id: "", customer_reach_group: undefined, reach_application_info: undefined };
}
exports.GenerateConversionRatesRequest = {
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_reach_group !== undefined) {
writer.uint32(18).string(message.customer_reach_group);
}
if (message.reach_application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenerateConversionRatesRequest();
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.customer_reach_group = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.reach_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) : "",
customer_reach_group: isSet(object.customer_reach_group)
? globalThis.String(object.customer_reach_group)
: undefined,
reach_application_info: isSet(object.reach_application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.reach_application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.customer_id !== undefined && message.customer_id !== "") {
obj.customer_id = message.customer_id;
}
if (message.customer_reach_group !== undefined) {
obj.customer_reach_group = message.customer_reach_group;
}
if (message.reach_application_info !== undefined) {
obj.reach_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return exports.GenerateConversionRatesRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseGenerateConversionRatesRequest();
message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : "";
message.customer_reach_group = (_b = object.customer_reach_group) !== null && _b !== void 0 ? _b : undefined;
message.reach_application_info =
(object.reach_application_info !== undefined && object.reach_application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseGenerateConversionRatesResponse() {
return { conversion_rate_suggestions: [] };
}
exports.GenerateConversionRatesResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.conversion_rate_suggestions !== undefined && message.conversion_rate_suggestions.length !== 0) {
for (const v of message.conversion_rate_suggestions) {
exports.ConversionRateSuggestion.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 = createBaseGenerateConversionRatesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.conversion_rate_suggestions.push(exports.ConversionRateSuggestion.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
conversion_rate_suggestions: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.conversion_rate_suggestions)
? object.conversion_rate_suggestions.map((e) => exports.ConversionRateSuggestion.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.conversion_rate_suggestions) === null || _a === void 0 ? void 0 : _a.length) {
obj.conversion_rate_suggestions = message.conversion_rate_suggestions.map((e) => exports.ConversionRateSuggestion.toJSON(e));
}
return obj;
},
create(base) {
return exports.GenerateConversionRatesResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseGenerateConversionRatesResponse();
message.conversion_rate_suggestions =
((_a = object.conversion_rate_suggestions) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ConversionRateSuggestion.fromPartial(e))) || [];
return message;
},
};
function createBaseConversionRateSuggestion() {
return { conversion_rate_model: 0, plannable_product_code: "", conversion_rate: 0 };
}
exports.ConversionRateSuggestion = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.conversion_rate_model !== undefined && message.conversion_rate_model !== 0) {
writer.uint32(8).int32(message.conversion_rate_model);
}
if (message.plannable_product_code !== undefined && message.plannable_product_code !== "") {
writer.uint32(18).string(message.plannable_product_code);
}
if (message.conversion_rate !== undefined && message.conversion_rate !== 0) {
writer.uint32(25).double(message.conversion_rate);
}
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 = createBaseConversionRateSuggestion();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.conversion_rate_model = reader.int32();
continue;
case 2:
if (tag !== 18) {
break;
}
message.plannable_product_code = reader.string();
continue;
case 3:
if (tag !== 25) {
break;
}
message.conversion_rate = reader.double();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
conversion_rate_model: isSet(object.conversion_rate_model)
? (0, reach_plan_conversion_rate_model_js_1.reachPlanConversionRateModelEnum_ReachPlanConversionRateModelFromJSON)(object.conversion_rate_model)
: 0,
plannable_product_code: isSet(object.plannable_product_code)
? globalThis.String(object.plannable_product_code)
: "",
conversion_rate: isSet(object.conversion_rate) ? globalThis.Number(object.conversion_rate) : 0,
};
},
toJSON(message) {
const obj = {};
if (message.conversion_rate_model !== undefined && message.conversion_rate_model !== 0) {
obj.conversion_rate_model = (0, reach_plan_conversion_rate_model_js_1.reachPlanConversionRateModelEnum_ReachPlanConversionRateModelToJSON)(message.conversion_rate_model);
}
if (message.plannable_product_code !== undefined && message.plannable_product_code !== "") {
obj.plannable_product_code = message.plannable_product_code;
}
if (message.conversion_rate !== undefined && message.conversion_rate !== 0) {
obj.conversion_rate = message.conversion_rate;
}
return obj;
},
create(base) {
return exports.ConversionRateSuggestion.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBaseConversionRateSuggestion();
message.conversion_rate_model = (_a = object.conversion_rate_model) !== null && _a !== void 0 ? _a : 0;
message.plannable_product_code = (_b = object.plannable_product_code) !== null && _b !== void 0 ? _b : "";
message.conversion_rate = (_c = object.conversion_rate) !== null && _c !== void 0 ? _c : 0;
return message;
},
};
function createBaseListPlannableLocationsRequest() {
return { reach_application_info: undefined };
}
exports.ListPlannableLocationsRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.reach_application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.reach_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 = createBaseListPlannableLocationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.reach_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 {
reach_application_info: isSet(object.reach_application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.reach_application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.reach_application_info !== undefined) {
obj.reach_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return exports.ListPlannableLocationsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseListPlannableLocationsRequest();
message.reach_application_info =
(object.reach_application_info !== undefined && object.reach_application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseListPlannableLocationsResponse() {
return { plannable_locations: [] };
}
exports.ListPlannableLocationsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.plannable_locations !== undefined && message.plannable_locations.length !== 0) {
for (const v of message.plannable_locations) {
exports.PlannableLocation.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 = createBaseListPlannableLocationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.plannable_locations.push(exports.PlannableLocation.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
plannable_locations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.plannable_locations)
? object.plannable_locations.map((e) => exports.PlannableLocation.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.plannable_locations) === null || _a === void 0 ? void 0 : _a.length) {
obj.plannable_locations = message.plannable_locations.map((e) => exports.PlannableLocation.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListPlannableLocationsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListPlannableLocationsResponse();
message.plannable_locations = ((_a = object.plannable_locations) === null || _a === void 0 ? void 0 : _a.map((e) => exports.PlannableLocation.fromPartial(e))) || [];
return message;
},
};
function createBasePlannableLocation() {
return {
id: undefined,
name: undefined,
parent_country_id: undefined,
country_code: undefined,
location_type: undefined,
};
}
exports.PlannableLocation = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.id !== undefined) {
writer.uint32(34).string(message.id);
}
if (message.name !== undefined) {
writer.uint32(42).string(message.name);
}
if (message.parent_country_id !== undefined) {
writer.uint32(48).int64(message.parent_country_id);
}
if (message.country_code !== undefined) {
writer.uint32(58).string(message.country_code);
}
if (message.location_type !== undefined) {
writer.uint32(66).string(message.location_type);
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBasePlannableLocation();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 4:
if (tag !== 34) {
break;
}
message.id = reader.string();
continue;
case 5:
if (tag !== 42) {
break;
}
message.name = reader.string();
continue;
case 6:
if (tag !== 48) {
break;
}
message.parent_country_id = longToString(reader.int64());
continue;
case 7:
if (tag !== 58) {
break;
}
message.country_code = reader.string();
continue;
case 8:
if (tag !== 66) {
break;
}
message.location_type = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
id: isSet(object.id) ? globalThis.String(object.id) : undefined,
name: isSet(object.name) ? globalThis.String(object.name) : undefined,
parent_country_id: isSet(object.parent_country_id) ? globalThis.String(object.parent_country_id) : undefined,
country_code: isSet(object.country_code) ? globalThis.String(object.country_code) : undefined,
location_type: isSet(object.location_type) ? globalThis.String(object.location_type) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.id !== undefined) {
obj.id = message.id;
}
if (message.name !== undefined) {
obj.name = message.name;
}
if (message.parent_country_id !== undefined) {
obj.parent_country_id = message.parent_country_id;
}
if (message.country_code !== undefined) {
obj.country_code = message.country_code;
}
if (message.location_type !== undefined) {
obj.location_type = message.location_type;
}
return obj;
},
create(base) {
return exports.PlannableLocation.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBasePlannableLocation();
message.id = (_a = object.id) !== null && _a !== void 0 ? _a : undefined;
message.name = (_b = object.name) !== null && _b !== void 0 ? _b : undefined;
message.parent_country_id = (_c = object.parent_country_id) !== null && _c !== void 0 ? _c : undefined;
message.country_code = (_d = object.country_code) !== null && _d !== void 0 ? _d : undefined;
message.location_type = (_e = object.location_type) !== null && _e !== void 0 ? _e : undefined;
return message;
},
};
function createBaseListPlannableProductsRequest() {
return { plannable_location_id: "", reach_application_info: undefined };
}
exports.ListPlannableProductsRequest = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.plannable_location_id !== undefined && message.plannable_location_id !== "") {
writer.uint32(18).string(message.plannable_location_id);
}
if (message.reach_application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPlannableProductsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
if (tag !== 18) {
break;
}
message.plannable_location_id = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.reach_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 {
plannable_location_id: isSet(object.plannable_location_id) ? globalThis.String(object.plannable_location_id) : "",
reach_application_info: isSet(object.reach_application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.reach_application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.plannable_location_id !== undefined && message.plannable_location_id !== "") {
obj.plannable_location_id = message.plannable_location_id;
}
if (message.reach_application_info !== undefined) {
obj.reach_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return exports.ListPlannableProductsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListPlannableProductsRequest();
message.plannable_location_id = (_a = object.plannable_location_id) !== null && _a !== void 0 ? _a : "";
message.reach_application_info =
(object.reach_application_info !== undefined && object.reach_application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseListPlannableProductsResponse() {
return { product_metadata: [] };
}
exports.ListPlannableProductsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.product_metadata !== undefined && message.product_metadata.length !== 0) {
for (const v of message.product_metadata) {
exports.ProductMetadata.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 = createBaseListPlannableProductsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.product_metadata.push(exports.ProductMetadata.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
product_metadata: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.product_metadata)
? object.product_metadata.map((e) => exports.ProductMetadata.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.product_metadata) === null || _a === void 0 ? void 0 : _a.length) {
obj.product_metadata = message.product_metadata.map((e) => exports.ProductMetadata.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListPlannableProductsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListPlannableProductsResponse();
message.product_metadata = ((_a = object.product_metadata) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ProductMetadata.fromPartial(e))) || [];
return message;
},
};
function createBaseProductMetadata() {
return { plannable_product_code: undefined, plannable_product_name: "", plannable_targeting: undefined };
}
exports.ProductMetadata = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.plannable_product_code !== undefined) {
writer.uint32(34).string(message.plannable_product_code);
}
if (message.plannable_product_name !== undefined && message.plannable_product_name !== "") {
writer.uint32(26).string(message.plannable_product_name);
}
if (message.plannable_targeting !== undefined) {
exports.PlannableTargeting.encode(message.plannable_targeting, 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 = createBaseProductMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 4:
if (tag !== 34) {
break;
}
message.plannable_product_code = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.plannable_product_name = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.plannable_targeting = exports.PlannableTargeting.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
plannable_product_code: isSet(object.plannable_product_code)
? globalThis.String(object.plannable_product_code)
: undefined,
plannable_product_name: isSet(object.plannable_product_name)
? globalThis.String(object.plannable_product_name)
: "",
plannable_targeting: isSet(object.plannable_targeting)
? exports.PlannableTargeting.fromJSON(object.plannable_targeting)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.plannable_product_code !== undefined) {
obj.plannable_product_code = message.plannable_product_code;
}
if (message.plannable_product_name !== undefined && message.plannable_product_name !== "") {
obj.plannable_product_name = message.plannable_product_name;
}
if (message.plannable_targeting !== undefined) {
obj.plannable_targeting = exports.PlannableTargeting.toJSON(message.plannable_targeting);
}
return obj;
},
create(base) {
return exports.ProductMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseProductMetadata();
message.plannable_product_code = (_a = object.plannable_product_code) !== null && _a !== void 0 ? _a : undefined;
message.plannable_product_name = (_b = object.plannable_product_name) !== null && _b !== void 0 ? _b : "";
message.plannable_targeting = (object.plannable_targeting !== undefined && object.plannable_targeting !== null)
? exports.PlannableTargeting.fromPartial(object.plannable_targeting)
: undefined;
return message;
},
};
function createBaseListPlannableUserListsRequest() {
return { customer_id: "", customer_reach_group: undefined, reach_application_info: undefined };
}
exports.ListPlannableUserListsRequest = {
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_reach_group !== undefined) {
writer.uint32(18).string(message.customer_reach_group);
}
if (message.reach_application_info !== undefined) {
additional_application_info_js_1.AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof minimal_js_1.default.Reader ? input : minimal_js_1.default.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPlannableUserListsRequest();
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.customer_reach_group = reader.string();
continue;
case 3:
if (tag !== 26) {
break;
}
message.reach_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) : "",
customer_reach_group: isSet(object.customer_reach_group)
? globalThis.String(object.customer_reach_group)
: undefined,
reach_application_info: isSet(object.reach_application_info)
? additional_application_info_js_1.AdditionalApplicationInfo.fromJSON(object.reach_application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.customer_id !== undefined && message.customer_id !== "") {
obj.customer_id = message.customer_id;
}
if (message.customer_reach_group !== undefined) {
obj.customer_reach_group = message.customer_reach_group;
}
if (message.reach_application_info !== undefined) {
obj.reach_application_info = additional_application_info_js_1.AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return exports.ListPlannableUserListsRequest.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b;
const message = createBaseListPlannableUserListsRequest();
message.customer_id = (_a = object.customer_id) !== null && _a !== void 0 ? _a : "";
message.customer_reach_group = (_b = object.customer_reach_group) !== null && _b !== void 0 ? _b : undefined;
message.reach_application_info =
(object.reach_application_info !== undefined && object.reach_application_info !== null)
? additional_application_info_js_1.AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseListPlannableUserListsResponse() {
return { plannable_user_lists: [] };
}
exports.ListPlannableUserListsResponse = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.plannable_user_lists !== undefined && message.plannable_user_lists.length !== 0) {
for (const v of message.plannable_user_lists) {
exports.PlannableUserList.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 = createBaseListPlannableUserListsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.plannable_user_lists.push(exports.PlannableUserList.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
plannable_user_lists: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.plannable_user_lists)
? object.plannable_user_lists.map((e) => exports.PlannableUserList.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if ((_a = message.plannable_user_lists) === null || _a === void 0 ? void 0 : _a.length) {
obj.plannable_user_lists = message.plannable_user_lists.map((e) => exports.PlannableUserList.toJSON(e));
}
return obj;
},
create(base) {
return exports.ListPlannableUserListsResponse.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseListPlannableUserListsResponse();
message.plannable_user_lists = ((_a = object.plannable_user_lists) === null || _a === void 0 ? void 0 : _a.map((e) => exports.PlannableUserList.fromPartial(e))) || [];
return message;
},
};
function createBasePlannableUserList() {
return { user_list_info: undefined, display_name: "", user_list_type: 0, plannable_status: 0 };
}
exports.PlannableUserList = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.user_list_info !== undefined) {
criteria_js_1.UserListInfo.encode(message.user_list_info, writer.uint32(10).fork()).ldelim();
}
if (message.display_name !== undefined && message.display_name !== "") {
writer.uint32(18).string(message.display_name);
}
if (message.user_list_type !== undefined && message.user_list_type !== 0) {
writer.uint32(24).int32(message.user_list_type);
}
if (message.plannable_status !== undefined && message.plannable_status !== 0) {
writer.uint32(32).int32(message.plannable_status);
}
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 = createBasePlannableUserList();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.user_list_info = criteria_js_1.UserListInfo.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.display_name = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.user_list_type = reader.int32();
continue;
case 4:
if (tag !== 32) {
break;
}
message.plannable_status = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
user_list_info: isSet(object.user_list_info) ? criteria_js_1.UserListInfo.fromJSON(object.user_list_info) : undefined,
display_name: isSet(object.display_name) ? globalThis.String(object.display_name) : "",
user_list_type: isSet(object.user_list_type) ? (0, user_list_type_js_1.userListTypeEnum_UserListTypeFromJSON)(object.user_list_type) : 0,
plannable_status: isSet(object.plannable_status)
? (0, reach_plan_plannable_user_list_status_js_1.reachPlanPlannableUserListStatusEnum_ReachPlanPlannableUserListStatusFromJSON)(object.plannable_status)
: 0,
};
},
toJSON(message) {
const obj = {};
if (message.user_list_info !== undefined) {
obj.user_list_info = criteria_js_1.UserListInfo.toJSON(message.user_list_info);
}
if (message.display_name !== undefined && message.display_name !== "") {
obj.display_name = message.display_name;
}
if (message.user_list_type !== undefined && message.user_list_type !== 0) {
obj.user_list_type = (0, user_list_type_js_1.userListTypeEnum_UserListTypeToJSON)(message.user_list_type);
}
if (message.plannable_status !== undefined && message.plannable_status !== 0) {
obj.plannable_status = (0, reach_plan_plannable_user_list_status_js_1.reachPlanPlannableUserListStatusEnum_ReachPlanPlannableUserListStatusToJSON)(message.plannable_status);
}
return obj;
},
create(base) {
return exports.PlannableUserList.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c;
const message = createBasePlannableUserList();
message.user_list_info = (object.user_list_info !== undefined && object.user_list_info !== null)
? criteria_js_1.UserListInfo.fromPartial(object.user_list_info)
: undefined;
message.display_name = (_a = object.display_name) !== null && _a !== void 0 ? _a : "";
message.user_list_type = (_b = object.user_list_type) !== null && _b !== void 0 ? _b : 0;
message.plannable_status = (_c = object.plannable_status) !== null && _c !== void 0 ? _c : 0;
return message;
},
};
function createBasePlannableTargeting() {
return {
age_ranges: [],
genders: [],
devices: [],
networks: [],
youtube_select_lineups: [],
surface_targeting: undefined,
};
}
exports.PlannableTargeting = {
encode(message, writer = minimal_js_1.default.Writer.create()) {
if (message.age_ranges !== undefined && message.age_ranges.length !== 0) {
writer.uint32(10).fork();
for (const v of message.age_ranges) {
writer.int32(v);
}
writer.ldelim();
}
if (message.genders !== undefined && message.genders.length !== 0) {
for (const v of message.genders) {
criteria_js_1.GenderInfo.encode(v, writer.uint32(18).fork()).ldelim();
}
}
if (message.devices !== undefined && message.devices.length !== 0) {
for (const v of message.devices) {
criteria_js_1.DeviceInfo.encode(v, writer.uint32(26).fork()).ldelim();
}
}
if (message.networks !== undefined && message.networks.length !== 0) {
writer.uint32(34).fork();
for (const v of message.networks) {
writer.int32(v);
}
writer.ldelim();
}
if (message.youtube_select_lineups !== undefined && message.youtube_select_lineups.length !== 0) {
for (const v of message.youtube_select_lineups) {
exports.YouTubeSelectLineUp.encode(v, writer.uint32(42).fork()).ldelim();
}
}
if (message.surface_targeting !== undefined) {
exports.SurfaceTargetingCombinations.encode(message.surface_targeting, 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 = createBasePlannableTargeting();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag === 8) {
message.age_ranges.push(reader.int32());
continue;
}
if (tag === 10) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.age_ranges.push(reader.int32());
}
continue;
}
break;
case 2:
if (tag !== 18) {
break;
}
message.genders.push(criteria_js_1.GenderInfo.decode(reader, reader.uint32()));
continue;
case 3:
if (tag !== 26) {
break;
}
message.devices.push(criteria_js_1.DeviceInfo.decode(reader, reader.uint32()));
continue;
case 4:
if (tag === 32) {
message.networks.push(reader.int32());
continue;
}
if (tag === 34) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.networks.push(reader.int32());
}
continue;
}
break;
case 5:
if (tag !== 42) {
break;
}
message.youtube_select_lineups.push(exports.YouTubeSelectLineUp.decode(reader, reader.uint32()));
continue;
case 6:
if (tag !== 50) {
break;
}
message.surface_targeting = exports.SurfaceTargetingCombinations.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
age_ranges: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.age_ranges)
? object.age_ranges.map((e) => (0, reach_plan_age_range_js_1.reachPlanAgeRangeEnum_ReachPlanAgeRangeFromJSON)(e))
: [],
genders: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.genders) ? object.genders.map((e) => criteria_js_1.GenderInfo.fromJSON(e)) : [],
devices: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.devices) ? object.devices.map((e) => criteria_js_1.DeviceInfo.fromJSON(e)) : [],
networks: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.networks)
? object.networks.map((e) => (0, reach_plan_network_js_1.reachPlanNetworkEnum_ReachPlanNetworkFromJSON)(e))
: [],
youtube_select_lineups: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.youtube_select_lineups)
? object.youtube_select_lineups.map((e) => exports.YouTubeSelectLineUp.fromJSON(e))
: [],
surface_targeting: isSet(object.surface_targeting)
? exports.SurfaceTargetingCombinations.fromJSON(object.surface_targeting)
: undefined,
};
},
toJSON(message) {
var _a, _b, _c, _d, _e;
const obj = {};
if ((_a = message.age_ranges) === null || _a === void 0 ? void 0 : _a.length) {
obj.age_ranges = message.age_ranges.map((e) => (0, reach_plan_age_range_js_1.reachPlanAgeRangeEnum_ReachPlanAgeRangeToJSON)(e));
}
if ((_b = message.genders) === null || _b === void 0 ? void 0 : _b.length) {
obj.genders = message.genders.map((e) => criteria_js_1.GenderInfo.toJSON(e));
}
if ((_c = message.devices) === null || _c === void 0 ? void 0 : _c.length) {
obj.devices = message.devices.map((e) => criteria_js_1.DeviceInfo.toJSON(e));
}
if ((_d = message.networks) === null || _d === void 0 ? void 0 : _d.length) {
obj.networks = message.networks.map((e) => (0, reach_plan_network_js_1.reachPlanNetworkEnum_ReachPlanNetworkToJSON)(e));