UNPKG

@htdangkhoa/google-ads

Version:
244 lines (243 loc) 10.8 kB
// 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/v19/resources/shared_criterion.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; import { BrandInfo, KeywordInfo, MobileAppCategoryInfo, MobileApplicationInfo, PlacementInfo, YouTubeChannelInfo, YouTubeVideoInfo, } from "../common/criteria.js"; import { criterionTypeEnum_CriterionTypeFromJSON, criterionTypeEnum_CriterionTypeToJSON, } from "../enums/criterion_type.js"; function createBaseSharedCriterion() { return { resource_name: "", shared_set: undefined, criterion_id: undefined, type: 0, keyword: undefined, youtube_video: undefined, youtube_channel: undefined, placement: undefined, mobile_app_category: undefined, mobile_application: undefined, brand: undefined, }; } export const SharedCriterion = { encode(message, writer = _m0.Writer.create()) { if (message.resource_name !== undefined && message.resource_name !== "") { writer.uint32(10).string(message.resource_name); } if (message.shared_set !== undefined) { writer.uint32(82).string(message.shared_set); } if (message.criterion_id !== undefined) { writer.uint32(88).int64(message.criterion_id); } if (message.type !== undefined && message.type !== 0) { writer.uint32(32).int32(message.type); } if (message.keyword !== undefined) { KeywordInfo.encode(message.keyword, writer.uint32(26).fork()).ldelim(); } if (message.youtube_video !== undefined) { YouTubeVideoInfo.encode(message.youtube_video, writer.uint32(42).fork()).ldelim(); } if (message.youtube_channel !== undefined) { YouTubeChannelInfo.encode(message.youtube_channel, writer.uint32(50).fork()).ldelim(); } if (message.placement !== undefined) { PlacementInfo.encode(message.placement, writer.uint32(58).fork()).ldelim(); } if (message.mobile_app_category !== undefined) { MobileAppCategoryInfo.encode(message.mobile_app_category, writer.uint32(66).fork()).ldelim(); } if (message.mobile_application !== undefined) { MobileApplicationInfo.encode(message.mobile_application, writer.uint32(74).fork()).ldelim(); } if (message.brand !== undefined) { BrandInfo.encode(message.brand, writer.uint32(98).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 = createBaseSharedCriterion(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 10: if (tag !== 82) { break; } message.shared_set = reader.string(); continue; case 11: if (tag !== 88) { break; } message.criterion_id = longToString(reader.int64()); continue; case 4: if (tag !== 32) { break; } message.type = reader.int32(); continue; case 3: if (tag !== 26) { break; } message.keyword = KeywordInfo.decode(reader, reader.uint32()); continue; case 5: if (tag !== 42) { break; } message.youtube_video = YouTubeVideoInfo.decode(reader, reader.uint32()); continue; case 6: if (tag !== 50) { break; } message.youtube_channel = YouTubeChannelInfo.decode(reader, reader.uint32()); continue; case 7: if (tag !== 58) { break; } message.placement = PlacementInfo.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { break; } message.mobile_app_category = MobileAppCategoryInfo.decode(reader, reader.uint32()); continue; case 9: if (tag !== 74) { break; } message.mobile_application = MobileApplicationInfo.decode(reader, reader.uint32()); continue; case 12: if (tag !== 98) { break; } message.brand = BrandInfo.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { resource_name: isSet(object.resource_name) ? globalThis.String(object.resource_name) : "", shared_set: isSet(object.shared_set) ? globalThis.String(object.shared_set) : undefined, criterion_id: isSet(object.criterion_id) ? globalThis.String(object.criterion_id) : undefined, type: isSet(object.type) ? criterionTypeEnum_CriterionTypeFromJSON(object.type) : 0, keyword: isSet(object.keyword) ? KeywordInfo.fromJSON(object.keyword) : undefined, youtube_video: isSet(object.youtube_video) ? YouTubeVideoInfo.fromJSON(object.youtube_video) : undefined, youtube_channel: isSet(object.youtube_channel) ? YouTubeChannelInfo.fromJSON(object.youtube_channel) : undefined, placement: isSet(object.placement) ? PlacementInfo.fromJSON(object.placement) : undefined, mobile_app_category: isSet(object.mobile_app_category) ? MobileAppCategoryInfo.fromJSON(object.mobile_app_category) : undefined, mobile_application: isSet(object.mobile_application) ? MobileApplicationInfo.fromJSON(object.mobile_application) : undefined, brand: isSet(object.brand) ? BrandInfo.fromJSON(object.brand) : undefined, }; }, toJSON(message) { const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.shared_set !== undefined) { obj.shared_set = message.shared_set; } if (message.criterion_id !== undefined) { obj.criterion_id = message.criterion_id; } if (message.type !== undefined && message.type !== 0) { obj.type = criterionTypeEnum_CriterionTypeToJSON(message.type); } if (message.keyword !== undefined) { obj.keyword = KeywordInfo.toJSON(message.keyword); } if (message.youtube_video !== undefined) { obj.youtube_video = YouTubeVideoInfo.toJSON(message.youtube_video); } if (message.youtube_channel !== undefined) { obj.youtube_channel = YouTubeChannelInfo.toJSON(message.youtube_channel); } if (message.placement !== undefined) { obj.placement = PlacementInfo.toJSON(message.placement); } if (message.mobile_app_category !== undefined) { obj.mobile_app_category = MobileAppCategoryInfo.toJSON(message.mobile_app_category); } if (message.mobile_application !== undefined) { obj.mobile_application = MobileApplicationInfo.toJSON(message.mobile_application); } if (message.brand !== undefined) { obj.brand = BrandInfo.toJSON(message.brand); } return obj; }, create(base) { return SharedCriterion.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseSharedCriterion(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.shared_set = (_b = object.shared_set) !== null && _b !== void 0 ? _b : undefined; message.criterion_id = (_c = object.criterion_id) !== null && _c !== void 0 ? _c : undefined; message.type = (_d = object.type) !== null && _d !== void 0 ? _d : 0; message.keyword = (object.keyword !== undefined && object.keyword !== null) ? KeywordInfo.fromPartial(object.keyword) : undefined; message.youtube_video = (object.youtube_video !== undefined && object.youtube_video !== null) ? YouTubeVideoInfo.fromPartial(object.youtube_video) : undefined; message.youtube_channel = (object.youtube_channel !== undefined && object.youtube_channel !== null) ? YouTubeChannelInfo.fromPartial(object.youtube_channel) : undefined; message.placement = (object.placement !== undefined && object.placement !== null) ? PlacementInfo.fromPartial(object.placement) : undefined; message.mobile_app_category = (object.mobile_app_category !== undefined && object.mobile_app_category !== null) ? MobileAppCategoryInfo.fromPartial(object.mobile_app_category) : undefined; message.mobile_application = (object.mobile_application !== undefined && object.mobile_application !== null) ? MobileApplicationInfo.fromPartial(object.mobile_application) : undefined; message.brand = (object.brand !== undefined && object.brand !== null) ? BrandInfo.fromPartial(object.brand) : undefined; return message; }, }; function longToString(long) { return long.toString(); } if (_m0.util.Long !== Long) { _m0.util.Long = Long; _m0.configure(); } function isSet(value) { return value !== null && value !== undefined; }