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.

316 lines 22.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AdGroup_AudienceSetting = exports.AdGroup = 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 asset_field_type_1 = require("../enums/asset_field_type"); const bidding_source_1 = require("../enums/bidding_source"); const targeting_setting_1 = require("../common/targeting_setting"); const targeting_dimension_1 = require("../enums/targeting_dimension"); const explorer_auto_optimizer_setting_1 = require("../common/explorer_auto_optimizer_setting"); const custom_parameter_1 = require("../common/custom_parameter"); const ad_group_ad_rotation_mode_1 = require("../enums/ad_group_ad_rotation_mode"); const ad_group_type_1 = require("../enums/ad_group_type"); const ad_group_status_1 = require("../enums/ad_group_status"); // @generated message type with reflection information, may provide speed optimized methods class AdGroup$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.AdGroup", [ { 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/AdGroup" } } }, { no: 34, name: "id", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 35, name: "name", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, { no: 5, name: "status", kind: "enum", T: () => ["google.ads.googleads.v11.enums.AdGroupStatusEnum.AdGroupStatus", ad_group_status_1.AdGroupStatusEnum_AdGroupStatus] }, { no: 12, name: "type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.AdGroupTypeEnum.AdGroupType", ad_group_type_1.AdGroupTypeEnum_AdGroupType], options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 22, name: "ad_rotation_mode", kind: "enum", T: () => ["google.ads.googleads.v11.enums.AdGroupAdRotationModeEnum.AdGroupAdRotationMode", ad_group_ad_rotation_mode_1.AdGroupAdRotationModeEnum_AdGroupAdRotationMode] }, { no: 36, name: "base_ad_group", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"], "google.api.resource_reference": { type: "googleads.googleapis.com/AdGroup" } } }, { no: 37, name: "tracking_url_template", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, { no: 6, name: "url_custom_parameters", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => custom_parameter_1.CustomParameter }, { no: 38, name: "campaign", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["IMMUTABLE"], "google.api.resource_reference": { type: "googleads.googleapis.com/Campaign" } } }, { no: 39, name: "cpc_bid_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 57, name: "effective_cpc_bid_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 40, name: "cpm_bid_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 41, name: "target_cpa_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 42, name: "cpv_bid_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 43, name: "target_cpm_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 44, name: "target_roas", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/ }, { no: 45, name: "percent_cpc_bid_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 21, name: "explorer_auto_optimizer_setting", kind: "message", T: () => explorer_auto_optimizer_setting_1.ExplorerAutoOptimizerSetting }, { no: 23, name: "display_custom_bid_dimension", kind: "enum", T: () => ["google.ads.googleads.v11.enums.TargetingDimensionEnum.TargetingDimension", targeting_dimension_1.TargetingDimensionEnum_TargetingDimension] }, { no: 46, name: "final_url_suffix", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, { no: 25, name: "targeting_setting", kind: "message", T: () => targeting_setting_1.TargetingSetting }, { no: 56, name: "audience_setting", kind: "message", T: () => exports.AdGroup_AudienceSetting, options: { "google.api.field_behavior": ["IMMUTABLE"] } }, { no: 47, name: "effective_target_cpa_micros", kind: "scalar", opt: true, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 29, name: "effective_target_cpa_source", kind: "enum", T: () => ["google.ads.googleads.v11.enums.BiddingSourceEnum.BiddingSource", bidding_source_1.BiddingSourceEnum_BiddingSource], options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 48, name: "effective_target_roas", kind: "scalar", opt: true, T: 1 /*ScalarType.DOUBLE*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 32, name: "effective_target_roas_source", kind: "enum", T: () => ["google.ads.googleads.v11.enums.BiddingSourceEnum.BiddingSource", bidding_source_1.BiddingSourceEnum_BiddingSource], options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 49, name: "labels", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"], "google.api.resource_reference": { type: "googleads.googleapis.com/AdGroupLabel" } } }, { no: 54, name: "excluded_parent_asset_field_types", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["google.ads.googleads.v11.enums.AssetFieldTypeEnum.AssetFieldType", asset_field_type_1.AssetFieldTypeEnum_AssetFieldType] } ], { "google.api.resource": { type: "googleads.googleapis.com/AdGroup", pattern: ["customers/{customer_id}/adGroups/{ad_group_id}"] } }); } create(value) { const message = { resourceName: "", status: 0, type: 0, adRotationMode: 0, urlCustomParameters: [], displayCustomBidDimension: 0, effectiveTargetCpaSource: 0, effectiveTargetRoasSource: 0, labels: [], excludedParentAssetFieldTypes: [] }; 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 int64 id */ 34: message.id = reader.int64().toBigInt(); break; case /* optional string name */ 35: message.name = reader.string(); break; case /* google.ads.googleads.v11.enums.AdGroupStatusEnum.AdGroupStatus status */ 5: message.status = reader.int32(); break; case /* google.ads.googleads.v11.enums.AdGroupTypeEnum.AdGroupType type */ 12: message.type = reader.int32(); break; case /* google.ads.googleads.v11.enums.AdGroupAdRotationModeEnum.AdGroupAdRotationMode ad_rotation_mode */ 22: message.adRotationMode = reader.int32(); break; case /* optional string base_ad_group */ 36: message.baseAdGroup = reader.string(); break; case /* optional string tracking_url_template */ 37: message.trackingUrlTemplate = reader.string(); break; case /* repeated google.ads.googleads.v11.common.CustomParameter url_custom_parameters */ 6: message.urlCustomParameters.push(custom_parameter_1.CustomParameter.internalBinaryRead(reader, reader.uint32(), options)); break; case /* optional string campaign */ 38: message.campaign = reader.string(); break; case /* optional int64 cpc_bid_micros */ 39: message.cpcBidMicros = reader.int64().toBigInt(); break; case /* optional int64 effective_cpc_bid_micros */ 57: message.effectiveCpcBidMicros = reader.int64().toBigInt(); break; case /* optional int64 cpm_bid_micros */ 40: message.cpmBidMicros = reader.int64().toBigInt(); break; case /* optional int64 target_cpa_micros */ 41: message.targetCpaMicros = reader.int64().toBigInt(); break; case /* optional int64 cpv_bid_micros */ 42: message.cpvBidMicros = reader.int64().toBigInt(); break; case /* optional int64 target_cpm_micros */ 43: message.targetCpmMicros = reader.int64().toBigInt(); break; case /* optional double target_roas */ 44: message.targetRoas = reader.double(); break; case /* optional int64 percent_cpc_bid_micros */ 45: message.percentCpcBidMicros = reader.int64().toBigInt(); break; case /* google.ads.googleads.v11.common.ExplorerAutoOptimizerSetting explorer_auto_optimizer_setting */ 21: message.explorerAutoOptimizerSetting = explorer_auto_optimizer_setting_1.ExplorerAutoOptimizerSetting.internalBinaryRead(reader, reader.uint32(), options, message.explorerAutoOptimizerSetting); break; case /* google.ads.googleads.v11.enums.TargetingDimensionEnum.TargetingDimension display_custom_bid_dimension */ 23: message.displayCustomBidDimension = reader.int32(); break; case /* optional string final_url_suffix */ 46: message.finalUrlSuffix = reader.string(); break; case /* google.ads.googleads.v11.common.TargetingSetting targeting_setting */ 25: message.targetingSetting = targeting_setting_1.TargetingSetting.internalBinaryRead(reader, reader.uint32(), options, message.targetingSetting); break; case /* google.ads.googleads.v11.resources.AdGroup.AudienceSetting audience_setting */ 56: message.audienceSetting = exports.AdGroup_AudienceSetting.internalBinaryRead(reader, reader.uint32(), options, message.audienceSetting); break; case /* optional int64 effective_target_cpa_micros */ 47: message.effectiveTargetCpaMicros = reader.int64().toBigInt(); break; case /* google.ads.googleads.v11.enums.BiddingSourceEnum.BiddingSource effective_target_cpa_source */ 29: message.effectiveTargetCpaSource = reader.int32(); break; case /* optional double effective_target_roas */ 48: message.effectiveTargetRoas = reader.double(); break; case /* google.ads.googleads.v11.enums.BiddingSourceEnum.BiddingSource effective_target_roas_source */ 32: message.effectiveTargetRoasSource = reader.int32(); break; case /* repeated string labels */ 49: message.labels.push(reader.string()); break; case /* repeated google.ads.googleads.v11.enums.AssetFieldTypeEnum.AssetFieldType excluded_parent_asset_field_types */ 54: if (wireType === runtime_2.WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.excludedParentAssetFieldTypes.push(reader.int32()); else message.excludedParentAssetFieldTypes.push(reader.int32()); 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_1.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_2.WireType.LengthDelimited).string(message.resourceName); /* optional int64 id = 34; */ if (message.id !== undefined) writer.tag(34, runtime_2.WireType.Varint).int64(message.id); /* optional string name = 35; */ if (message.name !== undefined) writer.tag(35, runtime_2.WireType.LengthDelimited).string(message.name); /* google.ads.googleads.v11.enums.AdGroupStatusEnum.AdGroupStatus status = 5; */ if (message.status !== 0) writer.tag(5, runtime_2.WireType.Varint).int32(message.status); /* google.ads.googleads.v11.enums.AdGroupTypeEnum.AdGroupType type = 12; */ if (message.type !== 0) writer.tag(12, runtime_2.WireType.Varint).int32(message.type); /* google.ads.googleads.v11.enums.AdGroupAdRotationModeEnum.AdGroupAdRotationMode ad_rotation_mode = 22; */ if (message.adRotationMode !== 0) writer.tag(22, runtime_2.WireType.Varint).int32(message.adRotationMode); /* optional string base_ad_group = 36; */ if (message.baseAdGroup !== undefined) writer.tag(36, runtime_2.WireType.LengthDelimited).string(message.baseAdGroup); /* optional string tracking_url_template = 37; */ if (message.trackingUrlTemplate !== undefined) writer.tag(37, runtime_2.WireType.LengthDelimited).string(message.trackingUrlTemplate); /* repeated google.ads.googleads.v11.common.CustomParameter url_custom_parameters = 6; */ for (let i = 0; i < message.urlCustomParameters.length; i++) custom_parameter_1.CustomParameter.internalBinaryWrite(message.urlCustomParameters[i], writer.tag(6, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* optional string campaign = 38; */ if (message.campaign !== undefined) writer.tag(38, runtime_2.WireType.LengthDelimited).string(message.campaign); /* optional int64 cpc_bid_micros = 39; */ if (message.cpcBidMicros !== undefined) writer.tag(39, runtime_2.WireType.Varint).int64(message.cpcBidMicros); /* optional int64 effective_cpc_bid_micros = 57; */ if (message.effectiveCpcBidMicros !== undefined) writer.tag(57, runtime_2.WireType.Varint).int64(message.effectiveCpcBidMicros); /* optional int64 cpm_bid_micros = 40; */ if (message.cpmBidMicros !== undefined) writer.tag(40, runtime_2.WireType.Varint).int64(message.cpmBidMicros); /* optional int64 target_cpa_micros = 41; */ if (message.targetCpaMicros !== undefined) writer.tag(41, runtime_2.WireType.Varint).int64(message.targetCpaMicros); /* optional int64 cpv_bid_micros = 42; */ if (message.cpvBidMicros !== undefined) writer.tag(42, runtime_2.WireType.Varint).int64(message.cpvBidMicros); /* optional int64 target_cpm_micros = 43; */ if (message.targetCpmMicros !== undefined) writer.tag(43, runtime_2.WireType.Varint).int64(message.targetCpmMicros); /* optional double target_roas = 44; */ if (message.targetRoas !== undefined) writer.tag(44, runtime_2.WireType.Bit64).double(message.targetRoas); /* optional int64 percent_cpc_bid_micros = 45; */ if (message.percentCpcBidMicros !== undefined) writer.tag(45, runtime_2.WireType.Varint).int64(message.percentCpcBidMicros); /* google.ads.googleads.v11.common.ExplorerAutoOptimizerSetting explorer_auto_optimizer_setting = 21; */ if (message.explorerAutoOptimizerSetting) explorer_auto_optimizer_setting_1.ExplorerAutoOptimizerSetting.internalBinaryWrite(message.explorerAutoOptimizerSetting, writer.tag(21, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.enums.TargetingDimensionEnum.TargetingDimension display_custom_bid_dimension = 23; */ if (message.displayCustomBidDimension !== 0) writer.tag(23, runtime_2.WireType.Varint).int32(message.displayCustomBidDimension); /* optional string final_url_suffix = 46; */ if (message.finalUrlSuffix !== undefined) writer.tag(46, runtime_2.WireType.LengthDelimited).string(message.finalUrlSuffix); /* google.ads.googleads.v11.common.TargetingSetting targeting_setting = 25; */ if (message.targetingSetting) targeting_setting_1.TargetingSetting.internalBinaryWrite(message.targetingSetting, writer.tag(25, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.resources.AdGroup.AudienceSetting audience_setting = 56; */ if (message.audienceSetting) exports.AdGroup_AudienceSetting.internalBinaryWrite(message.audienceSetting, writer.tag(56, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* optional int64 effective_target_cpa_micros = 47; */ if (message.effectiveTargetCpaMicros !== undefined) writer.tag(47, runtime_2.WireType.Varint).int64(message.effectiveTargetCpaMicros); /* google.ads.googleads.v11.enums.BiddingSourceEnum.BiddingSource effective_target_cpa_source = 29; */ if (message.effectiveTargetCpaSource !== 0) writer.tag(29, runtime_2.WireType.Varint).int32(message.effectiveTargetCpaSource); /* optional double effective_target_roas = 48; */ if (message.effectiveTargetRoas !== undefined) writer.tag(48, runtime_2.WireType.Bit64).double(message.effectiveTargetRoas); /* google.ads.googleads.v11.enums.BiddingSourceEnum.BiddingSource effective_target_roas_source = 32; */ if (message.effectiveTargetRoasSource !== 0) writer.tag(32, runtime_2.WireType.Varint).int32(message.effectiveTargetRoasSource); /* repeated string labels = 49; */ for (let i = 0; i < message.labels.length; i++) writer.tag(49, runtime_2.WireType.LengthDelimited).string(message.labels[i]); /* repeated google.ads.googleads.v11.enums.AssetFieldTypeEnum.AssetFieldType excluded_parent_asset_field_types = 54; */ if (message.excludedParentAssetFieldTypes.length) { writer.tag(54, runtime_2.WireType.LengthDelimited).fork(); for (let i = 0; i < message.excludedParentAssetFieldTypes.length; i++) writer.int32(message.excludedParentAssetFieldTypes[i]); writer.join(); } let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_1.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message google.ads.googleads.v11.resources.AdGroup */ exports.AdGroup = new AdGroup$Type(); // @generated message type with reflection information, may provide speed optimized methods class AdGroup_AudienceSetting$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.AdGroup.AudienceSetting", [ { no: 1, name: "use_audience_grouped", kind: "scalar", T: 8 /*ScalarType.BOOL*/, options: { "google.api.field_behavior": ["IMMUTABLE"] } } ]); } create(value) { const message = { useAudienceGrouped: false }; 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 /* bool use_audience_grouped */ 1: message.useAudienceGrouped = reader.bool(); 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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* bool use_audience_grouped = 1; */ if (message.useAudienceGrouped !== false) writer.tag(1, runtime_2.WireType.Varint).bool(message.useAudienceGrouped); let u = options.writeUnknownFields; if (u !== false) (u == true ? runtime_1.UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); return writer; } } /** * @generated MessageType for protobuf message google.ads.googleads.v11.resources.AdGroup.AudienceSetting */ exports.AdGroup_AudienceSetting = new AdGroup_AudienceSetting$Type(); //# sourceMappingURL=ad_group.js.map