UNPKG

@htdangkhoa/google-ads

Version:
250 lines (249 loc) 11.6 kB
"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/v19/resources/shared_criterion.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.SharedCriterion = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_js_1 = __importDefault(require("protobufjs/minimal.js")); const criteria_js_1 = require("../common/criteria.js"); const criterion_type_js_1 = require("../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, }; } exports.SharedCriterion = { encode(message, writer = minimal_js_1.default.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) { criteria_js_1.KeywordInfo.encode(message.keyword, writer.uint32(26).fork()).ldelim(); } if (message.youtube_video !== undefined) { criteria_js_1.YouTubeVideoInfo.encode(message.youtube_video, writer.uint32(42).fork()).ldelim(); } if (message.youtube_channel !== undefined) { criteria_js_1.YouTubeChannelInfo.encode(message.youtube_channel, writer.uint32(50).fork()).ldelim(); } if (message.placement !== undefined) { criteria_js_1.PlacementInfo.encode(message.placement, writer.uint32(58).fork()).ldelim(); } if (message.mobile_app_category !== undefined) { criteria_js_1.MobileAppCategoryInfo.encode(message.mobile_app_category, writer.uint32(66).fork()).ldelim(); } if (message.mobile_application !== undefined) { criteria_js_1.MobileApplicationInfo.encode(message.mobile_application, writer.uint32(74).fork()).ldelim(); } if (message.brand !== undefined) { criteria_js_1.BrandInfo.encode(message.brand, writer.uint32(98).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 = 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 = criteria_js_1.KeywordInfo.decode(reader, reader.uint32()); continue; case 5: if (tag !== 42) { break; } message.youtube_video = criteria_js_1.YouTubeVideoInfo.decode(reader, reader.uint32()); continue; case 6: if (tag !== 50) { break; } message.youtube_channel = criteria_js_1.YouTubeChannelInfo.decode(reader, reader.uint32()); continue; case 7: if (tag !== 58) { break; } message.placement = criteria_js_1.PlacementInfo.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { break; } message.mobile_app_category = criteria_js_1.MobileAppCategoryInfo.decode(reader, reader.uint32()); continue; case 9: if (tag !== 74) { break; } message.mobile_application = criteria_js_1.MobileApplicationInfo.decode(reader, reader.uint32()); continue; case 12: if (tag !== 98) { break; } message.brand = criteria_js_1.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) ? (0, criterion_type_js_1.criterionTypeEnum_CriterionTypeFromJSON)(object.type) : 0, keyword: isSet(object.keyword) ? criteria_js_1.KeywordInfo.fromJSON(object.keyword) : undefined, youtube_video: isSet(object.youtube_video) ? criteria_js_1.YouTubeVideoInfo.fromJSON(object.youtube_video) : undefined, youtube_channel: isSet(object.youtube_channel) ? criteria_js_1.YouTubeChannelInfo.fromJSON(object.youtube_channel) : undefined, placement: isSet(object.placement) ? criteria_js_1.PlacementInfo.fromJSON(object.placement) : undefined, mobile_app_category: isSet(object.mobile_app_category) ? criteria_js_1.MobileAppCategoryInfo.fromJSON(object.mobile_app_category) : undefined, mobile_application: isSet(object.mobile_application) ? criteria_js_1.MobileApplicationInfo.fromJSON(object.mobile_application) : undefined, brand: isSet(object.brand) ? criteria_js_1.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 = (0, criterion_type_js_1.criterionTypeEnum_CriterionTypeToJSON)(message.type); } if (message.keyword !== undefined) { obj.keyword = criteria_js_1.KeywordInfo.toJSON(message.keyword); } if (message.youtube_video !== undefined) { obj.youtube_video = criteria_js_1.YouTubeVideoInfo.toJSON(message.youtube_video); } if (message.youtube_channel !== undefined) { obj.youtube_channel = criteria_js_1.YouTubeChannelInfo.toJSON(message.youtube_channel); } if (message.placement !== undefined) { obj.placement = criteria_js_1.PlacementInfo.toJSON(message.placement); } if (message.mobile_app_category !== undefined) { obj.mobile_app_category = criteria_js_1.MobileAppCategoryInfo.toJSON(message.mobile_app_category); } if (message.mobile_application !== undefined) { obj.mobile_application = criteria_js_1.MobileApplicationInfo.toJSON(message.mobile_application); } if (message.brand !== undefined) { obj.brand = criteria_js_1.BrandInfo.toJSON(message.brand); } return obj; }, create(base) { return exports.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) ? criteria_js_1.KeywordInfo.fromPartial(object.keyword) : undefined; message.youtube_video = (object.youtube_video !== undefined && object.youtube_video !== null) ? criteria_js_1.YouTubeVideoInfo.fromPartial(object.youtube_video) : undefined; message.youtube_channel = (object.youtube_channel !== undefined && object.youtube_channel !== null) ? criteria_js_1.YouTubeChannelInfo.fromPartial(object.youtube_channel) : undefined; message.placement = (object.placement !== undefined && object.placement !== null) ? criteria_js_1.PlacementInfo.fromPartial(object.placement) : undefined; message.mobile_app_category = (object.mobile_app_category !== undefined && object.mobile_app_category !== null) ? criteria_js_1.MobileAppCategoryInfo.fromPartial(object.mobile_app_category) : undefined; message.mobile_application = (object.mobile_application !== undefined && object.mobile_application !== null) ? criteria_js_1.MobileApplicationInfo.fromPartial(object.mobile_application) : undefined; message.brand = (object.brand !== undefined && object.brand !== null) ? criteria_js_1.BrandInfo.fromPartial(object.brand) : undefined; return message; }, }; function longToString(long) { return long.toString(); } if (minimal_js_1.default.util.Long !== long_1.default) { minimal_js_1.default.util.Long = long_1.default; minimal_js_1.default.configure(); } function isSet(value) { return value !== null && value !== undefined; }