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.

204 lines 11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TargetRestrictionOperation = exports.TargetRestriction = exports.TargetingSetting = exports.TargetRestrictionOperation_Operator = 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 targeting_dimension_1 = require("../enums/targeting_dimension"); /** * The operator. * * @generated from protobuf enum google.ads.googleads.v11.common.TargetRestrictionOperation.Operator */ var TargetRestrictionOperation_Operator; (function (TargetRestrictionOperation_Operator) { /** * Unspecified. * * @generated from protobuf enum value: UNSPECIFIED = 0; */ TargetRestrictionOperation_Operator[TargetRestrictionOperation_Operator["UNSPECIFIED"] = 0] = "UNSPECIFIED"; /** * Used for return value only. Represents value unknown in this version. * * @generated from protobuf enum value: UNKNOWN = 1; */ TargetRestrictionOperation_Operator[TargetRestrictionOperation_Operator["UNKNOWN"] = 1] = "UNKNOWN"; /** * Add the restriction to the existing restrictions. * * @generated from protobuf enum value: ADD = 2; */ TargetRestrictionOperation_Operator[TargetRestrictionOperation_Operator["ADD"] = 2] = "ADD"; /** * Remove the restriction from the existing restrictions. * * @generated from protobuf enum value: REMOVE = 3; */ TargetRestrictionOperation_Operator[TargetRestrictionOperation_Operator["REMOVE"] = 3] = "REMOVE"; })(TargetRestrictionOperation_Operator = exports.TargetRestrictionOperation_Operator || (exports.TargetRestrictionOperation_Operator = {})); // @generated message type with reflection information, may provide speed optimized methods class TargetingSetting$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.common.TargetingSetting", [ { no: 1, name: "target_restrictions", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.TargetRestriction }, { no: 2, name: "target_restriction_operations", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.TargetRestrictionOperation } ]); } create(value) { const message = { targetRestrictions: [], targetRestrictionOperations: [] }; 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.common.TargetRestriction target_restrictions */ 1: message.targetRestrictions.push(exports.TargetRestriction.internalBinaryRead(reader, reader.uint32(), options)); break; case /* repeated google.ads.googleads.v11.common.TargetRestrictionOperation target_restriction_operations */ 2: message.targetRestrictionOperations.push(exports.TargetRestrictionOperation.internalBinaryRead(reader, reader.uint32(), options)); 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.common.TargetRestriction target_restrictions = 1; */ for (let i = 0; i < message.targetRestrictions.length; i++) exports.TargetRestriction.internalBinaryWrite(message.targetRestrictions[i], writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* repeated google.ads.googleads.v11.common.TargetRestrictionOperation target_restriction_operations = 2; */ for (let i = 0; i < message.targetRestrictionOperations.length; i++) exports.TargetRestrictionOperation.internalBinaryWrite(message.targetRestrictionOperations[i], writer.tag(2, 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.common.TargetingSetting */ exports.TargetingSetting = new TargetingSetting$Type(); // @generated message type with reflection information, may provide speed optimized methods class TargetRestriction$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.common.TargetRestriction", [ { no: 1, name: "targeting_dimension", kind: "enum", T: () => ["google.ads.googleads.v11.enums.TargetingDimensionEnum.TargetingDimension", targeting_dimension_1.TargetingDimensionEnum_TargetingDimension] }, { no: 3, name: "bid_only", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ } ]); } create(value) { const message = { targetingDimension: 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.TargetingDimensionEnum.TargetingDimension targeting_dimension */ 1: message.targetingDimension = reader.int32(); break; case /* optional bool bid_only */ 3: message.bidOnly = 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_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* google.ads.googleads.v11.enums.TargetingDimensionEnum.TargetingDimension targeting_dimension = 1; */ if (message.targetingDimension !== 0) writer.tag(1, runtime_1.WireType.Varint).int32(message.targetingDimension); /* optional bool bid_only = 3; */ if (message.bidOnly !== undefined) writer.tag(3, runtime_1.WireType.Varint).bool(message.bidOnly); 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.common.TargetRestriction */ exports.TargetRestriction = new TargetRestriction$Type(); // @generated message type with reflection information, may provide speed optimized methods class TargetRestrictionOperation$Type extends runtime_5.MessageType { constructor() { super("google.ads.googleads.v11.common.TargetRestrictionOperation", [ { no: 1, name: "operator", kind: "enum", T: () => ["google.ads.googleads.v11.common.TargetRestrictionOperation.Operator", TargetRestrictionOperation_Operator] }, { no: 2, name: "value", kind: "message", T: () => exports.TargetRestriction } ]); } create(value) { const message = { operator: 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.common.TargetRestrictionOperation.Operator operator */ 1: message.operator = reader.int32(); break; case /* google.ads.googleads.v11.common.TargetRestriction value */ 2: message.value = exports.TargetRestriction.internalBinaryRead(reader, reader.uint32(), options, message.value); 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.common.TargetRestrictionOperation.Operator operator = 1; */ if (message.operator !== 0) writer.tag(1, runtime_1.WireType.Varint).int32(message.operator); /* google.ads.googleads.v11.common.TargetRestriction value = 2; */ if (message.value) exports.TargetRestriction.internalBinaryWrite(message.value, writer.tag(2, 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.common.TargetRestrictionOperation */ exports.TargetRestrictionOperation = new TargetRestrictionOperation$Type(); //# sourceMappingURL=targeting_setting.js.map