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.

470 lines 24.9 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Distribution_Exemplar = exports.Distribution_BucketOptions_Explicit = exports.Distribution_BucketOptions_Exponential = exports.Distribution_BucketOptions_Linear = exports.Distribution_BucketOptions = exports.Distribution_Range = exports.Distribution = 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 any_1 = require("../protobuf/any"); const timestamp_1 = require("../protobuf/timestamp"); // @generated message type with reflection information, may provide speed optimized methods class Distribution$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution", [ { no: 1, name: "count", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 2, name: "mean", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 3, name: "sum_of_squared_deviation", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 4, name: "range", kind: "message", T: () => exports.Distribution_Range }, { no: 6, name: "bucket_options", kind: "message", T: () => exports.Distribution_BucketOptions }, { no: 7, name: "bucket_counts", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }, { no: 10, name: "exemplars", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.Distribution_Exemplar } ]); } create(value) { const message = { count: 0n, mean: 0, sumOfSquaredDeviation: 0, bucketCounts: [], exemplars: [] }; 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 /* int64 count */ 1: message.count = reader.int64().toBigInt(); break; case /* double mean */ 2: message.mean = reader.double(); break; case /* double sum_of_squared_deviation */ 3: message.sumOfSquaredDeviation = reader.double(); break; case /* google.api.Distribution.Range range */ 4: message.range = exports.Distribution_Range.internalBinaryRead(reader, reader.uint32(), options, message.range); break; case /* google.api.Distribution.BucketOptions bucket_options */ 6: message.bucketOptions = exports.Distribution_BucketOptions.internalBinaryRead(reader, reader.uint32(), options, message.bucketOptions); break; case /* repeated int64 bucket_counts */ 7: if (wireType === runtime_2.WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.bucketCounts.push(reader.int64().toBigInt()); else message.bucketCounts.push(reader.int64().toBigInt()); break; case /* repeated google.api.Distribution.Exemplar exemplars */ 10: message.exemplars.push(exports.Distribution_Exemplar.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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* int64 count = 1; */ if (message.count !== 0n) writer.tag(1, runtime_2.WireType.Varint).int64(message.count); /* double mean = 2; */ if (message.mean !== 0) writer.tag(2, runtime_2.WireType.Bit64).double(message.mean); /* double sum_of_squared_deviation = 3; */ if (message.sumOfSquaredDeviation !== 0) writer.tag(3, runtime_2.WireType.Bit64).double(message.sumOfSquaredDeviation); /* google.api.Distribution.Range range = 4; */ if (message.range) exports.Distribution_Range.internalBinaryWrite(message.range, writer.tag(4, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* google.api.Distribution.BucketOptions bucket_options = 6; */ if (message.bucketOptions) exports.Distribution_BucketOptions.internalBinaryWrite(message.bucketOptions, writer.tag(6, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* repeated int64 bucket_counts = 7; */ if (message.bucketCounts.length) { writer.tag(7, runtime_2.WireType.LengthDelimited).fork(); for (let i = 0; i < message.bucketCounts.length; i++) writer.int64(message.bucketCounts[i]); writer.join(); } /* repeated google.api.Distribution.Exemplar exemplars = 10; */ for (let i = 0; i < message.exemplars.length; i++) exports.Distribution_Exemplar.internalBinaryWrite(message.exemplars[i], writer.tag(10, runtime_2.WireType.LengthDelimited).fork(), options).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.api.Distribution */ exports.Distribution = new Distribution$Type(); // @generated message type with reflection information, may provide speed optimized methods class Distribution_Range$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution.Range", [ { no: 1, name: "min", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 2, name: "max", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ } ]); } create(value) { const message = { min: 0, max: 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 /* double min */ 1: message.min = reader.double(); break; case /* double max */ 2: message.max = 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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* double min = 1; */ if (message.min !== 0) writer.tag(1, runtime_2.WireType.Bit64).double(message.min); /* double max = 2; */ if (message.max !== 0) writer.tag(2, runtime_2.WireType.Bit64).double(message.max); 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.api.Distribution.Range */ exports.Distribution_Range = new Distribution_Range$Type(); // @generated message type with reflection information, may provide speed optimized methods class Distribution_BucketOptions$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution.BucketOptions", [ { no: 1, name: "linear_buckets", kind: "message", oneof: "options", T: () => exports.Distribution_BucketOptions_Linear }, { no: 2, name: "exponential_buckets", kind: "message", oneof: "options", T: () => exports.Distribution_BucketOptions_Exponential }, { no: 3, name: "explicit_buckets", kind: "message", oneof: "options", T: () => exports.Distribution_BucketOptions_Explicit } ]); } create(value) { const message = { options: { 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 /* google.api.Distribution.BucketOptions.Linear linear_buckets */ 1: message.options = { oneofKind: "linearBuckets", linearBuckets: exports.Distribution_BucketOptions_Linear.internalBinaryRead(reader, reader.uint32(), options, message.options.linearBuckets) }; break; case /* google.api.Distribution.BucketOptions.Exponential exponential_buckets */ 2: message.options = { oneofKind: "exponentialBuckets", exponentialBuckets: exports.Distribution_BucketOptions_Exponential.internalBinaryRead(reader, reader.uint32(), options, message.options.exponentialBuckets) }; break; case /* google.api.Distribution.BucketOptions.Explicit explicit_buckets */ 3: message.options = { oneofKind: "explicitBuckets", explicitBuckets: exports.Distribution_BucketOptions_Explicit.internalBinaryRead(reader, reader.uint32(), options, message.options.explicitBuckets) }; 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) { /* google.api.Distribution.BucketOptions.Linear linear_buckets = 1; */ if (message.options.oneofKind === "linearBuckets") exports.Distribution_BucketOptions_Linear.internalBinaryWrite(message.options.linearBuckets, writer.tag(1, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* google.api.Distribution.BucketOptions.Exponential exponential_buckets = 2; */ if (message.options.oneofKind === "exponentialBuckets") exports.Distribution_BucketOptions_Exponential.internalBinaryWrite(message.options.exponentialBuckets, writer.tag(2, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* google.api.Distribution.BucketOptions.Explicit explicit_buckets = 3; */ if (message.options.oneofKind === "explicitBuckets") exports.Distribution_BucketOptions_Explicit.internalBinaryWrite(message.options.explicitBuckets, writer.tag(3, runtime_2.WireType.LengthDelimited).fork(), options).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.api.Distribution.BucketOptions */ exports.Distribution_BucketOptions = new Distribution_BucketOptions$Type(); // @generated message type with reflection information, may provide speed optimized methods class Distribution_BucketOptions_Linear$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution.BucketOptions.Linear", [ { no: 1, name: "num_finite_buckets", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, { no: 2, name: "width", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 3, name: "offset", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ } ]); } create(value) { const message = { numFiniteBuckets: 0, width: 0, offset: 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 /* int32 num_finite_buckets */ 1: message.numFiniteBuckets = reader.int32(); break; case /* double width */ 2: message.width = reader.double(); break; case /* double offset */ 3: message.offset = 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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* int32 num_finite_buckets = 1; */ if (message.numFiniteBuckets !== 0) writer.tag(1, runtime_2.WireType.Varint).int32(message.numFiniteBuckets); /* double width = 2; */ if (message.width !== 0) writer.tag(2, runtime_2.WireType.Bit64).double(message.width); /* double offset = 3; */ if (message.offset !== 0) writer.tag(3, runtime_2.WireType.Bit64).double(message.offset); 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.api.Distribution.BucketOptions.Linear */ exports.Distribution_BucketOptions_Linear = new Distribution_BucketOptions_Linear$Type(); // @generated message type with reflection information, may provide speed optimized methods class Distribution_BucketOptions_Exponential$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution.BucketOptions.Exponential", [ { no: 1, name: "num_finite_buckets", kind: "scalar", T: 5 /*ScalarType.INT32*/ }, { no: 2, name: "growth_factor", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 3, name: "scale", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ } ]); } create(value) { const message = { numFiniteBuckets: 0, growthFactor: 0, scale: 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 /* int32 num_finite_buckets */ 1: message.numFiniteBuckets = reader.int32(); break; case /* double growth_factor */ 2: message.growthFactor = reader.double(); break; case /* double scale */ 3: message.scale = 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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* int32 num_finite_buckets = 1; */ if (message.numFiniteBuckets !== 0) writer.tag(1, runtime_2.WireType.Varint).int32(message.numFiniteBuckets); /* double growth_factor = 2; */ if (message.growthFactor !== 0) writer.tag(2, runtime_2.WireType.Bit64).double(message.growthFactor); /* double scale = 3; */ if (message.scale !== 0) writer.tag(3, runtime_2.WireType.Bit64).double(message.scale); 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.api.Distribution.BucketOptions.Exponential */ exports.Distribution_BucketOptions_Exponential = new Distribution_BucketOptions_Exponential$Type(); // @generated message type with reflection information, may provide speed optimized methods class Distribution_BucketOptions_Explicit$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution.BucketOptions.Explicit", [ { no: 1, name: "bounds", kind: "scalar", repeat: 1 /*RepeatType.PACKED*/, T: 1 /*ScalarType.DOUBLE*/ } ]); } create(value) { const message = { bounds: [] }; 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 double bounds */ 1: if (wireType === runtime_2.WireType.LengthDelimited) for (let e = reader.int32() + reader.pos; reader.pos < e;) message.bounds.push(reader.double()); else message.bounds.push(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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* repeated double bounds = 1; */ if (message.bounds.length) { writer.tag(1, runtime_2.WireType.LengthDelimited).fork(); for (let i = 0; i < message.bounds.length; i++) writer.double(message.bounds[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.api.Distribution.BucketOptions.Explicit */ exports.Distribution_BucketOptions_Explicit = new Distribution_BucketOptions_Explicit$Type(); // @generated message type with reflection information, may provide speed optimized methods class Distribution_Exemplar$Type extends runtime_5.MessageType { constructor() { super("google.api.Distribution.Exemplar", [ { no: 1, name: "value", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 2, name: "timestamp", kind: "message", T: () => timestamp_1.Timestamp }, { no: 3, name: "attachments", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => any_1.Any } ]); } create(value) { const message = { value: 0, attachments: [] }; 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 /* double value */ 1: message.value = reader.double(); break; case /* google.protobuf.Timestamp timestamp */ 2: message.timestamp = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.timestamp); break; case /* repeated google.protobuf.Any attachments */ 3: message.attachments.push(any_1.Any.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_1.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); } } return message; } internalBinaryWrite(message, writer, options) { /* double value = 1; */ if (message.value !== 0) writer.tag(1, runtime_2.WireType.Bit64).double(message.value); /* google.protobuf.Timestamp timestamp = 2; */ if (message.timestamp) timestamp_1.Timestamp.internalBinaryWrite(message.timestamp, writer.tag(2, runtime_2.WireType.LengthDelimited).fork(), options).join(); /* repeated google.protobuf.Any attachments = 3; */ for (let i = 0; i < message.attachments.length; i++) any_1.Any.internalBinaryWrite(message.attachments[i], writer.tag(3, runtime_2.WireType.LengthDelimited).fork(), options).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.api.Distribution.Exemplar */ exports.Distribution_Exemplar = new Distribution_Exemplar$Type(); //# sourceMappingURL=distribution.js.map