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.

344 lines 17.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceController = exports.ReportResponse = exports.ReportRequest = exports.CheckResponse = exports.ResourceInfo = exports.CheckRequest = void 0; // @generated by protobuf-ts 2.8.1 // @generated from protobuf file "google/api/servicecontrol/v2/service_controller.proto" (package "google.api.servicecontrol.v2", syntax proto3) // tslint:disable // // Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // const runtime_rpc_1 = require("@protobuf-ts/runtime-rpc"); 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 status_1 = require("../../../rpc/status"); const attribute_context_1 = require("../../../rpc/context/attribute_context"); // @generated message type with reflection information, may provide speed optimized methods class CheckRequest$Type extends runtime_5.MessageType { constructor() { super("google.api.servicecontrol.v2.CheckRequest", [ { no: 1, name: "service_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "service_config_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 3, name: "attributes", kind: "message", T: () => attribute_context_1.AttributeContext }, { no: 4, name: "resources", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.ResourceInfo }, { no: 5, name: "flags", kind: "scalar", T: 9 /*ScalarType.STRING*/ } ]); } create(value) { const message = { serviceName: "", serviceConfigId: "", resources: [], flags: "" }; 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_name */ 1: message.serviceName = reader.string(); break; case /* string service_config_id */ 2: message.serviceConfigId = reader.string(); break; case /* google.rpc.context.AttributeContext attributes */ 3: message.attributes = attribute_context_1.AttributeContext.internalBinaryRead(reader, reader.uint32(), options, message.attributes); break; case /* repeated google.api.servicecontrol.v2.ResourceInfo resources */ 4: message.resources.push(exports.ResourceInfo.internalBinaryRead(reader, reader.uint32(), options)); break; case /* string flags */ 5: message.flags = 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_name = 1; */ if (message.serviceName !== "") writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.serviceName); /* string service_config_id = 2; */ if (message.serviceConfigId !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.serviceConfigId); /* google.rpc.context.AttributeContext attributes = 3; */ if (message.attributes) attribute_context_1.AttributeContext.internalBinaryWrite(message.attributes, writer.tag(3, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* repeated google.api.servicecontrol.v2.ResourceInfo resources = 4; */ for (let i = 0; i < message.resources.length; i++) exports.ResourceInfo.internalBinaryWrite(message.resources[i], writer.tag(4, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* string flags = 5; */ if (message.flags !== "") writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.flags); 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.v2.CheckRequest */ exports.CheckRequest = new CheckRequest$Type(); // @generated message type with reflection information, may provide speed optimized methods class ResourceInfo$Type extends runtime_5.MessageType { constructor() { super("google.api.servicecontrol.v2.ResourceInfo", [ { no: 1, name: "name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "type", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 3, name: "permission", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 4, name: "container", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 5, name: "location", kind: "scalar", T: 9 /*ScalarType.STRING*/ } ]); } create(value) { const message = { name: "", type: "", permission: "", container: "", 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 name */ 1: message.name = reader.string(); break; case /* string type */ 2: message.type = reader.string(); break; case /* string permission */ 3: message.permission = reader.string(); break; case /* string container */ 4: message.container = reader.string(); break; case /* string location */ 5: 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; } internalBinaryWrite(message, writer, options) { /* string name = 1; */ if (message.name !== "") writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.name); /* string type = 2; */ if (message.type !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.type); /* string permission = 3; */ if (message.permission !== "") writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.permission); /* string container = 4; */ if (message.container !== "") writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.container); /* string location = 5; */ if (message.location !== "") writer.tag(5, 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.api.servicecontrol.v2.ResourceInfo */ exports.ResourceInfo = new ResourceInfo$Type(); // @generated message type with reflection information, may provide speed optimized methods class CheckResponse$Type extends runtime_5.MessageType { constructor() { super("google.api.servicecontrol.v2.CheckResponse", [ { no: 1, name: "status", kind: "message", T: () => status_1.Status }, { no: 2, name: "headers", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } } ]); } create(value) { const message = { 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 /* google.rpc.Status status */ 1: message.status = status_1.Status.internalBinaryRead(reader, reader.uint32(), options, message.status); break; case /* map<string, string> headers */ 2: this.binaryReadMap2(message.headers, 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.servicecontrol.v2.CheckResponse.headers"); } } map[key ?? ""] = val ?? ""; } internalBinaryWrite(message, writer, options) { /* google.rpc.Status status = 1; */ if (message.status) status_1.Status.internalBinaryWrite(message.status, writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join(); /* map<string, string> headers = 2; */ for (let k of Object.keys(message.headers)) writer.tag(2, runtime_1.WireType.LengthDelimited).fork().tag(1, runtime_1.WireType.LengthDelimited).string(k).tag(2, runtime_1.WireType.LengthDelimited).string(message.headers[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.servicecontrol.v2.CheckResponse */ exports.CheckResponse = new CheckResponse$Type(); // @generated message type with reflection information, may provide speed optimized methods class ReportRequest$Type extends runtime_5.MessageType { constructor() { super("google.api.servicecontrol.v2.ReportRequest", [ { no: 1, name: "service_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "service_config_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 3, name: "operations", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => attribute_context_1.AttributeContext } ]); } create(value) { const message = { serviceName: "", serviceConfigId: "", operations: [] }; 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_name */ 1: message.serviceName = reader.string(); break; case /* string service_config_id */ 2: message.serviceConfigId = reader.string(); break; case /* repeated google.rpc.context.AttributeContext operations */ 3: message.operations.push(attribute_context_1.AttributeContext.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) { /* string service_name = 1; */ if (message.serviceName !== "") writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.serviceName); /* string service_config_id = 2; */ if (message.serviceConfigId !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.serviceConfigId); /* repeated google.rpc.context.AttributeContext operations = 3; */ for (let i = 0; i < message.operations.length; i++) attribute_context_1.AttributeContext.internalBinaryWrite(message.operations[i], 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.servicecontrol.v2.ReportRequest */ exports.ReportRequest = new ReportRequest$Type(); // @generated message type with reflection information, may provide speed optimized methods class ReportResponse$Type extends runtime_5.MessageType { constructor() { super("google.api.servicecontrol.v2.ReportResponse", []); } create(value) { const message = {}; 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) { return target ?? this.create(); } internalBinaryWrite(message, writer, options) { 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.v2.ReportResponse */ exports.ReportResponse = new ReportResponse$Type(); /** * @generated ServiceType for protobuf service google.api.servicecontrol.v2.ServiceController */ exports.ServiceController = new runtime_rpc_1.ServiceType("google.api.servicecontrol.v2.ServiceController", [ { name: "Check", options: { "google.api.http": { post: "/v2/services/{service_name}:check", body: "*" } }, I: exports.CheckRequest, O: exports.CheckResponse }, { name: "Report", options: { "google.api.http": { post: "/v2/services/{service_name}:report", body: "*" } }, I: exports.ReportRequest, O: exports.ReportResponse } ], { "google.api.default_host": "servicecontrol.googleapis.com", "google.api.oauth_scopes": "https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/servicecontrol" }); //# sourceMappingURL=service_controller.js.map