@htdangkhoa/google-ads
Version:
Google Ads API client for Node.js
1,099 lines • 65.6 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/common/audience_insights_attribute.proto
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal.js";
import { audienceInsightsDimensionEnum_AudienceInsightsDimensionFromJSON, audienceInsightsDimensionEnum_AudienceInsightsDimensionToJSON, } from "../enums/audience_insights_dimension.js";
import { insightsKnowledgeGraphEntityCapabilitiesEnum_InsightsKnowledgeGraphEntityCapabilitiesFromJSON, insightsKnowledgeGraphEntityCapabilitiesEnum_InsightsKnowledgeGraphEntityCapabilitiesToJSON, } from "../enums/insights_knowledge_graph_entity_capabilities.js";
import { userListTypeEnum_UserListTypeFromJSON, userListTypeEnum_UserListTypeToJSON, } from "../enums/user_list_type.js";
import { AgeRangeInfo, DeviceInfo, GenderInfo, IncomeRangeInfo, LocationInfo, ParentalStatusInfo, UserInterestInfo, UserListInfo, YouTubeChannelInfo, YouTubeVideoInfo, } from "./criteria.js";
function createBaseAudienceInsightsAttributeMetadata() {
return {
dimension: 0,
attribute: undefined,
display_name: "",
display_info: "",
potential_youtube_reach: "0",
subscriber_share: 0,
viewer_share: 0,
youtube_channel_metadata: undefined,
youtube_video_metadata: undefined,
lineup_attribute_metadata: undefined,
location_attribute_metadata: undefined,
user_interest_attribute_metadata: undefined,
knowledge_graph_attribute_metadata: undefined,
user_list_attribute_metadata: undefined,
};
}
export const AudienceInsightsAttributeMetadata = {
encode(message, writer = _m0.Writer.create()) {
if (message.dimension !== undefined && message.dimension !== 0) {
writer.uint32(8).int32(message.dimension);
}
if (message.attribute !== undefined) {
AudienceInsightsAttribute.encode(message.attribute, writer.uint32(18).fork()).ldelim();
}
if (message.display_name !== undefined && message.display_name !== "") {
writer.uint32(26).string(message.display_name);
}
if (message.display_info !== undefined && message.display_info !== "") {
writer.uint32(34).string(message.display_info);
}
if (message.potential_youtube_reach !== undefined && message.potential_youtube_reach !== "0") {
writer.uint32(64).int64(message.potential_youtube_reach);
}
if (message.subscriber_share !== undefined && message.subscriber_share !== 0) {
writer.uint32(73).double(message.subscriber_share);
}
if (message.viewer_share !== undefined && message.viewer_share !== 0) {
writer.uint32(105).double(message.viewer_share);
}
if (message.youtube_channel_metadata !== undefined) {
YouTubeChannelAttributeMetadata.encode(message.youtube_channel_metadata, writer.uint32(42).fork()).ldelim();
}
if (message.youtube_video_metadata !== undefined) {
YouTubeVideoAttributeMetadata.encode(message.youtube_video_metadata, writer.uint32(82).fork()).ldelim();
}
if (message.lineup_attribute_metadata !== undefined) {
LineupAttributeMetadata.encode(message.lineup_attribute_metadata, writer.uint32(114).fork()).ldelim();
}
if (message.location_attribute_metadata !== undefined) {
LocationAttributeMetadata.encode(message.location_attribute_metadata, writer.uint32(58).fork()).ldelim();
}
if (message.user_interest_attribute_metadata !== undefined) {
UserInterestAttributeMetadata.encode(message.user_interest_attribute_metadata, writer.uint32(90).fork()).ldelim();
}
if (message.knowledge_graph_attribute_metadata !== undefined) {
KnowledgeGraphAttributeMetadata.encode(message.knowledge_graph_attribute_metadata, writer.uint32(98).fork())
.ldelim();
}
if (message.user_list_attribute_metadata !== undefined) {
UserListAttributeMetadata.encode(message.user_list_attribute_metadata, writer.uint32(122).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 = createBaseAudienceInsightsAttributeMetadata();
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.attribute = AudienceInsightsAttribute.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.display_name = reader.string();
continue;
case 4:
if (tag !== 34) {
break;
}
message.display_info = reader.string();
continue;
case 8:
if (tag !== 64) {
break;
}
message.potential_youtube_reach = longToString(reader.int64());
continue;
case 9:
if (tag !== 73) {
break;
}
message.subscriber_share = reader.double();
continue;
case 13:
if (tag !== 105) {
break;
}
message.viewer_share = reader.double();
continue;
case 5:
if (tag !== 42) {
break;
}
message.youtube_channel_metadata = YouTubeChannelAttributeMetadata.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 82) {
break;
}
message.youtube_video_metadata = YouTubeVideoAttributeMetadata.decode(reader, reader.uint32());
continue;
case 14:
if (tag !== 114) {
break;
}
message.lineup_attribute_metadata = LineupAttributeMetadata.decode(reader, reader.uint32());
continue;
case 7:
if (tag !== 58) {
break;
}
message.location_attribute_metadata = LocationAttributeMetadata.decode(reader, reader.uint32());
continue;
case 11:
if (tag !== 90) {
break;
}
message.user_interest_attribute_metadata = UserInterestAttributeMetadata.decode(reader, reader.uint32());
continue;
case 12:
if (tag !== 98) {
break;
}
message.knowledge_graph_attribute_metadata = KnowledgeGraphAttributeMetadata.decode(reader, reader.uint32());
continue;
case 15:
if (tag !== 122) {
break;
}
message.user_list_attribute_metadata = UserListAttributeMetadata.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)
? audienceInsightsDimensionEnum_AudienceInsightsDimensionFromJSON(object.dimension)
: 0,
attribute: isSet(object.attribute) ? AudienceInsightsAttribute.fromJSON(object.attribute) : undefined,
display_name: isSet(object.display_name) ? globalThis.String(object.display_name) : "",
display_info: isSet(object.display_info) ? globalThis.String(object.display_info) : "",
potential_youtube_reach: isSet(object.potential_youtube_reach)
? globalThis.String(object.potential_youtube_reach)
: "0",
subscriber_share: isSet(object.subscriber_share) ? globalThis.Number(object.subscriber_share) : 0,
viewer_share: isSet(object.viewer_share) ? globalThis.Number(object.viewer_share) : 0,
youtube_channel_metadata: isSet(object.youtube_channel_metadata)
? YouTubeChannelAttributeMetadata.fromJSON(object.youtube_channel_metadata)
: undefined,
youtube_video_metadata: isSet(object.youtube_video_metadata)
? YouTubeVideoAttributeMetadata.fromJSON(object.youtube_video_metadata)
: undefined,
lineup_attribute_metadata: isSet(object.lineup_attribute_metadata)
? LineupAttributeMetadata.fromJSON(object.lineup_attribute_metadata)
: undefined,
location_attribute_metadata: isSet(object.location_attribute_metadata)
? LocationAttributeMetadata.fromJSON(object.location_attribute_metadata)
: undefined,
user_interest_attribute_metadata: isSet(object.user_interest_attribute_metadata)
? UserInterestAttributeMetadata.fromJSON(object.user_interest_attribute_metadata)
: undefined,
knowledge_graph_attribute_metadata: isSet(object.knowledge_graph_attribute_metadata)
? KnowledgeGraphAttributeMetadata.fromJSON(object.knowledge_graph_attribute_metadata)
: undefined,
user_list_attribute_metadata: isSet(object.user_list_attribute_metadata)
? UserListAttributeMetadata.fromJSON(object.user_list_attribute_metadata)
: undefined,
};
},
toJSON(message) {
const obj = {};
if (message.dimension !== undefined && message.dimension !== 0) {
obj.dimension = audienceInsightsDimensionEnum_AudienceInsightsDimensionToJSON(message.dimension);
}
if (message.attribute !== undefined) {
obj.attribute = AudienceInsightsAttribute.toJSON(message.attribute);
}
if (message.display_name !== undefined && message.display_name !== "") {
obj.display_name = message.display_name;
}
if (message.display_info !== undefined && message.display_info !== "") {
obj.display_info = message.display_info;
}
if (message.potential_youtube_reach !== undefined && message.potential_youtube_reach !== "0") {
obj.potential_youtube_reach = message.potential_youtube_reach;
}
if (message.subscriber_share !== undefined && message.subscriber_share !== 0) {
obj.subscriber_share = message.subscriber_share;
}
if (message.viewer_share !== undefined && message.viewer_share !== 0) {
obj.viewer_share = message.viewer_share;
}
if (message.youtube_channel_metadata !== undefined) {
obj.youtube_channel_metadata = YouTubeChannelAttributeMetadata.toJSON(message.youtube_channel_metadata);
}
if (message.youtube_video_metadata !== undefined) {
obj.youtube_video_metadata = YouTubeVideoAttributeMetadata.toJSON(message.youtube_video_metadata);
}
if (message.lineup_attribute_metadata !== undefined) {
obj.lineup_attribute_metadata = LineupAttributeMetadata.toJSON(message.lineup_attribute_metadata);
}
if (message.location_attribute_metadata !== undefined) {
obj.location_attribute_metadata = LocationAttributeMetadata.toJSON(message.location_attribute_metadata);
}
if (message.user_interest_attribute_metadata !== undefined) {
obj.user_interest_attribute_metadata = UserInterestAttributeMetadata.toJSON(message.user_interest_attribute_metadata);
}
if (message.knowledge_graph_attribute_metadata !== undefined) {
obj.knowledge_graph_attribute_metadata = KnowledgeGraphAttributeMetadata.toJSON(message.knowledge_graph_attribute_metadata);
}
if (message.user_list_attribute_metadata !== undefined) {
obj.user_list_attribute_metadata = UserListAttributeMetadata.toJSON(message.user_list_attribute_metadata);
}
return obj;
},
create(base) {
return AudienceInsightsAttributeMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e, _f;
const message = createBaseAudienceInsightsAttributeMetadata();
message.dimension = (_a = object.dimension) !== null && _a !== void 0 ? _a : 0;
message.attribute = (object.attribute !== undefined && object.attribute !== null)
? AudienceInsightsAttribute.fromPartial(object.attribute)
: undefined;
message.display_name = (_b = object.display_name) !== null && _b !== void 0 ? _b : "";
message.display_info = (_c = object.display_info) !== null && _c !== void 0 ? _c : "";
message.potential_youtube_reach = (_d = object.potential_youtube_reach) !== null && _d !== void 0 ? _d : "0";
message.subscriber_share = (_e = object.subscriber_share) !== null && _e !== void 0 ? _e : 0;
message.viewer_share = (_f = object.viewer_share) !== null && _f !== void 0 ? _f : 0;
message.youtube_channel_metadata =
(object.youtube_channel_metadata !== undefined && object.youtube_channel_metadata !== null)
? YouTubeChannelAttributeMetadata.fromPartial(object.youtube_channel_metadata)
: undefined;
message.youtube_video_metadata =
(object.youtube_video_metadata !== undefined && object.youtube_video_metadata !== null)
? YouTubeVideoAttributeMetadata.fromPartial(object.youtube_video_metadata)
: undefined;
message.lineup_attribute_metadata =
(object.lineup_attribute_metadata !== undefined && object.lineup_attribute_metadata !== null)
? LineupAttributeMetadata.fromPartial(object.lineup_attribute_metadata)
: undefined;
message.location_attribute_metadata =
(object.location_attribute_metadata !== undefined && object.location_attribute_metadata !== null)
? LocationAttributeMetadata.fromPartial(object.location_attribute_metadata)
: undefined;
message.user_interest_attribute_metadata =
(object.user_interest_attribute_metadata !== undefined && object.user_interest_attribute_metadata !== null)
? UserInterestAttributeMetadata.fromPartial(object.user_interest_attribute_metadata)
: undefined;
message.knowledge_graph_attribute_metadata =
(object.knowledge_graph_attribute_metadata !== undefined && object.knowledge_graph_attribute_metadata !== null)
? KnowledgeGraphAttributeMetadata.fromPartial(object.knowledge_graph_attribute_metadata)
: undefined;
message.user_list_attribute_metadata =
(object.user_list_attribute_metadata !== undefined && object.user_list_attribute_metadata !== null)
? UserListAttributeMetadata.fromPartial(object.user_list_attribute_metadata)
: undefined;
return message;
},
};
function createBaseAudienceInsightsAttribute() {
return {
age_range: undefined,
gender: undefined,
location: undefined,
user_interest: undefined,
entity: undefined,
category: undefined,
lineup: undefined,
parental_status: undefined,
income_range: undefined,
youtube_channel: undefined,
youtube_video: undefined,
device: undefined,
user_list: undefined,
};
}
export const AudienceInsightsAttribute = {
encode(message, writer = _m0.Writer.create()) {
if (message.age_range !== undefined) {
AgeRangeInfo.encode(message.age_range, writer.uint32(10).fork()).ldelim();
}
if (message.gender !== undefined) {
GenderInfo.encode(message.gender, writer.uint32(18).fork()).ldelim();
}
if (message.location !== undefined) {
LocationInfo.encode(message.location, writer.uint32(26).fork()).ldelim();
}
if (message.user_interest !== undefined) {
UserInterestInfo.encode(message.user_interest, writer.uint32(34).fork()).ldelim();
}
if (message.entity !== undefined) {
AudienceInsightsEntity.encode(message.entity, writer.uint32(42).fork()).ldelim();
}
if (message.category !== undefined) {
AudienceInsightsCategory.encode(message.category, writer.uint32(50).fork()).ldelim();
}
if (message.lineup !== undefined) {
AudienceInsightsLineup.encode(message.lineup, writer.uint32(106).fork()).ldelim();
}
if (message.parental_status !== undefined) {
ParentalStatusInfo.encode(message.parental_status, writer.uint32(66).fork()).ldelim();
}
if (message.income_range !== undefined) {
IncomeRangeInfo.encode(message.income_range, writer.uint32(74).fork()).ldelim();
}
if (message.youtube_channel !== undefined) {
YouTubeChannelInfo.encode(message.youtube_channel, writer.uint32(82).fork()).ldelim();
}
if (message.youtube_video !== undefined) {
YouTubeVideoInfo.encode(message.youtube_video, writer.uint32(90).fork()).ldelim();
}
if (message.device !== undefined) {
DeviceInfo.encode(message.device, writer.uint32(98).fork()).ldelim();
}
if (message.user_list !== undefined) {
UserListInfo.encode(message.user_list, writer.uint32(114).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAudienceInsightsAttribute();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.age_range = AgeRangeInfo.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.gender = GenderInfo.decode(reader, reader.uint32());
continue;
case 3:
if (tag !== 26) {
break;
}
message.location = LocationInfo.decode(reader, reader.uint32());
continue;
case 4:
if (tag !== 34) {
break;
}
message.user_interest = UserInterestInfo.decode(reader, reader.uint32());
continue;
case 5:
if (tag !== 42) {
break;
}
message.entity = AudienceInsightsEntity.decode(reader, reader.uint32());
continue;
case 6:
if (tag !== 50) {
break;
}
message.category = AudienceInsightsCategory.decode(reader, reader.uint32());
continue;
case 13:
if (tag !== 106) {
break;
}
message.lineup = AudienceInsightsLineup.decode(reader, reader.uint32());
continue;
case 8:
if (tag !== 66) {
break;
}
message.parental_status = ParentalStatusInfo.decode(reader, reader.uint32());
continue;
case 9:
if (tag !== 74) {
break;
}
message.income_range = IncomeRangeInfo.decode(reader, reader.uint32());
continue;
case 10:
if (tag !== 82) {
break;
}
message.youtube_channel = YouTubeChannelInfo.decode(reader, reader.uint32());
continue;
case 11:
if (tag !== 90) {
break;
}
message.youtube_video = YouTubeVideoInfo.decode(reader, reader.uint32());
continue;
case 12:
if (tag !== 98) {
break;
}
message.device = DeviceInfo.decode(reader, reader.uint32());
continue;
case 14:
if (tag !== 114) {
break;
}
message.user_list = UserListInfo.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
age_range: isSet(object.age_range) ? AgeRangeInfo.fromJSON(object.age_range) : undefined,
gender: isSet(object.gender) ? GenderInfo.fromJSON(object.gender) : undefined,
location: isSet(object.location) ? LocationInfo.fromJSON(object.location) : undefined,
user_interest: isSet(object.user_interest) ? UserInterestInfo.fromJSON(object.user_interest) : undefined,
entity: isSet(object.entity) ? AudienceInsightsEntity.fromJSON(object.entity) : undefined,
category: isSet(object.category) ? AudienceInsightsCategory.fromJSON(object.category) : undefined,
lineup: isSet(object.lineup) ? AudienceInsightsLineup.fromJSON(object.lineup) : undefined,
parental_status: isSet(object.parental_status) ? ParentalStatusInfo.fromJSON(object.parental_status) : undefined,
income_range: isSet(object.income_range) ? IncomeRangeInfo.fromJSON(object.income_range) : undefined,
youtube_channel: isSet(object.youtube_channel) ? YouTubeChannelInfo.fromJSON(object.youtube_channel) : undefined,
youtube_video: isSet(object.youtube_video) ? YouTubeVideoInfo.fromJSON(object.youtube_video) : undefined,
device: isSet(object.device) ? DeviceInfo.fromJSON(object.device) : undefined,
user_list: isSet(object.user_list) ? UserListInfo.fromJSON(object.user_list) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.age_range !== undefined) {
obj.age_range = AgeRangeInfo.toJSON(message.age_range);
}
if (message.gender !== undefined) {
obj.gender = GenderInfo.toJSON(message.gender);
}
if (message.location !== undefined) {
obj.location = LocationInfo.toJSON(message.location);
}
if (message.user_interest !== undefined) {
obj.user_interest = UserInterestInfo.toJSON(message.user_interest);
}
if (message.entity !== undefined) {
obj.entity = AudienceInsightsEntity.toJSON(message.entity);
}
if (message.category !== undefined) {
obj.category = AudienceInsightsCategory.toJSON(message.category);
}
if (message.lineup !== undefined) {
obj.lineup = AudienceInsightsLineup.toJSON(message.lineup);
}
if (message.parental_status !== undefined) {
obj.parental_status = ParentalStatusInfo.toJSON(message.parental_status);
}
if (message.income_range !== undefined) {
obj.income_range = IncomeRangeInfo.toJSON(message.income_range);
}
if (message.youtube_channel !== undefined) {
obj.youtube_channel = YouTubeChannelInfo.toJSON(message.youtube_channel);
}
if (message.youtube_video !== undefined) {
obj.youtube_video = YouTubeVideoInfo.toJSON(message.youtube_video);
}
if (message.device !== undefined) {
obj.device = DeviceInfo.toJSON(message.device);
}
if (message.user_list !== undefined) {
obj.user_list = UserListInfo.toJSON(message.user_list);
}
return obj;
},
create(base) {
return AudienceInsightsAttribute.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseAudienceInsightsAttribute();
message.age_range = (object.age_range !== undefined && object.age_range !== null)
? AgeRangeInfo.fromPartial(object.age_range)
: undefined;
message.gender = (object.gender !== undefined && object.gender !== null)
? GenderInfo.fromPartial(object.gender)
: undefined;
message.location = (object.location !== undefined && object.location !== null)
? LocationInfo.fromPartial(object.location)
: undefined;
message.user_interest = (object.user_interest !== undefined && object.user_interest !== null)
? UserInterestInfo.fromPartial(object.user_interest)
: undefined;
message.entity = (object.entity !== undefined && object.entity !== null)
? AudienceInsightsEntity.fromPartial(object.entity)
: undefined;
message.category = (object.category !== undefined && object.category !== null)
? AudienceInsightsCategory.fromPartial(object.category)
: undefined;
message.lineup = (object.lineup !== undefined && object.lineup !== null)
? AudienceInsightsLineup.fromPartial(object.lineup)
: undefined;
message.parental_status = (object.parental_status !== undefined && object.parental_status !== null)
? ParentalStatusInfo.fromPartial(object.parental_status)
: undefined;
message.income_range = (object.income_range !== undefined && object.income_range !== null)
? IncomeRangeInfo.fromPartial(object.income_range)
: undefined;
message.youtube_channel = (object.youtube_channel !== undefined && object.youtube_channel !== null)
? YouTubeChannelInfo.fromPartial(object.youtube_channel)
: undefined;
message.youtube_video = (object.youtube_video !== undefined && object.youtube_video !== null)
? YouTubeVideoInfo.fromPartial(object.youtube_video)
: undefined;
message.device = (object.device !== undefined && object.device !== null)
? DeviceInfo.fromPartial(object.device)
: undefined;
message.user_list = (object.user_list !== undefined && object.user_list !== null)
? UserListInfo.fromPartial(object.user_list)
: undefined;
return message;
},
};
function createBaseAudienceInsightsTopic() {
return { entity: undefined, category: undefined };
}
export const AudienceInsightsTopic = {
encode(message, writer = _m0.Writer.create()) {
if (message.entity !== undefined) {
AudienceInsightsEntity.encode(message.entity, writer.uint32(10).fork()).ldelim();
}
if (message.category !== undefined) {
AudienceInsightsCategory.encode(message.category, 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 = createBaseAudienceInsightsTopic();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.entity = AudienceInsightsEntity.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 18) {
break;
}
message.category = AudienceInsightsCategory.decode(reader, reader.uint32());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
entity: isSet(object.entity) ? AudienceInsightsEntity.fromJSON(object.entity) : undefined,
category: isSet(object.category) ? AudienceInsightsCategory.fromJSON(object.category) : undefined,
};
},
toJSON(message) {
const obj = {};
if (message.entity !== undefined) {
obj.entity = AudienceInsightsEntity.toJSON(message.entity);
}
if (message.category !== undefined) {
obj.category = AudienceInsightsCategory.toJSON(message.category);
}
return obj;
},
create(base) {
return AudienceInsightsTopic.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
const message = createBaseAudienceInsightsTopic();
message.entity = (object.entity !== undefined && object.entity !== null)
? AudienceInsightsEntity.fromPartial(object.entity)
: undefined;
message.category = (object.category !== undefined && object.category !== null)
? AudienceInsightsCategory.fromPartial(object.category)
: undefined;
return message;
},
};
function createBaseAudienceInsightsEntity() {
return { knowledge_graph_machine_id: "" };
}
export const AudienceInsightsEntity = {
encode(message, writer = _m0.Writer.create()) {
if (message.knowledge_graph_machine_id !== undefined && message.knowledge_graph_machine_id !== "") {
writer.uint32(10).string(message.knowledge_graph_machine_id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAudienceInsightsEntity();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.knowledge_graph_machine_id = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
knowledge_graph_machine_id: isSet(object.knowledge_graph_machine_id)
? globalThis.String(object.knowledge_graph_machine_id)
: "",
};
},
toJSON(message) {
const obj = {};
if (message.knowledge_graph_machine_id !== undefined && message.knowledge_graph_machine_id !== "") {
obj.knowledge_graph_machine_id = message.knowledge_graph_machine_id;
}
return obj;
},
create(base) {
return AudienceInsightsEntity.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseAudienceInsightsEntity();
message.knowledge_graph_machine_id = (_a = object.knowledge_graph_machine_id) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseAudienceInsightsCategory() {
return { category_id: "" };
}
export const AudienceInsightsCategory = {
encode(message, writer = _m0.Writer.create()) {
if (message.category_id !== undefined && message.category_id !== "") {
writer.uint32(10).string(message.category_id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAudienceInsightsCategory();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.category_id = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { category_id: isSet(object.category_id) ? globalThis.String(object.category_id) : "" };
},
toJSON(message) {
const obj = {};
if (message.category_id !== undefined && message.category_id !== "") {
obj.category_id = message.category_id;
}
return obj;
},
create(base) {
return AudienceInsightsCategory.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseAudienceInsightsCategory();
message.category_id = (_a = object.category_id) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseAudienceInsightsLineup() {
return { lineup_id: "" };
}
export const AudienceInsightsLineup = {
encode(message, writer = _m0.Writer.create()) {
if (message.lineup_id !== undefined && message.lineup_id !== "") {
writer.uint32(10).string(message.lineup_id);
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseAudienceInsightsLineup();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.lineup_id = reader.string();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { lineup_id: isSet(object.lineup_id) ? globalThis.String(object.lineup_id) : "" };
},
toJSON(message) {
const obj = {};
if (message.lineup_id !== undefined && message.lineup_id !== "") {
obj.lineup_id = message.lineup_id;
}
return obj;
},
create(base) {
return AudienceInsightsLineup.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseAudienceInsightsLineup();
message.lineup_id = (_a = object.lineup_id) !== null && _a !== void 0 ? _a : "";
return message;
},
};
function createBaseYouTubeChannelAttributeMetadata() {
return { subscriber_count: "0" };
}
export const YouTubeChannelAttributeMetadata = {
encode(message, writer = _m0.Writer.create()) {
if (message.subscriber_count !== undefined && message.subscriber_count !== "0") {
writer.uint32(8).int64(message.subscriber_count);
}
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 = createBaseYouTubeChannelAttributeMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 8) {
break;
}
message.subscriber_count = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return { subscriber_count: isSet(object.subscriber_count) ? globalThis.String(object.subscriber_count) : "0" };
},
toJSON(message) {
const obj = {};
if (message.subscriber_count !== undefined && message.subscriber_count !== "0") {
obj.subscriber_count = message.subscriber_count;
}
return obj;
},
create(base) {
return YouTubeChannelAttributeMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a;
const message = createBaseYouTubeChannelAttributeMetadata();
message.subscriber_count = (_a = object.subscriber_count) !== null && _a !== void 0 ? _a : "0";
return message;
},
};
function createBaseYouTubeVideoAttributeMetadata() {
return { thumbnail_url: "", video_url: "", views_count: "0", likes_count: "0", comments_count: "0" };
}
export const YouTubeVideoAttributeMetadata = {
encode(message, writer = _m0.Writer.create()) {
if (message.thumbnail_url !== undefined && message.thumbnail_url !== "") {
writer.uint32(10).string(message.thumbnail_url);
}
if (message.video_url !== undefined && message.video_url !== "") {
writer.uint32(18).string(message.video_url);
}
if (message.views_count !== undefined && message.views_count !== "0") {
writer.uint32(24).int64(message.views_count);
}
if (message.likes_count !== undefined && message.likes_count !== "0") {
writer.uint32(32).int64(message.likes_count);
}
if (message.comments_count !== undefined && message.comments_count !== "0") {
writer.uint32(40).int64(message.comments_count);
}
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 = createBaseYouTubeVideoAttributeMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.thumbnail_url = reader.string();
continue;
case 2:
if (tag !== 18) {
break;
}
message.video_url = reader.string();
continue;
case 3:
if (tag !== 24) {
break;
}
message.views_count = longToString(reader.int64());
continue;
case 4:
if (tag !== 32) {
break;
}
message.likes_count = longToString(reader.int64());
continue;
case 5:
if (tag !== 40) {
break;
}
message.comments_count = longToString(reader.int64());
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
thumbnail_url: isSet(object.thumbnail_url) ? globalThis.String(object.thumbnail_url) : "",
video_url: isSet(object.video_url) ? globalThis.String(object.video_url) : "",
views_count: isSet(object.views_count) ? globalThis.String(object.views_count) : "0",
likes_count: isSet(object.likes_count) ? globalThis.String(object.likes_count) : "0",
comments_count: isSet(object.comments_count) ? globalThis.String(object.comments_count) : "0",
};
},
toJSON(message) {
const obj = {};
if (message.thumbnail_url !== undefined && message.thumbnail_url !== "") {
obj.thumbnail_url = message.thumbnail_url;
}
if (message.video_url !== undefined && message.video_url !== "") {
obj.video_url = message.video_url;
}
if (message.views_count !== undefined && message.views_count !== "0") {
obj.views_count = message.views_count;
}
if (message.likes_count !== undefined && message.likes_count !== "0") {
obj.likes_count = message.likes_count;
}
if (message.comments_count !== undefined && message.comments_count !== "0") {
obj.comments_count = message.comments_count;
}
return obj;
},
create(base) {
return YouTubeVideoAttributeMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d, _e;
const message = createBaseYouTubeVideoAttributeMetadata();
message.thumbnail_url = (_a = object.thumbnail_url) !== null && _a !== void 0 ? _a : "";
message.video_url = (_b = object.video_url) !== null && _b !== void 0 ? _b : "";
message.views_count = (_c = object.views_count) !== null && _c !== void 0 ? _c : "0";
message.likes_count = (_d = object.likes_count) !== null && _d !== void 0 ? _d : "0";
message.comments_count = (_e = object.comments_count) !== null && _e !== void 0 ? _e : "0";
return message;
},
};
function createBaseLineupAttributeMetadata() {
return {
inventory_country: undefined,
median_monthly_inventory: undefined,
channel_count_lower_bound: undefined,
channel_count_upper_bound: undefined,
sample_channels: [],
};
}
export const LineupAttributeMetadata = {
encode(message, writer = _m0.Writer.create()) {
if (message.inventory_country !== undefined) {
LocationInfo.encode(message.inventory_country, writer.uint32(10).fork()).ldelim();
}
if (message.median_monthly_inventory !== undefined) {
writer.uint32(16).int64(message.median_monthly_inventory);
}
if (message.channel_count_lower_bound !== undefined) {
writer.uint32(24).int64(message.channel_count_lower_bound);
}
if (message.channel_count_upper_bound !== undefined) {
writer.uint32(32).int64(message.channel_count_upper_bound);
}
if (message.sample_channels !== undefined && message.sample_channels.length !== 0) {
for (const v of message.sample_channels) {
LineupAttributeMetadata_SampleChannel.encode(v, writer.uint32(42).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 = createBaseLineupAttributeMetadata();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (tag !== 10) {
break;
}
message.inventory_country = LocationInfo.decode(reader, reader.uint32());
continue;
case 2:
if (tag !== 16) {
break;
}
message.median_monthly_inventory = longToString(reader.int64());
continue;
case 3:
if (tag !== 24) {
break;
}
message.channel_count_lower_bound = longToString(reader.int64());
continue;
case 4:
if (tag !== 32) {
break;
}
message.channel_count_upper_bound = longToString(reader.int64());
continue;
case 5:
if (tag !== 42) {
break;
}
message.sample_channels.push(LineupAttributeMetadata_SampleChannel.decode(reader, reader.uint32()));
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
}
reader.skipType(tag & 7);
}
return message;
},
fromJSON(object) {
return {
inventory_country: isSet(object.inventory_country) ? LocationInfo.fromJSON(object.inventory_country) : undefined,
median_monthly_inventory: isSet(object.median_monthly_inventory)
? globalThis.String(object.median_monthly_inventory)
: undefined,
channel_count_lower_bound: isSet(object.channel_count_lower_bound)
? globalThis.String(object.channel_count_lower_bound)
: undefined,
channel_count_upper_bound: isSet(object.channel_count_upper_bound)
? globalThis.String(object.channel_count_upper_bound)
: undefined,
sample_channels: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sample_channels)
? object.sample_channels.map((e) => LineupAttributeMetadata_SampleChannel.fromJSON(e))
: [],
};
},
toJSON(message) {
var _a;
const obj = {};
if (message.inventory_country !== undefined) {
obj.inventory_country = LocationInfo.toJSON(message.inventory_country);
}
if (message.median_monthly_inventory !== undefined) {
obj.median_monthly_inventory = message.median_monthly_inventory;
}
if (message.channel_count_lower_bound !== undefined) {
obj.channel_count_lower_bound = message.channel_count_lower_bound;
}
if (message.channel_count_upper_bound !== undefined) {
obj.channel_count_upper_bound = message.channel_count_upper_bound;
}
if ((_a = message.sample_channels) === null || _a === void 0 ? void 0 : _a.length) {
obj.sample_channels = message.sample_channels.map((e) => LineupAttributeMetadata_SampleChannel.toJSON(e));
}
return obj;
},
create(base) {
return LineupAttributeMetadata.fromPartial(base !== null && base !== void 0 ? base : {});
},
fromPartial(object) {
var _a, _b, _c, _d;
const message = createBaseLineupAttributeMetadata();
message.inventory_country = (object.inventory_country !== undefined && object.inventory_country !== null)
? LocationInfo.fromPartial(object.inventory_country)
: undefined;
message.median_monthly_inventory = (_a = object.median_monthly_inventory) !== null && _a !== void 0 ? _a : undefined;
message.channel_count_lower_bound = (_b = object.channel_count_lower_bound) !== null && _b !== void 0 ? _b : undefined;
message.channel_count_upper_bound = (_c = object.channel_count_upper_bound) !== null && _c !== void 0 ? _c : undefined;
message.sample_channels =
((_d = object.sample_channels) === null || _d === void 0 ? void 0 : _d.map((e) => LineupAttributeMetadata_SampleChannel.fromPartial(e))) || [];
return message;
},
};
function createBaseLineupAttributeMetadata_SampleChannel() {
return { youtube_channel: undefined, display_name: "", youtube_channel_metadata: undefined };
}
export const LineupAttributeMetadata_SampleChannel = {
encode(message, writer = _m0.Writer.create()) {
if (message.youtube_channel !== undefined) {
YouTubeChannelInfo.encode(message.youtube_channel, writer.uint32(10).fork()).ldelim();
}
if (message.display_name !== undefined && message.display_name !== "") {
writer.uint32(18).string(message.display_name);
}
if (message.youtube_channel_metadata !== undefined) {
YouTubeChannelAttributeMetadata.encode(message.youtube_channel_metadata, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input, length) {
const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
let