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.

340 lines 22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConversionValueRule_ValueRuleAudienceCondition = exports.ConversionValueRule_ValueRuleDeviceCondition = exports.ConversionValueRule_ValueRuleGeoLocationCondition = exports.ConversionValueRule_ValueRuleAction = exports.ConversionValueRule = 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 value_rule_device_type_1 = require("../enums/value_rule_device_type"); const value_rule_geo_location_match_type_1 = require("../enums/value_rule_geo_location_match_type"); const value_rule_operation_1 = require("../enums/value_rule_operation"); const conversion_value_rule_status_1 = require("../enums/conversion_value_rule_status"); // @generated message type with reflection information, may provide speed optimized methods class ConversionValueRule$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.ConversionValueRule", [ { 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/ConversionValueRule" } } }, { no: 2, name: "id", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"] } }, { no: 3, name: "action", kind: "message", T: () => exports.ConversionValueRule_ValueRuleAction }, { no: 4, name: "geo_location_condition", kind: "message", T: () => exports.ConversionValueRule_ValueRuleGeoLocationCondition }, { no: 5, name: "device_condition", kind: "message", T: () => exports.ConversionValueRule_ValueRuleDeviceCondition }, { no: 6, name: "audience_condition", kind: "message", T: () => exports.ConversionValueRule_ValueRuleAudienceCondition }, { no: 7, name: "owner_customer", kind: "scalar", T: 9 /*ScalarType.STRING*/, options: { "google.api.field_behavior": ["OUTPUT_ONLY"], "google.api.resource_reference": { type: "googleads.googleapis.com/Customer" } } }, { no: 8, name: "status", kind: "enum", T: () => ["google.ads.googleads.v11.enums.ConversionValueRuleStatusEnum.ConversionValueRuleStatus", conversion_value_rule_status_1.ConversionValueRuleStatusEnum_ConversionValueRuleStatus] } ], { "google.api.resource": { type: "googleads.googleapis.com/ConversionValueRule", pattern: ["customers/{customer_id}/conversionValueRules/{conversion_value_rule_id}"] } }); } create(value) { const message = { resourceName: "", id: 0n, ownerCustomer: "", status: 0 }; 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 /* int64 id */ 2: message.id = reader.int64().toBigInt(); break; case /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleAction action */ 3: message.action = exports.ConversionValueRule_ValueRuleAction.internalBinaryRead(reader, reader.uint32(), options, message.action); break; case /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleGeoLocationCondition geo_location_condition */ 4: message.geoLocationCondition = exports.ConversionValueRule_ValueRuleGeoLocationCondition.internalBinaryRead(reader, reader.uint32(), options, message.geoLocationCondition); break; case /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleDeviceCondition device_condition */ 5: message.deviceCondition = exports.ConversionValueRule_ValueRuleDeviceCondition.internalBinaryRead(reader, reader.uint32(), options, message.deviceCondition); break; case /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleAudienceCondition audience_condition */ 6: message.audienceCondition = exports.ConversionValueRule_ValueRuleAudienceCondition.internalBinaryRead(reader, reader.uint32(), options, message.audienceCondition); break; case /* string owner_customer */ 7: message.ownerCustomer = reader.string(); break; case /* google.ads.googleads.v11.enums.ConversionValueRuleStatusEnum.ConversionValueRuleStatus status */ 8: message.status = 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_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); /* int64 id = 2; */ if (message.id !== 0n) writer.tag(2, runtime_1.WireType.Varint).int64(message.id); /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleAction action = 3; */ if (message.action) exports.ConversionValueRule_ValueRuleAction.internalBinaryWrite(message.action, writer.tag(3, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleGeoLocationCondition geo_location_condition = 4; */ if (message.geoLocationCondition) exports.ConversionValueRule_ValueRuleGeoLocationCondition.internalBinaryWrite(message.geoLocationCondition, writer.tag(4, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleDeviceCondition device_condition = 5; */ if (message.deviceCondition) exports.ConversionValueRule_ValueRuleDeviceCondition.internalBinaryWrite(message.deviceCondition, writer.tag(5, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleAudienceCondition audience_condition = 6; */ if (message.audienceCondition) exports.ConversionValueRule_ValueRuleAudienceCondition.internalBinaryWrite(message.audienceCondition, writer.tag(6, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* string owner_customer = 7; */ if (message.ownerCustomer !== "") writer.tag(7, runtime_1.WireType.LengthDelimited).string(message.ownerCustomer); /* google.ads.googleads.v11.enums.ConversionValueRuleStatusEnum.ConversionValueRuleStatus status = 8; */ if (message.status !== 0) writer.tag(8, runtime_1.WireType.Varint).int32(message.status); 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.ConversionValueRule */ exports.ConversionValueRule = new ConversionValueRule$Type(); // @generated message type with reflection information, may provide speed optimized methods class ConversionValueRule_ValueRuleAction$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleAction", [ { no: 1, name: "operation", kind: "enum", T: () => ["google.ads.googleads.v11.enums.ValueRuleOperationEnum.ValueRuleOperation", value_rule_operation_1.ValueRuleOperationEnum_ValueRuleOperation] }, { no: 2, name: "value", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ } ]); } create(value) { const message = { operation: 0, value: 0 }; 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 /* google.ads.googleads.v11.enums.ValueRuleOperationEnum.ValueRuleOperation operation */ 1: message.operation = reader.int32(); break; case /* double value */ 2: message.value = reader.double(); 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) { /* google.ads.googleads.v11.enums.ValueRuleOperationEnum.ValueRuleOperation operation = 1; */ if (message.operation !== 0) writer.tag(1, runtime_1.WireType.Varint).int32(message.operation); /* double value = 2; */ if (message.value !== 0) writer.tag(2, runtime_1.WireType.Bit64).double(message.value); 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.ConversionValueRule.ValueRuleAction */ exports.ConversionValueRule_ValueRuleAction = new ConversionValueRule_ValueRuleAction$Type(); // @generated message type with reflection information, may provide speed optimized methods class ConversionValueRule_ValueRuleGeoLocationCondition$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleGeoLocationCondition", [ { no: 1, name: "excluded_geo_target_constants", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.resource_reference": { type: "googleads.googleapis.com/GeoTargetConstant" } } }, { no: 2, name: "excluded_geo_match_type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType", value_rule_geo_location_match_type_1.ValueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchType] }, { no: 3, name: "geo_target_constants", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.resource_reference": { type: "googleads.googleapis.com/GeoTargetConstant" } } }, { no: 4, name: "geo_match_type", kind: "enum", T: () => ["google.ads.googleads.v11.enums.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType", value_rule_geo_location_match_type_1.ValueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchType] } ]); } create(value) { const message = { excludedGeoTargetConstants: [], excludedGeoMatchType: 0, geoTargetConstants: [], geoMatchType: 0 }; 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 /* repeated string excluded_geo_target_constants */ 1: message.excludedGeoTargetConstants.push(reader.string()); break; case /* google.ads.googleads.v11.enums.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType excluded_geo_match_type */ 2: message.excludedGeoMatchType = reader.int32(); break; case /* repeated string geo_target_constants */ 3: message.geoTargetConstants.push(reader.string()); break; case /* google.ads.googleads.v11.enums.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType geo_match_type */ 4: message.geoMatchType = 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_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* repeated string excluded_geo_target_constants = 1; */ for (let i = 0; i < message.excludedGeoTargetConstants.length; i++) writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.excludedGeoTargetConstants[i]); /* google.ads.googleads.v11.enums.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType excluded_geo_match_type = 2; */ if (message.excludedGeoMatchType !== 0) writer.tag(2, runtime_1.WireType.Varint).int32(message.excludedGeoMatchType); /* repeated string geo_target_constants = 3; */ for (let i = 0; i < message.geoTargetConstants.length; i++) writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.geoTargetConstants[i]); /* google.ads.googleads.v11.enums.ValueRuleGeoLocationMatchTypeEnum.ValueRuleGeoLocationMatchType geo_match_type = 4; */ if (message.geoMatchType !== 0) writer.tag(4, runtime_1.WireType.Varint).int32(message.geoMatchType); 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.ConversionValueRule.ValueRuleGeoLocationCondition */ exports.ConversionValueRule_ValueRuleGeoLocationCondition = new ConversionValueRule_ValueRuleGeoLocationCondition$Type(); // @generated message type with reflection information, may provide speed optimized methods class ConversionValueRule_ValueRuleDeviceCondition$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleDeviceCondition", [ { no: 1, name: "device_types", kind: "enum", repeat: 1 /*RepeatType.PACKED*/, T: () => ["google.ads.googleads.v11.enums.ValueRuleDeviceTypeEnum.ValueRuleDeviceType", value_rule_device_type_1.ValueRuleDeviceTypeEnum_ValueRuleDeviceType] } ]); } create(value) { const message = { deviceTypes: [] }; 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 /* repeated google.ads.googleads.v11.enums.ValueRuleDeviceTypeEnum.ValueRuleDeviceType device_types */ 1: if (wireType === runtime_1.WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.deviceTypes.push(reader.int32()); else message.deviceTypes.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_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* repeated google.ads.googleads.v11.enums.ValueRuleDeviceTypeEnum.ValueRuleDeviceType device_types = 1; */ if (message.deviceTypes.length) { writer.tag(1, runtime_1.WireType.LengthDelimited).fork(); for (let i = 0; i < message.deviceTypes.length; i++) writer.int32(message.deviceTypes[i]); writer.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.ConversionValueRule.ValueRuleDeviceCondition */ exports.ConversionValueRule_ValueRuleDeviceCondition = new ConversionValueRule_ValueRuleDeviceCondition$Type(); // @generated message type with reflection information, may provide speed optimized methods class ConversionValueRule_ValueRuleAudienceCondition$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.resources.ConversionValueRule.ValueRuleAudienceCondition", [ { no: 1, name: "user_lists", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.resource_reference": { type: "googleads.googleapis.com/UserList" } } }, { no: 2, name: "user_interests", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/, options: { "google.api.resource_reference": { type: "googleads.googleapis.com/UserInterest" } } } ]); } create(value) { const message = { userLists: [], userInterests: [] }; 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 /* repeated string user_lists */ 1: message.userLists.push(reader.string()); break; case /* repeated string user_interests */ 2: message.userInterests.push(reader.string()); 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) { /* repeated string user_lists = 1; */ for (let i = 0; i < message.userLists.length; i++) writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.userLists[i]); /* repeated string user_interests = 2; */ for (let i = 0; i < message.userInterests.length; i++) writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.userInterests[i]); 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.ConversionValueRule.ValueRuleAudienceCondition */ exports.ConversionValueRule_ValueRuleAudienceCondition = new ConversionValueRule_ValueRuleAudienceCondition$Type(); //# sourceMappingURL=conversion_value_rule.js.map