UNPKG

@openzeppelin/relayer-sdk

Version:
250 lines (249 loc) 14.5 kB
/* tslint:disable */ /* eslint-disable */ /** * OpenZeppelin Relayer API * OpenZeppelin Relayer API * * The version of the OpenAPI document: 1.3.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setBearerAuthToObject, setSearchParams, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, BaseAPI, operationServerMap } from '../base'; /** * MetricsApi - axios parameter creator * @export */ export const MetricsApiAxiosParamCreator = function (configuration) { return { /** * Note: OpenAPI documentation for these endpoints can be found in the `openapi.rs` file Returns a list of all available metric names in JSON format. # Returns An `HttpResponse` containing a JSON array of metric names. * @summary Metrics routes implementation * @param {*} [options] Override http request option. * @throws {RequiredError} */ listMetrics: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) { const localVarPath = `/metrics`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * # Parameters - `path`: The name of the metric to retrieve details for. # Returns An `HttpResponse` containing the metric details in plain text, or a 404 error if the metric is not found. * @summary Returns the details of a specific metric in plain text format. * @param {string} metricName Name of the metric to retrieve, e.g. utopia_transactions_total * @param {*} [options] Override http request option. * @throws {RequiredError} */ metricDetail: (metricName_1, ...args_1) => __awaiter(this, [metricName_1, ...args_1], void 0, function* (metricName, options = {}) { // verify required parameter 'metricName' is not null or undefined assertParamExists('metricDetail', 'metricName', metricName); const localVarPath = `/metrics/{metric_name}` .replace(`{${"metric_name"}}`, encodeURIComponent(String(metricName))); // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; // authentication bearer_auth required // http bearer authentication required yield setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), /** * # Returns An `HttpResponse` containing the updated metrics in plain text, or an error message if the update fails. * @summary Triggers an update of system metrics and returns the result in plain text format. * @param {*} [options] Override http request option. * @throws {RequiredError} */ scrapeMetrics: (...args_1) => __awaiter(this, [...args_1], void 0, function* (options = {}) { const localVarPath = `/debug/metrics/scrape`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }), }; }; /** * MetricsApi - functional programming interface * @export */ export const MetricsApiFp = function (configuration) { const localVarAxiosParamCreator = MetricsApiAxiosParamCreator(configuration); return { /** * Note: OpenAPI documentation for these endpoints can be found in the `openapi.rs` file Returns a list of all available metric names in JSON format. # Returns An `HttpResponse` containing a JSON array of metric names. * @summary Metrics routes implementation * @param {*} [options] Override http request option. * @throws {RequiredError} */ listMetrics(options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.listMetrics(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['MetricsApi.listMetrics']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * # Parameters - `path`: The name of the metric to retrieve details for. # Returns An `HttpResponse` containing the metric details in plain text, or a 404 error if the metric is not found. * @summary Returns the details of a specific metric in plain text format. * @param {string} metricName Name of the metric to retrieve, e.g. utopia_transactions_total * @param {*} [options] Override http request option. * @throws {RequiredError} */ metricDetail(metricName, options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.metricDetail(metricName, options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['MetricsApi.metricDetail']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, /** * # Returns An `HttpResponse` containing the updated metrics in plain text, or an error message if the update fails. * @summary Triggers an update of system metrics and returns the result in plain text format. * @param {*} [options] Override http request option. * @throws {RequiredError} */ scrapeMetrics(options) { return __awaiter(this, void 0, void 0, function* () { var _a, _b, _c; const localVarAxiosArgs = yield localVarAxiosParamCreator.scrapeMetrics(options); const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0; const localVarOperationServerBasePath = (_c = (_b = operationServerMap['MetricsApi.scrapeMetrics']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url; return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); }); }, }; }; /** * MetricsApi - factory interface * @export */ export const MetricsApiFactory = function (configuration, basePath, axios) { const localVarFp = MetricsApiFp(configuration); return { /** * Note: OpenAPI documentation for these endpoints can be found in the `openapi.rs` file Returns a list of all available metric names in JSON format. # Returns An `HttpResponse` containing a JSON array of metric names. * @summary Metrics routes implementation * @param {*} [options] Override http request option. * @throws {RequiredError} */ listMetrics(options) { return localVarFp.listMetrics(options).then((request) => request(axios, basePath)); }, /** * # Parameters - `path`: The name of the metric to retrieve details for. # Returns An `HttpResponse` containing the metric details in plain text, or a 404 error if the metric is not found. * @summary Returns the details of a specific metric in plain text format. * @param {string} metricName Name of the metric to retrieve, e.g. utopia_transactions_total * @param {*} [options] Override http request option. * @throws {RequiredError} */ metricDetail(metricName, options) { return localVarFp.metricDetail(metricName, options).then((request) => request(axios, basePath)); }, /** * # Returns An `HttpResponse` containing the updated metrics in plain text, or an error message if the update fails. * @summary Triggers an update of system metrics and returns the result in plain text format. * @param {*} [options] Override http request option. * @throws {RequiredError} */ scrapeMetrics(options) { return localVarFp.scrapeMetrics(options).then((request) => request(axios, basePath)); }, }; }; /** * MetricsApi - object-oriented interface * @export * @class MetricsApi * @extends {BaseAPI} */ export class MetricsApi extends BaseAPI { /** * Note: OpenAPI documentation for these endpoints can be found in the `openapi.rs` file Returns a list of all available metric names in JSON format. # Returns An `HttpResponse` containing a JSON array of metric names. * @summary Metrics routes implementation * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MetricsApi */ listMetrics(options) { return MetricsApiFp(this.configuration).listMetrics(options).then((request) => request(this.axios, this.basePath)); } /** * # Parameters - `path`: The name of the metric to retrieve details for. # Returns An `HttpResponse` containing the metric details in plain text, or a 404 error if the metric is not found. * @summary Returns the details of a specific metric in plain text format. * @param {string} metricName Name of the metric to retrieve, e.g. utopia_transactions_total * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MetricsApi */ metricDetail(metricName, options) { return MetricsApiFp(this.configuration).metricDetail(metricName, options).then((request) => request(this.axios, this.basePath)); } /** * # Returns An `HttpResponse` containing the updated metrics in plain text, or an error message if the update fails. * @summary Triggers an update of system metrics and returns the result in plain text format. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof MetricsApi */ scrapeMetrics(options) { return MetricsApiFp(this.configuration).scrapeMetrics(options).then((request) => request(this.axios, this.basePath)); } }