UNPKG

google-ads-api-client

Version:

A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.

144 lines 10.3 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SharedCriterion = void 0; const runtime_1 = require("@protobuf-ts/runtime"); const runtime_2 = require("@protobuf-ts/runtime"); const runtime_3 = require("@protobuf-ts/runtime"); const runtime_4 = require("@protobuf-ts/runtime"); const runtime_5 = require("@protobuf-ts/runtime"); const criteria_1 = require("../common/criteria"); const criteria_2 = require("../common/criteria"); const criteria_3 = require("../common/criteria"); const criteria_4 = require("../common/criteria"); const criteria_5 = require("../common/criteria"); const criteria_6 = require("../common/criteria"); const criterion_type_1 = require("../enums/criterion_type"); // @generated message type with reflection information, may provide speed optimized methods class SharedCriterion$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.SharedCriterion", [ { no: 1, name: "resource_name", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["IMMUTABLE"], "google.api.resource_reference": { type: "googleads.googleapis.com/SharedCriterion" } } }, { no: 10, name: "shared_set", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["IMMUTABLE"], "google.api.resource_reference": { type: "googleads.googleapis.com/SharedSet" } } }, { no: 11, name: "criterion_id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 4, name: "type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.CriterionTypeEnum.CriterionType", criterion_type_1.CriterionTypeEnum_CriterionType], options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 3, name: "keyword", kind: "message", oneof: "criterion", T: () => criteria_6.KeywordInfo, options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 5, name: "youtube_video", kind: "message", oneof: "criterion", T: () => criteria_5.YouTubeVideoInfo, options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 6, name: "youtube_channel", kind: "message", oneof: "criterion", T: () => criteria_4.YouTubeChannelInfo, options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 7, name: "placement", kind: "message", oneof: "criterion", T: () => criteria_3.PlacementInfo, options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 8, name: "mobile_app_category", kind: "message", oneof: "criterion", T: () => criteria_2.MobileAppCategoryInfo, options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 9, name: "mobile_application", kind: "message", oneof: "criterion", T: () => criteria_1.MobileApplicationInfo, options: { "google.api.field_behavior": ["IMMUTABLE"] } } ], { "google.api.resource": { type: "googleads.googleapis.com/SharedCriterion", pattern: ["customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}"] } }); } create(value) { const message = { resourceName: "", type: 0, criterion: { oneofKind: undefined } }; globalThis.Object.defineProperty(message, runtime_4.MESSAGE_TYPE, { enumerable: false, value: this }); if (value !== undefined) (0, runtime_3.reflectionMergePartial)(this, message, value); return message; } internalBinaryRead(reader, length, options, target) { let message = target ?? this.create(), end = reader.pos + length; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case /* string resource_name */ 1: message.resourceName = reader.string(); break; case /* optional string shared_set */ 10: message.sharedSet = reader.string(); break; case /* optional int64 criterion_id */ 11: message.criterionId = reader.int64().toBigInt(); break; case /* google.ads.googleads.v11.enums.CriterionTypeEnum.CriterionType type */ 4: message.type = reader.int32(); break; case /* google.ads.googleads.v11.common.KeywordInfo keyword */ 3: message.criterion = { oneofKind: "keyword", keyword: criteria_6.KeywordInfo.internalBinaryRead(reader, reader.uint32(), options, message.criterion.keyword) }; break; case /* google.ads.googleads.v11.common.YouTubeVideoInfo youtube_video */ 5: message.criterion = { oneofKind: "youtubeVideo", youtubeVideo: criteria_5.YouTubeVideoInfo.internalBinaryRead(reader, reader.uint32(), options, message.criterion.youtubeVideo) }; break; case /* google.ads.googleads.v11.common.YouTubeChannelInfo youtube_channel */ 6: message.criterion = { oneofKind: "youtubeChannel", youtubeChannel: criteria_4.YouTubeChannelInfo.internalBinaryRead(reader, reader.uint32(), options, message.criterion.youtubeChannel) }; break; case /* google.ads.googleads.v11.common.PlacementInfo placement */ 7: message.criterion = { oneofKind: "placement", placement: criteria_3.PlacementInfo.internalBinaryRead(reader, reader.uint32(), options, message.criterion.placement) }; break; case /* google.ads.googleads.v11.common.MobileAppCategoryInfo mobile_app_category */ 8: message.criterion = { oneofKind: "mobileAppCategory", mobileAppCategory: criteria_2.MobileAppCategoryInfo.internalBinaryRead(reader, reader.uint32(), options, message.criterion.mobileAppCategory) }; break; case /* google.ads.googleads.v11.common.MobileApplicationInfo mobile_application */ 9: message.criterion = { oneofKind: "mobileApplication", mobileApplication: criteria_1.MobileApplicationInfo.internalBinaryRead(reader, reader.uint32(), options, message.criterion.mobileApplication) }; break; default: let u = options.readUnknownField; if (u === "throw") throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); let d = reader.skip(wireType); if (u !== false) (u === true ? runtime_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* string resource_name = 1; */ if (message.resourceName !== "") writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.resourceName); /* optional string shared_set = 10; */ if (message.sharedSet !== undefined) writer.tag(10, runtime_1.WireType.LengthDelimited).string(message.sharedSet); /* optional int64 criterion_id = 11; */ if (message.criterionId !== undefined) writer.tag(11, runtime_1.WireType.Varint).int64(message.criterionId); /* google.ads.googleads.v11.enums.CriterionTypeEnum.CriterionType type = 4; */ if (message.type !== 0) writer.tag(4, runtime_1.WireType.Varint).int32(message.type); /* google.ads.googleads.v11.common.KeywordInfo keyword = 3; */ if (message.criterion.oneofKind === "keyword") criteria_6.KeywordInfo.internalBinaryWrite(message.criterion.keyword, writer.tag(3, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.common.YouTubeVideoInfo youtube_video = 5; */ if (message.criterion.oneofKind === "youtubeVideo") criteria_5.YouTubeVideoInfo.internalBinaryWrite(message.criterion.youtubeVideo, writer.tag(5, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.common.YouTubeChannelInfo youtube_channel = 6; */ if (message.criterion.oneofKind === "youtubeChannel") criteria_4.YouTubeChannelInfo.internalBinaryWrite(message.criterion.youtubeChannel, writer.tag(6, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.common.PlacementInfo placement = 7; */ if (message.criterion.oneofKind === "placement") criteria_3.PlacementInfo.internalBinaryWrite(message.criterion.placement, writer.tag(7, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.common.MobileAppCategoryInfo mobile_app_category = 8; */ if (message.criterion.oneofKind === "mobileAppCategory") criteria_2.MobileAppCategoryInfo.internalBinaryWrite(message.criterion.mobileAppCategory, writer.tag(8, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.common.MobileApplicationInfo mobile_application = 9; */ if (message.criterion.oneofKind === "mobileApplication") criteria_1.MobileApplicationInfo.internalBinaryWrite(message.criterion.mobileApplication, writer.tag(9, runtime_1.WireType.LengthDelimited).fork(), options).join(); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_2.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message google.ads.googleads.v11.resources.SharedCriterion */ exports.SharedCriterion = new SharedCriterion$Type(); //# sourceMappingURL=shared_criterion.js.map