google-ads-api-client
Version:
A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.
292 lines • 15.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LogEntrySourceLocation = exports.LogEntryOperation = exports.LogEntry = 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 struct_1 = require("../../../protobuf/struct");
const any_1 = require("../../../protobuf/any");
const http_request_1 = require("./http_request");
const log_severity_1 = require("../../../logging/type/log_severity");
const timestamp_1 = require("../../../protobuf/timestamp");
// @generated message type with reflection information, may provide speed optimized methods
class LogEntry$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.LogEntry", [
{ no: 10, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 11, name: "timestamp", kind: "message", T: () => timestamp_1.Timestamp },
{ no: 12, name: "severity", kind: "enum", T: () => ["google.logging.type.LogSeverity", log_severity_1.LogSeverity] },
{ no: 14, name: "http_request", kind: "message", T: () => http_request_1.HttpRequest },
{ no: 15, name: "trace", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 4, name: "insert_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 13, name: "labels", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
{ no: 2, name: "proto_payload", kind: "message", oneof: "payload", T: () => any_1.Any },
{ no: 3, name: "text_payload", kind: "scalar", oneof: "payload", T: 9 /*ScalarType.STRING*/ },
{ no: 6, name: "struct_payload", kind: "message", oneof: "payload", T: () => struct_1.Struct },
{ no: 16, name: "operation", kind: "message", T: () => exports.LogEntryOperation },
{ no: 17, name: "source_location", kind: "message", T: () => exports.LogEntrySourceLocation }
]);
}
create(value) {
const message = { name: "", severity: 0, trace: "", insertId: "", labels: {}, payload: { 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 /* string name */ 10:
message.name = reader.string();
break;
case /* google.protobuf.Timestamp timestamp */ 11:
message.timestamp = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.timestamp);
break;
case /* google.logging.type.LogSeverity severity */ 12:
message.severity = reader.int32();
break;
case /* google.api.servicecontrol.v1.HttpRequest http_request */ 14:
message.httpRequest = http_request_1.HttpRequest.internalBinaryRead(reader, reader.uint32(), options, message.httpRequest);
break;
case /* string trace */ 15:
message.trace = reader.string();
break;
case /* string insert_id */ 4:
message.insertId = reader.string();
break;
case /* map<string, string> labels */ 13:
this.binaryReadMap13(message.labels, reader, options);
break;
case /* google.protobuf.Any proto_payload */ 2:
message.payload = {
oneofKind: "protoPayload",
protoPayload: any_1.Any.internalBinaryRead(reader, reader.uint32(), options, message.payload.protoPayload)
};
break;
case /* string text_payload */ 3:
message.payload = {
oneofKind: "textPayload",
textPayload: reader.string()
};
break;
case /* google.protobuf.Struct struct_payload */ 6:
message.payload = {
oneofKind: "structPayload",
structPayload: struct_1.Struct.internalBinaryRead(reader, reader.uint32(), options, message.payload.structPayload)
};
break;
case /* google.api.servicecontrol.v1.LogEntryOperation operation */ 16:
message.operation = exports.LogEntryOperation.internalBinaryRead(reader, reader.uint32(), options, message.operation);
break;
case /* google.api.servicecontrol.v1.LogEntrySourceLocation source_location */ 17:
message.sourceLocation = exports.LogEntrySourceLocation.internalBinaryRead(reader, reader.uint32(), options, message.sourceLocation);
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;
}
binaryReadMap13(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.servicecontrol.v1.LogEntry.labels");
}
}
map[key ?? ""] = val ?? "";
}
internalBinaryWrite(message, writer, options) {
/* string name = 10; */
if (message.name !== "")
writer.tag(10, runtime_1.WireType.LengthDelimited).string(message.name);
/* google.protobuf.Timestamp timestamp = 11; */
if (message.timestamp)
timestamp_1.Timestamp.internalBinaryWrite(message.timestamp, writer.tag(11, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.logging.type.LogSeverity severity = 12; */
if (message.severity !== 0)
writer.tag(12, runtime_1.WireType.Varint).int32(message.severity);
/* google.api.servicecontrol.v1.HttpRequest http_request = 14; */
if (message.httpRequest)
http_request_1.HttpRequest.internalBinaryWrite(message.httpRequest, writer.tag(14, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string trace = 15; */
if (message.trace !== "")
writer.tag(15, runtime_1.WireType.LengthDelimited).string(message.trace);
/* string insert_id = 4; */
if (message.insertId !== "")
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.insertId);
/* map<string, string> labels = 13; */
for (let k of Object.keys(message.labels))
writer.tag(13, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.labels[k]).join();
/* google.protobuf.Any proto_payload = 2; */
if (message.payload.oneofKind === "protoPayload")
any_1.Any.internalBinaryWrite(message.payload.protoPayload, writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string text_payload = 3; */
if (message.payload.oneofKind === "textPayload")
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.payload.textPayload);
/* google.protobuf.Struct struct_payload = 6; */
if (message.payload.oneofKind === "structPayload")
struct_1.Struct.internalBinaryWrite(message.payload.structPayload, writer.tag(6, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.api.servicecontrol.v1.LogEntryOperation operation = 16; */
if (message.operation)
exports.LogEntryOperation.internalBinaryWrite(message.operation, writer.tag(16, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.api.servicecontrol.v1.LogEntrySourceLocation source_location = 17; */
if (message.sourceLocation)
exports.LogEntrySourceLocation.internalBinaryWrite(message.sourceLocation, writer.tag(17, 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.servicecontrol.v1.LogEntry
*/
exports.LogEntry = new LogEntry$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LogEntryOperation$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.LogEntryOperation", [
{ no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "producer", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "first", kind: "scalar", T: 8 /*ScalarType.BOOL*/ },
{ no: 4, name: "last", kind: "scalar", T: 8 /*ScalarType.BOOL*/ }
]);
}
create(value) {
const message = { id: "", producer: "", first: false, last: 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 /* string id */ 1:
message.id = reader.string();
break;
case /* string producer */ 2:
message.producer = reader.string();
break;
case /* bool first */ 3:
message.first = reader.bool();
break;
case /* bool last */ 4:
message.last = 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) {
/* string id = 1; */
if (message.id !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.id);
/* string producer = 2; */
if (message.producer !== "")
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.producer);
/* bool first = 3; */
if (message.first !== false)
writer.tag(3, runtime_1.WireType.Varint).bool(message.first);
/* bool last = 4; */
if (message.last !== false)
writer.tag(4, runtime_1.WireType.Varint).bool(message.last);
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.servicecontrol.v1.LogEntryOperation
*/
exports.LogEntryOperation = new LogEntryOperation$Type();
// @generated message type with reflection information, may provide speed optimized methods
class LogEntrySourceLocation$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.LogEntrySourceLocation", [
{ no: 1, name: "file", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "line", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "function", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { file: "", line: 0n, function: "" };
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 file */ 1:
message.file = reader.string();
break;
case /* int64 line */ 2:
message.line = reader.int64().toBigInt();
break;
case /* string function */ 3:
message.function = 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 file = 1; */
if (message.file !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.file);
/* int64 line = 2; */
if (message.line !== 0n)
writer.tag(2, runtime_1.WireType.Varint).int64(message.line);
/* string function = 3; */
if (message.function !== "")
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.function);
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.servicecontrol.v1.LogEntrySourceLocation
*/
exports.LogEntrySourceLocation = new LogEntrySourceLocation$Type();
//# sourceMappingURL=log_entry.js.map