/* 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 { EstimateRawFeeRequest } from '../models'; import { EstimateRawFeeResponse } from '../models'; import { EstimateSmartFeeRequest } from '../models'; import { EstimateSmartFeeResponse } from '../models'; import { UtilsResponseEnvelope } from '../models'; /** * FeesApi - axios parameter creator * @export */ export const FeesApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible. * @summary Estimate Raw Fee * @param {EstimateRawFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ estimateRawFee: async (body: EstimateRawFeeRequest, 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 estimateRawFee.'); } const localVarPath = `/fee/estimate-raw`; // 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, }; }, /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks * @summary Estimate smart fee * @param {EstimateSmartFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ estimateSmartFee: async (body: EstimateSmartFeeRequest, 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 estimateSmartFee.'); } const localVarPath = `/fee/estimate-smart`; // 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, }; }, } }; /** * FeesApi - functional programming interface * @export */ export const FeesApiFp = function(configuration?: Configuration) { return { /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible. * @summary Estimate Raw Fee * @param {EstimateRawFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async estimateRawFee(body: EstimateRawFeeRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await FeesApiAxiosParamCreator(configuration).estimateRawFee(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks * @summary Estimate smart fee * @param {EstimateSmartFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async estimateSmartFee(body: EstimateSmartFeeRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => Promise>> { const localVarAxiosArgs = await FeesApiAxiosParamCreator(configuration).estimateSmartFee(body, options); return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { const axiosRequestArgs :AxiosRequestConfig = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url}; return axios.request(axiosRequestArgs); }; }, } }; /** * FeesApi - factory interface * @export */ export const FeesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { return { /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible. * @summary Estimate Raw Fee * @param {EstimateRawFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async estimateRawFee(body: EstimateRawFeeRequest, options?: AxiosRequestConfig): Promise> { return FeesApiFp(configuration).estimateRawFee(body, options).then((request) => request(axios, basePath)); }, /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks * @summary Estimate smart fee * @param {EstimateSmartFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} */ async estimateSmartFee(body: EstimateSmartFeeRequest, options?: AxiosRequestConfig): Promise> { return FeesApiFp(configuration).estimateSmartFee(body, options).then((request) => request(axios, basePath)); }, }; }; /** * FeesApi - object-oriented interface * @export * @class FeesApi * @extends {BaseAPI} */ export class FeesApi extends BaseAPI { /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks if possible. * @summary Estimate Raw Fee * @param {EstimateRawFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FeesApi */ public async estimateRawFee(body: EstimateRawFeeRequest, options?: AxiosRequestConfig) : Promise> { return FeesApiFp(this.configuration).estimateRawFee(body, options).then((request) => request(this.axios, this.basePath)); } /** * Estimates the approximate fee per kilobyte needed for a transaction to begin confirmation within conf_target blocks * @summary Estimate smart fee * @param {EstimateSmartFeeRequest} body Fee estimation parameters * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof FeesApi */ public async estimateSmartFee(body: EstimateSmartFeeRequest, options?: AxiosRequestConfig) : Promise> { return FeesApiFp(this.configuration).estimateSmartFee(body, options).then((request) => request(this.axios, this.basePath)); } }