google-ads-api-client
Version:
A friendly and exhaustive client to the google-ads-api, code generated directly from google's published protobuf schema.
506 lines • 27.3 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ServiceController = exports.ReportResponse_ReportError = exports.ReportResponse = exports.ReportRequest = exports.CheckResponse_ConsumerInfo = exports.CheckResponse_CheckInfo = exports.CheckResponse = exports.CheckRequest = exports.CheckResponse_ConsumerInfo_ConsumerType = void 0;
// @generated by protobuf-ts 2.8.1
// @generated from protobuf file "google/api/servicecontrol/v1/service_controller.proto" (package "google.api.servicecontrol.v1", syntax proto3)
// tslint:disable
//
// Copyright 2021 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 check_error_1 = require("./check_error");
const operation_1 = require("./operation");
/**
* The type of the consumer as defined in
* [Google Resource Manager](https://cloud.google.com/resource-manager/).
*
* @generated from protobuf enum google.api.servicecontrol.v1.CheckResponse.ConsumerInfo.ConsumerType
*/
var CheckResponse_ConsumerInfo_ConsumerType;
(function (CheckResponse_ConsumerInfo_ConsumerType) {
/**
* This is never used.
*
* @generated from protobuf enum value: CONSUMER_TYPE_UNSPECIFIED = 0;
*/
CheckResponse_ConsumerInfo_ConsumerType[CheckResponse_ConsumerInfo_ConsumerType["CONSUMER_TYPE_UNSPECIFIED"] = 0] = "CONSUMER_TYPE_UNSPECIFIED";
/**
* The consumer is a Google Cloud Project.
*
* @generated from protobuf enum value: PROJECT = 1;
*/
CheckResponse_ConsumerInfo_ConsumerType[CheckResponse_ConsumerInfo_ConsumerType["PROJECT"] = 1] = "PROJECT";
/**
* The consumer is a Google Cloud Folder.
*
* @generated from protobuf enum value: FOLDER = 2;
*/
CheckResponse_ConsumerInfo_ConsumerType[CheckResponse_ConsumerInfo_ConsumerType["FOLDER"] = 2] = "FOLDER";
/**
* The consumer is a Google Cloud Organization.
*
* @generated from protobuf enum value: ORGANIZATION = 3;
*/
CheckResponse_ConsumerInfo_ConsumerType[CheckResponse_ConsumerInfo_ConsumerType["ORGANIZATION"] = 3] = "ORGANIZATION";
/**
* Service-specific resource container which is defined by the service
* producer to offer their users the ability to manage service control
* functionalities at a finer level of granularity than the PROJECT.
*
* @generated from protobuf enum value: SERVICE_SPECIFIC = 4;
*/
CheckResponse_ConsumerInfo_ConsumerType[CheckResponse_ConsumerInfo_ConsumerType["SERVICE_SPECIFIC"] = 4] = "SERVICE_SPECIFIC";
})(CheckResponse_ConsumerInfo_ConsumerType = exports.CheckResponse_ConsumerInfo_ConsumerType || (exports.CheckResponse_ConsumerInfo_ConsumerType = {}));
// @generated message type with reflection information, may provide speed optimized methods
class CheckRequest$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.CheckRequest", [
{ no: 1, name: "service_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "operation", kind: "message", T: () => operation_1.Operation },
{ no: 4, name: "service_config_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { serviceName: "", serviceConfigId: "" };
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 /* google.api.servicecontrol.v1.Operation operation */ 2:
message.operation = operation_1.Operation.internalBinaryRead(reader, reader.uint32(), options, message.operation);
break;
case /* string service_config_id */ 4:
message.serviceConfigId = 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);
/* google.api.servicecontrol.v1.Operation operation = 2; */
if (message.operation)
operation_1.Operation.internalBinaryWrite(message.operation, writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string service_config_id = 4; */
if (message.serviceConfigId !== "")
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.serviceConfigId);
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.CheckRequest
*/
exports.CheckRequest = new CheckRequest$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CheckResponse$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.CheckResponse", [
{ no: 1, name: "operation_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "check_errors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => check_error_1.CheckError },
{ no: 5, name: "service_config_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 11, name: "service_rollout_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 6, name: "check_info", kind: "message", T: () => exports.CheckResponse_CheckInfo }
]);
}
create(value) {
const message = { operationId: "", checkErrors: [], serviceConfigId: "", serviceRolloutId: "" };
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 operation_id */ 1:
message.operationId = reader.string();
break;
case /* repeated google.api.servicecontrol.v1.CheckError check_errors */ 2:
message.checkErrors.push(check_error_1.CheckError.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* string service_config_id */ 5:
message.serviceConfigId = reader.string();
break;
case /* string service_rollout_id */ 11:
message.serviceRolloutId = reader.string();
break;
case /* google.api.servicecontrol.v1.CheckResponse.CheckInfo check_info */ 6:
message.checkInfo = exports.CheckResponse_CheckInfo.internalBinaryRead(reader, reader.uint32(), options, message.checkInfo);
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 operation_id = 1; */
if (message.operationId !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.operationId);
/* repeated google.api.servicecontrol.v1.CheckError check_errors = 2; */
for (let i = 0; i < message.checkErrors.length; i++)
check_error_1.CheckError.internalBinaryWrite(message.checkErrors[i], writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string service_config_id = 5; */
if (message.serviceConfigId !== "")
writer.tag(5, runtime_1.WireType.LengthDelimited).string(message.serviceConfigId);
/* string service_rollout_id = 11; */
if (message.serviceRolloutId !== "")
writer.tag(11, runtime_1.WireType.LengthDelimited).string(message.serviceRolloutId);
/* google.api.servicecontrol.v1.CheckResponse.CheckInfo check_info = 6; */
if (message.checkInfo)
exports.CheckResponse_CheckInfo.internalBinaryWrite(message.checkInfo, writer.tag(6, 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.CheckResponse
*/
exports.CheckResponse = new CheckResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CheckResponse_CheckInfo$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.CheckResponse.CheckInfo", [
{ no: 1, name: "unused_arguments", kind: "scalar", repeat: 2 /*RepeatType.UNPACKED*/, T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "consumer_info", kind: "message", T: () => exports.CheckResponse_ConsumerInfo }
]);
}
create(value) {
const message = { unusedArguments: [] };
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 string unused_arguments */ 1:
message.unusedArguments.push(reader.string());
break;
case /* google.api.servicecontrol.v1.CheckResponse.ConsumerInfo consumer_info */ 2:
message.consumerInfo = exports.CheckResponse_ConsumerInfo.internalBinaryRead(reader, reader.uint32(), options, message.consumerInfo);
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) {
/* repeated string unused_arguments = 1; */
for (let i = 0; i < message.unusedArguments.length; i++)
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.unusedArguments[i]);
/* google.api.servicecontrol.v1.CheckResponse.ConsumerInfo consumer_info = 2; */
if (message.consumerInfo)
exports.CheckResponse_ConsumerInfo.internalBinaryWrite(message.consumerInfo, writer.tag(2, 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.CheckResponse.CheckInfo
*/
exports.CheckResponse_CheckInfo = new CheckResponse_CheckInfo$Type();
// @generated message type with reflection information, may provide speed optimized methods
class CheckResponse_ConsumerInfo$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.CheckResponse.ConsumerInfo", [
{ no: 1, name: "project_number", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ },
{ no: 2, name: "type", kind: "enum", T: () => ["google.api.servicecontrol.v1.CheckResponse.ConsumerInfo.ConsumerType", CheckResponse_ConsumerInfo_ConsumerType] },
{ no: 3, name: "consumer_number", kind: "scalar", T: 3 /*ScalarType.INT64*/, L: 0 /*LongType.BIGINT*/ }
]);
}
create(value) {
const message = { projectNumber: 0n, type: 0, consumerNumber: 0n };
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 project_number */ 1:
message.projectNumber = reader.int64().toBigInt();
break;
case /* google.api.servicecontrol.v1.CheckResponse.ConsumerInfo.ConsumerType type */ 2:
message.type = reader.int32();
break;
case /* int64 consumer_number */ 3:
message.consumerNumber = reader.int64().toBigInt();
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) {
/* int64 project_number = 1; */
if (message.projectNumber !== 0n)
writer.tag(1, runtime_1.WireType.Varint).int64(message.projectNumber);
/* google.api.servicecontrol.v1.CheckResponse.ConsumerInfo.ConsumerType type = 2; */
if (message.type !== 0)
writer.tag(2, runtime_1.WireType.Varint).int32(message.type);
/* int64 consumer_number = 3; */
if (message.consumerNumber !== 0n)
writer.tag(3, runtime_1.WireType.Varint).int64(message.consumerNumber);
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.CheckResponse.ConsumerInfo
*/
exports.CheckResponse_ConsumerInfo = new CheckResponse_ConsumerInfo$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ReportRequest$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.ReportRequest", [
{ no: 1, name: "service_name", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "operations", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => operation_1.Operation },
{ no: 3, name: "service_config_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { serviceName: "", operations: [], serviceConfigId: "" };
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 /* repeated google.api.servicecontrol.v1.Operation operations */ 2:
message.operations.push(operation_1.Operation.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* string service_config_id */ 3:
message.serviceConfigId = 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);
/* repeated google.api.servicecontrol.v1.Operation operations = 2; */
for (let i = 0; i < message.operations.length; i++)
operation_1.Operation.internalBinaryWrite(message.operations[i], writer.tag(2, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string service_config_id = 3; */
if (message.serviceConfigId !== "")
writer.tag(3, runtime_1.WireType.LengthDelimited).string(message.serviceConfigId);
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.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.v1.ReportResponse", [
{ no: 1, name: "report_errors", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.ReportResponse_ReportError },
{ no: 2, name: "service_config_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 4, name: "service_rollout_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ }
]);
}
create(value) {
const message = { reportErrors: [], serviceConfigId: "", serviceRolloutId: "" };
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 google.api.servicecontrol.v1.ReportResponse.ReportError report_errors */ 1:
message.reportErrors.push(exports.ReportResponse_ReportError.internalBinaryRead(reader, reader.uint32(), options));
break;
case /* string service_config_id */ 2:
message.serviceConfigId = reader.string();
break;
case /* string service_rollout_id */ 4:
message.serviceRolloutId = 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) {
/* repeated google.api.servicecontrol.v1.ReportResponse.ReportError report_errors = 1; */
for (let i = 0; i < message.reportErrors.length; i++)
exports.ReportResponse_ReportError.internalBinaryWrite(message.reportErrors[i], writer.tag(1, runtime_1.WireType.LengthDelimited).fork(), options).join();
/* string service_config_id = 2; */
if (message.serviceConfigId !== "")
writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.serviceConfigId);
/* string service_rollout_id = 4; */
if (message.serviceRolloutId !== "")
writer.tag(4, runtime_1.WireType.LengthDelimited).string(message.serviceRolloutId);
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.ReportResponse
*/
exports.ReportResponse = new ReportResponse$Type();
// @generated message type with reflection information, may provide speed optimized methods
class ReportResponse_ReportError$Type extends runtime_5.MessageType {
constructor() {
super("google.api.servicecontrol.v1.ReportResponse.ReportError", [
{ no: 1, name: "operation_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
{ no: 2, name: "status", kind: "message", T: () => status_1.Status }
]);
}
create(value) {
const message = { operationId: "" };
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 operation_id */ 1:
message.operationId = reader.string();
break;
case /* google.rpc.Status status */ 2:
message.status = status_1.Status.internalBinaryRead(reader, reader.uint32(), options, message.status);
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 operation_id = 1; */
if (message.operationId !== "")
writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.operationId);
/* google.rpc.Status status = 2; */
if (message.status)
status_1.Status.internalBinaryWrite(message.status, writer.tag(2, 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.ReportResponse.ReportError
*/
exports.ReportResponse_ReportError = new ReportResponse_ReportError$Type();
/**
* @generated ServiceType for protobuf service google.api.servicecontrol.v1.ServiceController
*/
exports.ServiceController = new runtime_rpc_1.ServiceType("google.api.servicecontrol.v1.ServiceController", [
{ name: "Check", options: { "google.api.http": { post: "/v1/services/{service_name}:check", body: "*" } }, I: exports.CheckRequest, O: exports.CheckResponse },
{ name: "Report", options: { "google.api.http": { post: "/v1/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