/* tslint:disable */
/* eslint-disable */
/**
* Cardano Wallet Backend API
*

*
* OpenAPI spec version: 2021.3.4
*
*
* 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, { AxiosPromise, AxiosInstance } 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 { BadRequest } from '../models';
import { ApiPostTransactionFeeData } from '../models';
import { ApiCoinSelection } from '../models';
import { InlineResponse4035 } from '../models';
import { NoSuchWallet } from '../models';
import { NotAcceptable } from '../models';
import { UnsupportedMediaType } from '../models';
/**
* CoinSelectionsApi - axios parameter creator
* @export
*/
export const CoinSelectionsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* status: stable
Select coins to cover the given set of payments. Uses the Random-Improve coin selection algorithm.
* @summary Random
* @param {ApiPostTransactionFeeData} body
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
selectCoins: async (body: ApiPostTransactionFeeData, walletId: string, options: any = {}): 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 selectCoins.');
}
// verify required parameter 'walletId' is not null or undefined
if (walletId === null || walletId === undefined) {
throw new RequiredError('walletId','Required parameter walletId was null or undefined when calling selectCoins.');
}
const localVarPath = `/wallets/{walletId}/coin-selections/random`
.replace(`{${"walletId"}}`, encodeURIComponent(String(walletId)));
// 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 = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
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.query) {
query.set(key, options.query[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,
};
},
}
};
/**
* CoinSelectionsApi - functional programming interface
* @export
*/
export const CoinSelectionsApiFp = function(configuration?: Configuration) {
return {
/**
* status: stable
Select coins to cover the given set of payments. Uses the Random-Improve coin selection algorithm.
* @summary Random
* @param {ApiPostTransactionFeeData} body
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async selectCoins(body: ApiPostTransactionFeeData, walletId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await CoinSelectionsApiAxiosParamCreator(configuration).selectCoins(body, walletId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* CoinSelectionsApi - factory interface
* @export
*/
export const CoinSelectionsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* status: stable
Select coins to cover the given set of payments. Uses the Random-Improve coin selection algorithm.
* @summary Random
* @param {ApiPostTransactionFeeData} body
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
selectCoins(body: ApiPostTransactionFeeData, walletId: string, options?: any): AxiosPromise {
return CoinSelectionsApiFp(configuration).selectCoins(body, walletId, options).then((request) => request(axios, basePath));
},
};
};
/**
* CoinSelectionsApi - object-oriented interface
* @export
* @class CoinSelectionsApi
* @extends {BaseAPI}
*/
export class CoinSelectionsApi extends BaseAPI {
/**
* status: stable
Select coins to cover the given set of payments. Uses the Random-Improve coin selection algorithm.
* @summary Random
* @param {ApiPostTransactionFeeData} body
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof CoinSelectionsApi
*/
public selectCoins(body: ApiPostTransactionFeeData, walletId: string, options?: any) {
return CoinSelectionsApiFp(this.configuration).selectCoins(body, walletId, options).then((request) => request(this.axios, this.basePath));
}
}