/* tslint:disable */ /* eslint-disable */ /** * Satstream API * Satstream API * * OpenAPI spec version: 1.0 * Contact: team@satstream.io * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. */ import globalAxios, { AxiosResponse, AxiosInstance, AxiosRequestConfig } from 'axios'; import { Configuration } from '../configuration'; // Some imports not used depending on template conditions // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; import { GetChainTxStatsRequest } from '../models'; import { GetChainTxStatsResponse } from '../models'; import { GetDifficultyResponse } from '../models'; import { UtilsResponseEnvelope } from '../models'; /** * NetworkApi - axios parameter creator * @export */ export const NetworkApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Computes statistics about the total number and rate of transactions in the chain * @summary Get chain tx stats * @param {GetChainTxStatsRequest} body Chain tx stats request parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChainTxStats: async (body: GetChainTxStatsRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new RequiredError('body','Required parameter body was null or undefined when calling getChainTxStats.'); } const localVarPath = `/chain/txstats`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'POST', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } localVarHeaderParameter['Content-Type'] = 'application/json'; const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; const needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, /** * Returns the proof-of-work difficulty as a multiple of the minimum difficulty * @summary Get difficulty * @param {*} [options] Override http request option. * @throws {RequiredError} */ getDifficulty: async (options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/chain/difficulty`; // use dummy base URL string because the URL constructor only accepts absolute URLs. const localVarUrlObj = new URL(localVarPath, 'https://example.com'); let baseOptions; if (configuration) { baseOptions = configuration.baseOptions; } const localVarRequestOptions :AxiosRequestConfig = { method: 'GET', ...baseOptions, ...options}; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication ApiKeyAuth required if (configuration && configuration.apiKey) { const localVarApiKeyValue = typeof configuration.apiKey === 'function' ? await configuration.apiKey("X-API-KEY") : await configuration.apiKey; localVarHeaderParameter["X-API-KEY"] = localVarApiKeyValue; } const query = new URLSearchParams(localVarUrlObj.search); for (const key in localVarQueryParameter) { query.set(key, localVarQueryParameter[key]); } for (const key in options.params) { query.set(key, options.params[key]); } localVarUrlObj.search = (new URLSearchParams(query)).toString(); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash, options: localVarRequestOptions, }; }, } }; /** * NetworkApi - functional programming interface * @export */ export const NetworkApiFp = function(configuration?: Configuration) { return { /** * Computes statistics about the total number and rate of transactions in the chain * @summary Get chain tx stats * @param {GetChainTxStatsRequest} body Chain tx stats request parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getChainTxStats(body: GetChainTxStatsRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await NetworkApiAxiosParamCreator(configuration).getChainTxStats(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Returns the proof-of-work difficulty as a multiple of the minimum difficulty * @summary Get difficulty * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDifficulty(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await NetworkApiAxiosParamCreator(configuration).getDifficulty(options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * NetworkApi - factory interface * @export */ export const NetworkApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Computes statistics about the total number and rate of transactions in the chain * @summary Get chain tx stats * @param {GetChainTxStatsRequest} body Chain tx stats request parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getChainTxStats(body: GetChainTxStatsRequest, options?: AxiosRequestConfig): Promise> { return NetworkApiFp(configuration).getChainTxStats(body, options).then((request) => request(axios, basePath)); }, /** * Returns the proof-of-work difficulty as a multiple of the minimum difficulty * @summary Get difficulty * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getDifficulty(options?: AxiosRequestConfig): Promise> { return NetworkApiFp(configuration).getDifficulty(options).then((request) => request(axios, basePath)); }, }; }; /** * NetworkApi - object-oriented interface * @export * @class NetworkApi * @extends {BaseAPI} */ export class NetworkApi extends BaseAPI { /** * Computes statistics about the total number and rate of transactions in the chain * @summary Get chain tx stats * @param {GetChainTxStatsRequest} body Chain tx stats request parameters * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NetworkApi */ public async getChainTxStats(body: GetChainTxStatsRequest, options?: AxiosRequestConfig) : Promise> { return NetworkApiFp(this.configuration).getChainTxStats(body, options).then((request) => request(this.axios, this.basePath)); } /** * Returns the proof-of-work difficulty as a multiple of the minimum difficulty * @summary Get difficulty * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof NetworkApi */ public async getDifficulty(options?: AxiosRequestConfig) : Promise> { return NetworkApiFp(this.configuration).getDifficulty(options).then((request) => request(this.axios, this.basePath)); } }