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.

235 lines 11.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BackendRule = exports.Backend = exports.BackendRule_PathTranslation = 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"); /** * Path Translation specifies how to combine the backend address with the * request path in order to produce the appropriate forwarding URL for the * request. * * Path Translation is applicable only to HTTP-based backends. Backends which * do not accept requests over HTTP/HTTPS should leave `path_translation` * unspecified. * * @generated from protobuf enum google.api.BackendRule.PathTranslation */ var BackendRule_PathTranslation; (function (BackendRule_PathTranslation) { /** * @generated from protobuf enum value: PATH_TRANSLATION_UNSPECIFIED = 0; */ BackendRule_PathTranslation[BackendRule_PathTranslation["PATH_TRANSLATION_UNSPECIFIED"] = 0] = "PATH_TRANSLATION_UNSPECIFIED"; /** * Use the backend address as-is, with no modification to the path. If the * URL pattern contains variables, the variable names and values will be * appended to the query string. If a query string parameter and a URL * pattern variable have the same name, this may result in duplicate keys in * the query string. * * # Examples * * Given the following operation config: * * Method path: /api/company/{cid}/user/{uid} * Backend address: https://example.cloudfunctions.net/getUser * * Requests to the following request paths will call the backend at the * translated path: * * Request path: /api/company/widgetworks/user/johndoe * Translated: * https://example.cloudfunctions.net/getUser?cid=widgetworks&uid=johndoe * * Request path: /api/company/widgetworks/user/johndoe?timezone=EST * Translated: * https://example.cloudfunctions.net/getUser?timezone=EST&cid=widgetworks&uid=johndoe * * @generated from protobuf enum value: CONSTANT_ADDRESS = 1; */ BackendRule_PathTranslation[BackendRule_PathTranslation["CONSTANT_ADDRESS"] = 1] = "CONSTANT_ADDRESS"; /** * The request path will be appended to the backend address. * * # Examples * * Given the following operation config: * * Method path: /api/company/{cid}/user/{uid} * Backend address: https://example.appspot.com * * Requests to the following request paths will call the backend at the * translated path: * * Request path: /api/company/widgetworks/user/johndoe * Translated: * https://example.appspot.com/api/company/widgetworks/user/johndoe * * Request path: /api/company/widgetworks/user/johndoe?timezone=EST * Translated: * https://example.appspot.com/api/company/widgetworks/user/johndoe?timezone=EST * * @generated from protobuf enum value: APPEND_PATH_TO_ADDRESS = 2; */ BackendRule_PathTranslation[BackendRule_PathTranslation["APPEND_PATH_TO_ADDRESS"] = 2] = "APPEND_PATH_TO_ADDRESS"; })(BackendRule_PathTranslation = exports.BackendRule_PathTranslation || (exports.BackendRule_PathTranslation = {})); // @generated message type with reflection information, may provide speed optimized methods class Backend$Type extends runtime_5.MessageType { constructor() { super("google.api.Backend", [ { no: 1, name: "rules", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => exports.BackendRule } ]); } create(value) { const message = { rules: [] }; 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.BackendRule rules */ 1: message.rules.push(exports.BackendRule.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) { /* repeated google.api.BackendRule rules = 1; */ for (let i = 0; i < message.rules.length; i++) exports.BackendRule.internalBinaryWrite(message.rules[i], writer.tag(1, 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.Backend */ exports.Backend = new Backend$Type(); // @generated message type with reflection information, may provide speed optimized methods class BackendRule$Type extends runtime_5.MessageType { constructor() { super("google.api.BackendRule", [ { no: 1, name: "selector", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 2, name: "address", kind: "scalar", T: 9 /*ScalarType.STRING*/ }, { no: 3, name: "deadline", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 4, name: "min_deadline", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 5, name: "operation_deadline", kind: "scalar", T: 1 /*ScalarType.DOUBLE*/ }, { no: 6, name: "path_translation", kind: "enum", T: () => ["google.api.BackendRule.PathTranslation", BackendRule_PathTranslation] }, { no: 7, name: "jwt_audience", kind: "scalar", oneof: "authentication", T: 9 /*ScalarType.STRING*/ }, { no: 8, name: "disable_auth", kind: "scalar", oneof: "authentication", T: 8 /*ScalarType.BOOL*/ }, { no: 9, name: "protocol", kind: "scalar", T: 9 /*ScalarType.STRING*/ } ]); } create(value) { const message = { selector: "", address: "", deadline: 0, minDeadline: 0, operationDeadline: 0, pathTranslation: 0, authentication: { oneofKind: undefined }, protocol: "" }; 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 selector */ 1: message.selector = reader.string(); break; case /* string address */ 2: message.address = reader.string(); break; case /* double deadline */ 3: message.deadline = reader.double(); break; case /* double min_deadline */ 4: message.minDeadline = reader.double(); break; case /* double operation_deadline */ 5: message.operationDeadline = reader.double(); break; case /* google.api.BackendRule.PathTranslation path_translation */ 6: message.pathTranslation = reader.int32(); break; case /* string jwt_audience */ 7: message.authentication = { oneofKind: "jwtAudience", jwtAudience: reader.string() }; break; case /* bool disable_auth */ 8: message.authentication = { oneofKind: "disableAuth", disableAuth: reader.bool() }; break; case /* string protocol */ 9: message.protocol = 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 selector = 1; */ if (message.selector !== "") writer.tag(1, runtime_1.WireType.LengthDelimited).string(message.selector); /* string address = 2; */ if (message.address !== "") writer.tag(2, runtime_1.WireType.LengthDelimited).string(message.address); /* double deadline = 3; */ if (message.deadline !== 0) writer.tag(3, runtime_1.WireType.Bit64).double(message.deadline); /* double min_deadline = 4; */ if (message.minDeadline !== 0) writer.tag(4, runtime_1.WireType.Bit64).double(message.minDeadline); /* double operation_deadline = 5; */ if (message.operationDeadline !== 0) writer.tag(5, runtime_1.WireType.Bit64).double(message.operationDeadline); /* google.api.BackendRule.PathTranslation path_translation = 6; */ if (message.pathTranslation !== 0) writer.tag(6, runtime_1.WireType.Varint).int32(message.pathTranslation); /* string jwt_audience = 7; */ if (message.authentication.oneofKind === "jwtAudience") writer.tag(7, runtime_1.WireType.LengthDelimited).string(message.authentication.jwtAudience); /* bool disable_auth = 8; */ if (message.authentication.oneofKind === "disableAuth") writer.tag(8, runtime_1.WireType.Varint).bool(message.authentication.disableAuth); /* string protocol = 9; */ if (message.protocol !== "") writer.tag(9, runtime_1.WireType.LengthDelimited).string(message.protocol); 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.BackendRule */ exports.BackendRule = new BackendRule$Type(); //# sourceMappingURL=backend.js.map