google-ads-api-client
Version:
A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.
730 lines • 39.9 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AttributeContext_Resource = exports.AttributeContext_Response = exports.AttributeContext_Request = exports.AttributeContext_Auth = exports.AttributeContext_Api = exports.AttributeContext_Peer = exports.AttributeContext = 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 timestamp_1 = require("../../protobuf/timestamp");
const struct_1 = require("../../protobuf/struct");
const any_1 = require("../../protobuf/any");
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext", [
{ no: 7, name: "origin", kind: "message", T: () => exports.AttributeContext_Peer },
{ no: 1, name: "source", kind: "message", T: () => exports.AttributeContext_Peer },
{ no: 2, name: "destination", kind: "message", T: () => exports.AttributeContext_Peer },
{ no: 3, name: "request", kind: "message", T: () => exports.AttributeContext_Request },
{ no: 4, name: "response", kind: "message", T: () => exports.AttributeContext_Response },
{ no: 5, name: "resource", kind: "message", T: () => exports.AttributeContext_Resource },
{ no: 6, name: "api", kind: "message", T: () => exports.AttributeContext_Api },
{ no: 8, name: "extensions", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => any_1.Any }
]);
}
create(value) {
const message = { extensions: [] };
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.rpc.context.AttributeContext.Peer origin */ 7:
message.origin = exports.AttributeContext_Peer.internalBinaryRead(reader, reader.uint32(), options, message.origin);
break;
case /* google.rpc.context.AttributeContext.Peer source */ 1:
message.source = exports.AttributeContext_Peer.internalBinaryRead(reader, reader.uint32(), options, message.source);
break;
case /* google.rpc.context.AttributeContext.Peer destination */ 2:
message.destination = exports.AttributeContext_Peer.internalBinaryRead(reader, reader.uint32(), options, message.destination);
break;
case /* google.rpc.context.AttributeContext.Request request */ 3:
message.request = exports.AttributeContext_Request.internalBinaryRead(reader, reader.uint32(), options, message.request);
break;
case /* google.rpc.context.AttributeContext.Response response */ 4:
message.response = exports.AttributeContext_Response.internalBinaryRead(reader, reader.uint32(), options, message.response);
break;
case /* google.rpc.context.AttributeContext.Resource resource */ 5:
message.resource = exports.AttributeContext_Resource.internalBinaryRead(reader, reader.uint32(), options, message.resource);
break;
case /* google.rpc.context.AttributeContext.Api api */ 6:
message.api = exports.AttributeContext_Api.internalBinaryRead(reader, reader.uint32(), options, message.api);
break;
case /* repeated google.protobuf.Any extensions */ 8:
message.extensions.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_2.UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
}
}
return message;
}
internalBinaryWrite(message, writer, options) {
/* google.rpc.context.AttributeContext.Peer origin = 7; */
if (message.origin)
exports.AttributeContext_Peer.internalBinaryWrite(message.origin, writer.tag(7, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.rpc.context.AttributeContext.Peer source = 1; */
if (message.source)
exports.AttributeContext_Peer.internalBinaryWrite(message.source, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.rpc.context.AttributeContext.Peer destination = 2; */
if (message.destination)
exports.AttributeContext_Peer.internalBinaryWrite(message.destination, writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.rpc.context.AttributeContext.Request request = 3; */
if (message.request)
exports.AttributeContext_Request.internalBinaryWrite(message.request, writer.tag(3, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.rpc.context.AttributeContext.Response response = 4; */
if (message.response)
exports.AttributeContext_Response.internalBinaryWrite(message.response, writer.tag(4, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.rpc.context.AttributeContext.Resource resource = 5; */
if (message.resource)
exports.AttributeContext_Resource.internalBinaryWrite(message.resource, writer.tag(5, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.rpc.context.AttributeContext.Api api = 6; */
if (message.api)
exports.AttributeContext_Api.internalBinaryWrite(message.api, writer.tag(6, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* repeated google.protobuf.Any extensions = 8; */
for (let i = 0; i < message.extensions.length; i++)
any_1.Any.internalBinaryWrite(message.extensions[i], writer.tag(8, 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.rpc.context.AttributeContext
*/
exports.AttributeContext = new AttributeContext$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext_Peer$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext.Peer", [
{ no: 1, name: "ip", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "port", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 6, name: "labels", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
{ no: 7, name: "principal", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 8, name: "region_code", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { ip: "", port: 0n, labels: {}, principal: "", regionCode: "" };
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 ip */ 1:
message.ip = reader.string();
break;
case /* int64 port */ 2:
message.port = reader.int64().toBigInt();
break;
case /* map<string, string> labels */ 6:
this.binaryReadMap6(message.labels, reader, options);
break;
case /* string principal */ 7:
message.principal = reader.string();
break;
case /* string region_code */ 8:
message.regionCode = 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;
}
binaryReadMap6(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.rpc.context.AttributeContext.Peer.labels");
}
}
map[key ?? ""] = val ?? "";
}
internalBinaryWrite(message, writer, options) {
/* string ip = 1; */
if (message.ip !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.ip);
/* int64 port = 2; */
if (message.port !== 0n)
writer.tag(2, runtime_1.WireType.Varint).int64(message.port);
/* map<string, string> labels = 6; */
for (let k of Object.keys(message.labels))
writer.tag(6, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.labels[k]).join();
/* string principal = 7; */
if (message.principal !== "")
writer.tag(7, runtime_1.WireType.LengthDelimited).string(message.principal);
/* string region_code = 8; */
if (message.regionCode !== "")
writer.tag(8, runtime_1.WireType.LengthDelimited).string(message.regionCode);
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.rpc.context.AttributeContext.Peer
*/
exports.AttributeContext_Peer = new AttributeContext_Peer$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext_Api$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext.Api", [
{ no: 1, name: "service", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "operation", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "protocol", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 4, name: "version", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { service: "", operation: "", protocol: "", version: "" };
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 service */ 1:
message.service = reader.string();
break;
case /* string operation */ 2:
message.operation = reader.string();
break;
case /* string protocol */ 3:
message.protocol = reader.string();
break;
case /* string version */ 4:
message.version = 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 service = 1; */
if (message.service !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.service);
/* string operation = 2; */
if (message.operation !== "")
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.operation);
/* string protocol = 3; */
if (message.protocol !== "")
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.protocol);
/* string version = 4; */
if (message.version !== "")
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.version);
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.rpc.context.AttributeContext.Api
*/
exports.AttributeContext_Api = new AttributeContext_Api$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext_Auth$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext.Auth", [
{ no: 1, name: "principal", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "audiences", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "presenter", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 4, name: "claims", kind: "message", T: () => struct_1.Struct },
{ no: 5, name: "access_levels", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { principal: "", audiences: [], presenter: "", accessLevels: [] };
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 principal */ 1:
message.principal = reader.string();
break;
case /* repeated string audiences */ 2:
message.audiences.push(reader.string());
break;
case /* string presenter */ 3:
message.presenter = reader.string();
break;
case /* google.protobuf.Struct claims */ 4:
message.claims = struct_1.Struct.internalBinaryRead(reader, reader.uint32(), options, message.claims);
break;
case /* repeated string access_levels */ 5:
message.accessLevels.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 principal = 1; */
if (message.principal !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.principal);
/* repeated string audiences = 2; */
for (let i = 0; i < message.audiences.length; i++)
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.audiences[i]);
/* string presenter = 3; */
if (message.presenter !== "")
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.presenter);
/* google.protobuf.Struct claims = 4; */
if (message.claims)
struct_1.Struct.internalBinaryWrite(message.claims, writer.tag(4, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* repeated string access_levels = 5; */
for (let i = 0; i < message.accessLevels.length; i++)
writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.accessLevels[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.rpc.context.AttributeContext.Auth
*/
exports.AttributeContext_Auth = new AttributeContext_Auth$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext_Request$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext.Request", [
{ no: 1, name: "id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "method", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "headers", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
{ no: 4, name: "path", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 5, name: "host", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 6, name: "scheme", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 7, name: "query", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 9, name: "time", kind: "message", T: () => timestamp_1.Timestamp },
{ no: 10, name: "size", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 11, name: "protocol", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 12, name: "reason", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 13, name: "auth", kind: "message", T: () => exports.AttributeContext_Auth }
]);
}
create(value) {
const message = { id: "", method: "", headers: {}, path: "", host: "", scheme: "", query: "", size: 0n, protocol: "", reason: "" };
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 method */ 2:
message.method = reader.string();
break;
case /* map<string, string> headers */ 3:
this.binaryReadMap3(message.headers, reader, options);
break;
case /* string path */ 4:
message.path = reader.string();
break;
case /* string host */ 5:
message.host = reader.string();
break;
case /* string scheme */ 6:
message.scheme = reader.string();
break;
case /* string query */ 7:
message.query = reader.string();
break;
case /* google.protobuf.Timestamp time */ 9:
message.time = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.time);
break;
case /* int64 size */ 10:
message.size = reader.int64().toBigInt();
break;
case /* string protocol */ 11:
message.protocol = reader.string();
break;
case /* string reason */ 12:
message.reason = reader.string();
break;
case /* google.rpc.context.AttributeContext.Auth auth */ 13:
message.auth = exports.AttributeContext_Auth.internalBinaryRead(reader, reader.uint32(), options, message.auth);
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;
}
binaryReadMap3(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.rpc.context.AttributeContext.Request.headers");
}
}
map[key ?? ""] = val ?? "";
}
internalBinaryWrite(message, writer, options) {
/* string id = 1; */
if (message.id !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.id);
/* string method = 2; */
if (message.method !== "")
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.method);
/* map<string, string> headers = 3; */
for (let k of Object.keys(message.headers))
writer.tag(3, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.headers[k]).join();
/* string path = 4; */
if (message.path !== "")
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.path);
/* string host = 5; */
if (message.host !== "")
writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.host);
/* string scheme = 6; */
if (message.scheme !== "")
writer.tag(6, runtime_1.WireType.LengthDelimited).string(message.scheme);
/* string query = 7; */
if (message.query !== "")
writer.tag(7, runtime_1.WireType.LengthDelimited).string(message.query);
/* google.protobuf.Timestamp time = 9; */
if (message.time)
timestamp_1.Timestamp.internalBinaryWrite(message.time, writer.tag(9, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* int64 size = 10; */
if (message.size !== 0n)
writer.tag(10, runtime_1.WireType.Varint).int64(message.size);
/* string protocol = 11; */
if (message.protocol !== "")
writer.tag(11, runtime_1.WireType.LengthDelimited).string(message.protocol);
/* string reason = 12; */
if (message.reason !== "")
writer.tag(12, runtime_1.WireType.LengthDelimited).string(message.reason);
/* google.rpc.context.AttributeContext.Auth auth = 13; */
if (message.auth)
exports.AttributeContext_Auth.internalBinaryWrite(message.auth, writer.tag(13, 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.rpc.context.AttributeContext.Request
*/
exports.AttributeContext_Request = new AttributeContext_Request$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext_Response$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext.Response", [
{ no: 1, name: "code", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "size", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 3, name: "headers", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
{ no: 4, name: "time", kind: "message", T: () => timestamp_1.Timestamp },
{ no: 5, name: "backend_latency", kind: "message", T: () => duration_1.Duration }
]);
}
create(value) {
const message = { code: 0n, size: 0n, headers: {} };
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 code */ 1:
message.code = reader.int64().toBigInt();
break;
case /* int64 size */ 2:
message.size = reader.int64().toBigInt();
break;
case /* map<string, string> headers */ 3:
this.binaryReadMap3(message.headers, reader, options);
break;
case /* google.protobuf.Timestamp time */ 4:
message.time = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.time);
break;
case /* google.protobuf.Duration backend_latency */ 5:
message.backendLatency = duration_1.Duration.internalBinaryRead(reader, reader.uint32(), options, message.backendLatency);
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;
}
binaryReadMap3(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.rpc.context.AttributeContext.Response.headers");
}
}
map[key ?? ""] = val ?? "";
}
internalBinaryWrite(message, writer, options) {
/* int64 code = 1; */
if (message.code !== 0n)
writer.tag(1, runtime_1.WireType.Varint).int64(message.code);
/* int64 size = 2; */
if (message.size !== 0n)
writer.tag(2, runtime_1.WireType.Varint).int64(message.size);
/* map<string, string> headers = 3; */
for (let k of Object.keys(message.headers))
writer.tag(3, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.headers[k]).join();
/* google.protobuf.Timestamp time = 4; */
if (message.time)
timestamp_1.Timestamp.internalBinaryWrite(message.time, writer.tag(4, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.protobuf.Duration backend_latency = 5; */
if (message.backendLatency)
duration_1.Duration.internalBinaryWrite(message.backendLatency, writer.tag(5, 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.rpc.context.AttributeContext.Response
*/
exports.AttributeContext_Response = new AttributeContext_Response$Type();
// @generated message type with reflection information, may provide speed optimized methods
class AttributeContext_Resource$Type extends runtime_5.MessageType {
constructor() {
super("google.rpc.context.AttributeContext.Resource", [
{ no: 1, name: "service", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 3, name: "type", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 4, name: "labels", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
{ no: 5, name: "uid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 6, name: "annotations", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } },
{ no: 7, name: "display_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 8, name: "create_time", kind: "message", T: () => timestamp_1.Timestamp },
{ no: 9, name: "update_time", kind: "message", T: () => timestamp_1.Timestamp },
{ no: 10, name: "delete_time", kind: "message", T: () => timestamp_1.Timestamp },
{ no: 11, name: "etag", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 12, name: "location", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { service: "", name: "", type: "", labels: {}, uid: "", annotations: {}, displayName: "", etag: "", location: "" };
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 service */ 1:
message.service = reader.string();
break;
case /* string name */ 2:
message.name = reader.string();
break;
case /* string type */ 3:
message.type = reader.string();
break;
case /* map<string, string> labels */ 4:
this.binaryReadMap4(message.labels, reader, options);
break;
case /* string uid */ 5:
message.uid = reader.string();
break;
case /* map<string, string> annotations */ 6:
this.binaryReadMap6(message.annotations, reader, options);
break;
case /* string display_name */ 7:
message.displayName = reader.string();
break;
case /* google.protobuf.Timestamp create_time */ 8:
message.createTime = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.createTime);
break;
case /* google.protobuf.Timestamp update_time */ 9:
message.updateTime = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.updateTime);
break;
case /* google.protobuf.Timestamp delete_time */ 10:
message.deleteTime = timestamp_1.Timestamp.internalBinaryRead(reader, reader.uint32(), options, message.deleteTime);
break;
case /* string etag */ 11:
message.etag = reader.string();
break;
case /* string location */ 12:
message.location = 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;
}
binaryReadMap4(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.rpc.context.AttributeContext.Resource.labels");
}
}
map[key ?? ""] = val ?? "";
}
binaryReadMap6(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.rpc.context.AttributeContext.Resource.annotations");
}
}
map[key ?? ""] = val ?? "";
}
internalBinaryWrite(message, writer, options) {
/* string service = 1; */
if (message.service !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.service);
/* string name = 2; */
if (message.name !== "")
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.name);
/* string type = 3; */
if (message.type !== "")
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.type);
/* map<string, string> labels = 4; */
for (let k of Object.keys(message.labels))
writer.tag(4, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.labels[k]).join();
/* string uid = 5; */
if (message.uid !== "")
writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.uid);
/* map<string, string> annotations = 6; */
for (let k of Object.keys(message.annotations))
writer.tag(6, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.annotations[k]).join();
/* string display_name = 7; */
if (message.displayName !== "")
writer.tag(7, runtime_1.WireType.LengthDelimited).string(message.displayName);
/* google.protobuf.Timestamp create_time = 8; */
if (message.createTime)
timestamp_1.Timestamp.internalBinaryWrite(message.createTime, writer.tag(8, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.protobuf.Timestamp update_time = 9; */
if (message.updateTime)
timestamp_1.Timestamp.internalBinaryWrite(message.updateTime, writer.tag(9, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* google.protobuf.Timestamp delete_time = 10; */
if (message.deleteTime)
timestamp_1.Timestamp.internalBinaryWrite(message.deleteTime, writer.tag(10, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string etag = 11; */
if (message.etag !== "")
writer.tag(11, runtime_1.WireType.LengthDelimited).string(message.etag);
/* string location = 12; */
if (message.location !== "")
writer.tag(12, runtime_1.WireType.LengthDelimited).string(message.location);
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.rpc.context.AttributeContext.Resource
*/
exports.AttributeContext_Resource = new AttributeContext_Resource$Type();
//# sourceMappingURL=attribute_context.js.map