@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
1,152 lines (1,151 loc) • 165 kB
JavaScript
// 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
/* eslint-disable */
import { makeGenericClientConstructor, } from "@grpc/grpc-js";
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { AdditionalApplicationInfo } from "../common/additional_application_info.js";
import { DeviceInfo, GenderInfo, UserInterestInfo, UserListInfo } from "../common/criteria.js";
import { DateRange } from "../common/dates.js";
import { frequencyCapTimeUnitEnum_FrequencyCapTimeUnitFromJSON, frequencyCapTimeUnitEnum_FrequencyCapTimeUnitToJSON, } from "../enums/frequency_cap_time_unit.js";
import { reachPlanAgeRangeEnum_ReachPlanAgeRangeFromJSON, reachPlanAgeRangeEnum_ReachPlanAgeRangeToJSON, } from "../enums/reach_plan_age_range.js";
import { reachPlanConversionRateModelEnum_ReachPlanConversionRateModelFromJSON, reachPlanConversionRateModelEnum_ReachPlanConversionRateModelToJSON, } from "../enums/reach_plan_conversion_rate_model.js";
import { reachPlanNetworkEnum_ReachPlanNetworkFromJSON, reachPlanNetworkEnum_ReachPlanNetworkToJSON, } from "../enums/reach_plan_network.js";
import { reachPlanPlannableUserListStatusEnum_ReachPlanPlannableUserListStatusFromJSON, reachPlanPlannableUserListStatusEnum_ReachPlanPlannableUserListStatusToJSON, } from "../enums/reach_plan_plannable_user_list_status.js";
import { reachPlanSurfaceEnum_ReachPlanSurfaceFromJSON, reachPlanSurfaceEnum_ReachPlanSurfaceToJSON, } from "../enums/reach_plan_surface.js";
import { targetFrequencyTimeUnitEnum_TargetFrequencyTimeUnitFromJSON, targetFrequencyTimeUnitEnum_TargetFrequencyTimeUnitToJSON, } from "../enums/target_frequency_time_unit.js";
import { userInterestTaxonomyTypeEnum_UserInterestTaxonomyTypeFromJSON, userInterestTaxonomyTypeEnum_UserInterestTaxonomyTypeToJSON, } from "../enums/user_interest_taxonomy_type.js";
import { userListTypeEnum_UserListTypeFromJSON, userListTypeEnum_UserListTypeToJSON, } from "../enums/user_list_type.js";
function createBaseGenerateConversionRatesRequest() {
return { customer_id: "", customer_reach_group: undefined, reach_application_info: undefined };
}
export const GenerateConversionRatesRequest = {
encode(message, writer = _m0.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) {
AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = 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 = 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)
? 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 = AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return 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)
? AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseGenerateConversionRatesResponse() {
return { conversion_rate_suggestions: [] };
}
export const GenerateConversionRatesResponse = {
encode(message, writer = _m0.Writer.create()) {
if (message.conversion_rate_suggestions !== undefined && message.conversion_rate_suggestions.length !== 0) {
for (const v of message.conversion_rate_suggestions) {
ConversionRateSuggestion.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseGenerateConversionRatesResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.conversion_rate_suggestions.push(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) => 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) => ConversionRateSuggestion.toJSON(e));
}
return obj;
},
create(base) {
return 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) => ConversionRateSuggestion.fromPartial(e))) || [];
return message;
},
};
function createBaseConversionRateSuggestion() {
return { conversion_rate_model: 0, plannable_product_code: "", conversion_rate: 0 };
}
export const ConversionRateSuggestion = {
encode(message, writer = _m0.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 _m0.Reader ? input : _m0.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)
? 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 = 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 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 };
}
export const ListPlannableLocationsRequest = {
encode(message, writer = _m0.Writer.create()) {
if (message.reach_application_info !== undefined) {
AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPlannableLocationsRequest();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.reach_application_info = 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)
? AdditionalApplicationInfo.fromJSON(object.reach_application_info)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.reach_application_info !== undefined) {
obj.reach_application_info = AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return 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)
? AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseListPlannableLocationsResponse() {
return { plannable_locations: [] };
}
export const ListPlannableLocationsResponse = {
encode(message, writer = _m0.Writer.create()) {
if (message.plannable_locations !== undefined && message.plannable_locations.length !== 0) {
for (const v of message.plannable_locations) {
PlannableLocation.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPlannableLocationsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.plannable_locations.push(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) => 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) => PlannableLocation.toJSON(e));
}
return obj;
},
create(base) {
return 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) => PlannableLocation.fromPartial(e))) || [];
return message;
},
};
function createBasePlannableLocation() {
return {
id: undefined,
name: undefined,
parent_country_id: undefined,
country_code: undefined,
location_type: undefined,
};
}
export const PlannableLocation = {
encode(message, writer = _m0.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 _m0.Reader ? input : _m0.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 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 };
}
export const ListPlannableProductsRequest = {
encode(message, writer = _m0.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) {
AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = 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 = 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)
? 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 = AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return 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)
? AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseListPlannableProductsResponse() {
return { product_metadata: [] };
}
export const ListPlannableProductsResponse = {
encode(message, writer = _m0.Writer.create()) {
if (message.product_metadata !== undefined && message.product_metadata.length !== 0) {
for (const v of message.product_metadata) {
ProductMetadata.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPlannableProductsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.product_metadata.push(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) => 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) => ProductMetadata.toJSON(e));
}
return obj;
},
create(base) {
return 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) => ProductMetadata.fromPartial(e))) || [];
return message;
},
};
function createBaseProductMetadata() {
return { plannable_product_code: undefined, plannable_product_name: "", plannable_targeting: undefined };
}
export const ProductMetadata = {
encode(message, writer = _m0.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) {
PlannableTargeting.encode(message.plannable_targeting, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = 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 = 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)
? 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 = PlannableTargeting.toJSON(message.plannable_targeting);
}
return obj;
},
create(base) {
return 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)
? PlannableTargeting.fromPartial(object.plannable_targeting)
: undefined;
return message;
},
};
function createBaseListPlannableUserListsRequest() {
return { customer_id: "", customer_reach_group: undefined, reach_application_info: undefined };
}
export const ListPlannableUserListsRequest = {
encode(message, writer = _m0.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) {
AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = 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 = 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)
? 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 = AdditionalApplicationInfo.toJSON(message.reach_application_info);
}
return obj;
},
create(base) {
return 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)
? AdditionalApplicationInfo.fromPartial(object.reach_application_info)
: undefined;
return message;
},
};
function createBaseListPlannableUserListsResponse() {
return { plannable_user_lists: [] };
}
export const ListPlannableUserListsResponse = {
encode(message, writer = _m0.Writer.create()) {
if (message.plannable_user_lists !== undefined && message.plannable_user_lists.length !== 0) {
for (const v of message.plannable_user_lists) {
PlannableUserList.encode(v, writer.uint32(10).fork()).ldelim();
}
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseListPlannableUserListsResponse();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.plannable_user_lists.push(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) => 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) => PlannableUserList.toJSON(e));
}
return obj;
},
create(base) {
return 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) => PlannableUserList.fromPartial(e))) || [];
return message;
},
};
function createBasePlannableUserList() {
return { user_list_info: undefined, display_name: "", user_list_type: 0, plannable_status: 0 };
}
export const PlannableUserList = {
encode(message, writer = _m0.Writer.create()) {
if (message.user_list_info !== undefined) {
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 _m0.Reader ? input : _m0.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 = 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) ? 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) ? userListTypeEnum_UserListTypeFromJSON(object.user_list_type) : 0,
plannable_status: isSet(object.plannable_status)
? reachPlanPlannableUserListStatusEnum_ReachPlanPlannableUserListStatusFromJSON(object.plannable_status)
: 0,
};
},
toJSON(message) {
const obj = {};
if (message.user_list_info !== undefined) {
obj.user_list_info = 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 = userListTypeEnum_UserListTypeToJSON(message.user_list_type);
}
if (message.plannable_status !== undefined && message.plannable_status !== 0) {
obj.plannable_status = reachPlanPlannableUserListStatusEnum_ReachPlanPlannableUserListStatusToJSON(message.plannable_status);
}
return obj;
},
create(base) {
return 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)
? 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,
};
}
export const PlannableTargeting = {
encode(message, writer = _m0.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) {
GenderInfo.encode(v, writer.uint32(18).fork()).ldelim();
}
}
if (message.devices !== undefined && message.devices.length !== 0) {
for (const v of message.devices) {
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) {
YouTubeSelectLineUp.encode(v, writer.uint32(42).fork()).ldelim();
}
}
if (message.surface_targeting !== undefined) {
SurfaceTargetingCombinations.encode(message.surface_targeting, writer.uint32(50).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = 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(GenderInfo.decode(reader, reader.uint32()));
continue;
case 3:
if (tag !== 26) {
break;
}
message.devices.push(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(YouTubeSelectLineUp.decode(reader, reader.uint32()));
continue;
case 6:
if (tag !== 50) {
break;
}
message.surface_targeting = 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) => reachPlanAgeRangeEnum_ReachPlanAgeRangeFromJSON(e))
: [],
genders: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.genders) ? object.genders.map((e) => GenderInfo.fromJSON(e)) : [],
devices: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.devices) ? object.devices.map((e) => DeviceInfo.fromJSON(e)) : [],
networks: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.networks)
? object.networks.map((e) => 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) => YouTubeSelectLineUp.fromJSON(e))
: [],
surface_targeting: isSet(object.surface_targeting)
? 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) => reachPlanAgeRangeEnum_ReachPlanAgeRangeToJSON(e));
}
if ((_b = message.genders) === null || _b === void 0 ? void 0 : _b.length) {
obj.genders = message.genders.map((e) => GenderInfo.toJSON(e));
}
if ((_c = message.devices) === null || _c === void 0 ? void 0 : _c.length) {
obj.devices = message.devices.map((e) => DeviceInfo.toJSON(e));
}
if ((_d = message.networks) === null || _d === void 0 ? void 0 : _d.length) {
obj.networks = message.networks.map((e) => reachPlanNetworkEnum_ReachPlanNetworkToJSON(e));
}
if ((_e = message.youtube_select_lineups) === null || _e === void 0 ? void 0 : _e.length) {
obj.youtube_select_lineups = message.youtube_select_lineups.map((e) => YouTubeSelectLineUp.toJSON(e));
}
if (message.surface_targeting !== undefined) {
obj.surface_targeting = SurfaceTargetingCombinations.toJSON(message.surface_targeting);
}
return obj;
},
create(base) {
return PlannableTargeting.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBasePlannableTargeting();
message.age_ranges = ((_a = object.age_ranges) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
message.genders = ((_b = object.genders) === null || _b === void 0 ? void 0 : _b.map((e) => GenderInfo.fromPartial(e))) || [];
message.devices = ((_c = object.devices) === null || _c === void 0 ? void 0 : _c.map((e) => DeviceInfo.fromPartial(e))) || [];
message.networks = ((_d = object.networks) === null || _d === void 0 ? void 0 : _d.map((e) => e)) || [];
message.youtube_select_lineups = ((_e = object.youtube_select_lineups) === null || _e === void 0 ? void 0 : _e.map((e) => YouTubeSelectLineUp.fromPartial(e))) ||
[];
message.surface_targeting = (object.surface_targeting !== undefined && object.surface_targeting !== null)
? SurfaceTargetingCombinations.fromPartial(object.surface_targeting)
: undefined;
return message;
},
};
function createBaseListPlannableUserInterestsRequest() {
return {
customer_id: "",
user_interest_taxonomy_types: [],
name_query: undefined,
path_query: undefined,
reach_application_info: undefined,
};
}
export const ListPlannableUserInterestsRequest = {
encode(message, writer = _m0.Writer.create()) {
if (message.customer_id !== undefined && message.customer_id !== "") {
writer.uint32(10).string(message.customer_id);
}
if (message.user_interest_taxonomy_types !== undefined && message.user_interest_taxonomy_types.length !== 0) {
writer.uint32(18).fork();
for (const v of message.user_interest_taxonomy_types) {
writer.int32(v);
}
writer.ldelim();
}
if (message.name_query !== undefined) {
writer.uint32(26).string(message.name_query);
}
if (message.path_query !== undefined) {
writer.uint32(34).string(message.path_query);
}
if (message.reach_application_info !== undefined) {
AdditionalApplicationInfo.encode(message.reach_application_info, writer.uint32(42).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);