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.

350 lines 17.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Metric = exports.MetricDescriptor_MetricDescriptorMetadata = exports.MetricDescriptor = exports.MetricDescriptor_ValueType = exports.MetricDescriptor_MetricKind = 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 duration_1 = require("../protobuf/duration"); const launch_stage_1 = require("./launch_stage"); const label_1 = require("./label"); /** * The kind of measurement. It describes how the data is reported. * For information on setting the start time and end time based on * the MetricKind, see [TimeInterval][google.monitoring.v3.TimeInterval]. * * @generated from protobuf enum google.api.MetricDescriptor.MetricKind */ var MetricDescriptor_MetricKind; (function (MetricDescriptor_MetricKind) { /** * Do not use this default value. * * @generated from protobuf enum value: METRIC_KIND_UNSPECIFIED = 0; */ MetricDescriptor_MetricKind[MetricDescriptor_MetricKind["METRIC_KIND_UNSPECIFIED"] = 0] = "METRIC_KIND_UNSPECIFIED"; /** * An instantaneous measurement of a value. * * @generated from protobuf enum value: GAUGE = 1; */ MetricDescriptor_MetricKind[MetricDescriptor_MetricKind["GAUGE"] = 1] = "GAUGE"; /** * The change in a value during a time interval. * * @generated from protobuf enum value: DELTA = 2; */ MetricDescriptor_MetricKind[MetricDescriptor_MetricKind["DELTA"] = 2] = "DELTA"; /** * A value accumulated over a time interval. Cumulative * measurements in a time series should have the same start time * and increasing end times, until an event resets the cumulative * value to zero and sets a new start time for the following * points. * * @generated from protobuf enum value: CUMULATIVE = 3; */ MetricDescriptor_MetricKind[MetricDescriptor_MetricKind["CUMULATIVE"] = 3] = "CUMULATIVE"; })(MetricDescriptor_MetricKind = exports.MetricDescriptor_MetricKind || (exports.MetricDescriptor_MetricKind = {})); /** * The value type of a metric. * * @generated from protobuf enum google.api.MetricDescriptor.ValueType */ var MetricDescriptor_ValueType; (function (MetricDescriptor_ValueType) { /** * Do not use this default value. * * @generated from protobuf enum value: VALUE_TYPE_UNSPECIFIED = 0; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["VALUE_TYPE_UNSPECIFIED"] = 0] = "VALUE_TYPE_UNSPECIFIED"; /** * The value is a boolean. * This value type can be used only if the metric kind is `GAUGE`. * * @generated from protobuf enum value: BOOL = 1; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["BOOL"] = 1] = "BOOL"; /** * The value is a signed 64-bit integer. * * @generated from protobuf enum value: INT64 = 2; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["INT64"] = 2] = "INT64"; /** * The value is a double precision floating point number. * * @generated from protobuf enum value: DOUBLE = 3; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["DOUBLE"] = 3] = "DOUBLE"; /** * The value is a text string. * This value type can be used only if the metric kind is `GAUGE`. * * @generated from protobuf enum value: STRING = 4; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["STRING"] = 4] = "STRING"; /** * The value is a [`Distribution`][google.api.Distribution]. * * @generated from protobuf enum value: DISTRIBUTION = 5; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["DISTRIBUTION"] = 5] = "DISTRIBUTION"; /** * The value is money. * * @generated from protobuf enum value: MONEY = 6; */ MetricDescriptor_ValueType[MetricDescriptor_ValueType["MONEY"] = 6] = "MONEY"; })(MetricDescriptor_ValueType = exports.MetricDescriptor_ValueType || (exports.MetricDescriptor_ValueType = {})); // @generated message type with reflection information, may provide speed optimized methods class MetricDescriptor$Type extends runtime_5.MessageType { constructor() { super("google.api.MetricDescriptor", [ { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 8, name: "type", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "labels", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => label_1.LabelDescriptor }, { no: 3, name: "metric_kind", kind: "enum", T: () => ["google.api.MetricDescriptor.MetricKind", MetricDescriptor_MetricKind] }, { no: 4, name: "value_type", kind: "enum", T: () => ["google.api.MetricDescriptor.ValueType", MetricDescriptor_ValueType] }, { no: 5, name: "unit", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 6, name: "description", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 7, name: "display_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 10, name: "metadata", kind: "message", T: () => exports.MetricDescriptor_MetricDescriptorMetadata }, { no: 12, name: "launch_stage", kind: "enum", T: () => ["google.api.LaunchStage", launch_stage_1.LaunchStage] }, { no: 13, name: "monitored_resource_types", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ } ]); } create(value) { const message = { name: "", type: "", labels: [], metricKind: 0, valueType: 0, unit: "", description: "", displayName: "", launchStage: 0, monitoredResourceTypes: [] }; 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 name */ 1: message.name = reader.string(); break; case /* string type */ 8: message.type = reader.string(); break; case /* repeated google.api.LabelDescriptor labels */ 2: message.labels.push(label_1.LabelDescriptor.internalBinaryRead(reader, reader.uint32(), options)); break; case /* google.api.MetricDescriptor.MetricKind metric_kind */ 3: message.metricKind = reader.int32(); break; case /* google.api.MetricDescriptor.ValueType value_type */ 4: message.valueType = reader.int32(); break; case /* string unit */ 5: message.unit = reader.string(); break; case /* string description */ 6: message.description = reader.string(); break; case /* string display_name */ 7: message.displayName = reader.string(); break; case /* google.api.MetricDescriptor.MetricDescriptorMetadata metadata */ 10: message.metadata = exports.MetricDescriptor_MetricDescriptorMetadata.internalBinaryRead(reader, reader.uint32(), options, message.metadata); break; case /* google.api.LaunchStage launch_stage */ 12: message.launchStage = reader.int32(); break; case /* repeated string monitored_resource_types */ 13: message.monitoredResourceTypes.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) { /* string name = 1; */ if (message.name !== "") writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.name); /* string type = 8; */ if (message.type !== "") writer.tag(8, runtime_1.WireType.LengthDelimited).string(message.type); /* repeated google.api.LabelDescriptor labels = 2; */ for (let i = 0; i < message.labels.length; i++) label_1.LabelDescriptor.internalBinaryWrite(message.labels[i], writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.api.MetricDescriptor.MetricKind metric_kind = 3; */ if (message.metricKind !== 0) writer.tag(3, runtime_1.WireType.Varint).int32(message.metricKind); /* google.api.MetricDescriptor.ValueType value_type = 4; */ if (message.valueType !== 0) writer.tag(4, runtime_1.WireType.Varint).int32(message.valueType); /* string unit = 5; */ if (message.unit !== "") writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.unit); /* string description = 6; */ if (message.description !== "") writer.tag(6, runtime_1.WireType.LengthDelimited).string(message.description); /* string display_name = 7; */ if (message.displayName !== "") writer.tag(7, runtime_1.WireType.LengthDelimited).string(message.displayName); /* google.api.MetricDescriptor.MetricDescriptorMetadata metadata = 10; */ if (message.metadata) exports.MetricDescriptor_MetricDescriptorMetadata.internalBinaryWrite(message.metadata, writer.tag(10, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.api.LaunchStage launch_stage = 12; */ if (message.launchStage !== 0) writer.tag(12, runtime_1.WireType.Varint).int32(message.launchStage); /* repeated string monitored_resource_types = 13; */ for (let i = 0; i < message.monitoredResourceTypes.length; i++) writer.tag(13, runtime_1.WireType.LengthDelimited).string(message.monitoredResourceTypes[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.api.MetricDescriptor */ exports.MetricDescriptor = new MetricDescriptor$Type(); // @generated message type with reflection information, may provide speed optimized methods class MetricDescriptor_MetricDescriptorMetadata$Type extends runtime_5.MessageType { constructor() { super("google.api.MetricDescriptor.MetricDescriptorMetadata", [ { no: 1, name: "launch_stage", kind: "enum", T: () => ["google.api.LaunchStage", launch_stage_1.LaunchStage] }, { no: 2, name: "sample_period", kind: "message", T: () => duration_1.Duration }, { no: 3, name: "ingest_delay", kind: "message", T: () => duration_1.Duration } ]); } create(value) { const message = { launchStage: 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.api.LaunchStage launch_stage = 1 [deprecated = true];*/ 1: message.launchStage = reader.int32(); break; case /* google.protobuf.Duration sample_period */ 2: message.samplePeriod = duration_1.Duration.internalBinaryRead(reader, reader.uint32(), options, message.samplePeriod); break; case /* google.protobuf.Duration ingest_delay */ 3: message.ingestDelay = duration_1.Duration.internalBinaryRead(reader, reader.uint32(), options, message.ingestDelay); 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.api.LaunchStage launch_stage = 1 [deprecated = true]; */ if (message.launchStage !== 0) writer.tag(1, runtime_1.WireType.Varint).int32(message.launchStage); /* google.protobuf.Duration sample_period = 2; */ if (message.samplePeriod) duration_1.Duration.internalBinaryWrite(message.samplePeriod, writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* google.protobuf.Duration ingest_delay = 3; */ if (message.ingestDelay) duration_1.Duration.internalBinaryWrite(message.ingestDelay, writer.tag(3, 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.api.MetricDescriptor.MetricDescriptorMetadata */ exports.MetricDescriptor_MetricDescriptorMetadata = new MetricDescriptor_MetricDescriptorMetadata$Type(); // @generated message type with reflection information, may provide speed optimized methods class Metric$Type extends runtime_5.MessageType { constructor() { super("google.api.Metric", [ { no: 3, name: "type", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "labels", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } } ]); } create(value) { const message = { type: "", labels: {} }; 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 type */ 3: message.type = reader.string(); break; case /* map<string, string> labels */ 2: this.binaryReadMap2(message.labels, reader, 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; } binaryReadMap2(map, reader, options) { let len = reader.uint32(), end = reader.pos + len, key, val; while (reader.pos < end) { let [fieldNo, wireType] = reader.tag(); switch (fieldNo) { case 1: key = reader.string(); break; case 2: val = reader.string(); break; default: throw new globalThis.Error("unknown map entry field for field google.api.Metric.labels"); } } map[key ?? ""] = val ?? ""; } internalBinaryWrite(message, writer, options) { /* string type = 3; */ if (message.type !== "") writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.type); /* map<string, string> labels = 2; */ for (let k of Object.keys(message.labels)) writer.tag(2, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.labels[k]).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.api.Metric */ exports.Metric = new Metric$Type(); //# sourceMappingURL=metric.js.map