/* 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, RequestArgs, BaseAPI, RequiredError } from '../base';
import { InlineResponse2001 } from '../models';
import { InlineResponse2002 } from '../models';
/**
* AssetsApi - axios parameter creator
* @export
*/
export const AssetsApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
* Fetch a single asset from its `policy_id` and `asset_name`, with its metadata if any. The asset must be associated with the wallet.
* @summary Get Asset
* @param {string} walletId
* @param {string} policyId
* @param {string} assetName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAsset: async (walletId: string, policyId: string, assetName: string, options: any = {}): Promise => {
// 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 getAsset.');
}
// verify required parameter 'policyId' is not null or undefined
if (policyId === null || policyId === undefined) {
throw new RequiredError('policyId','Required parameter policyId was null or undefined when calling getAsset.');
}
// verify required parameter 'assetName' is not null or undefined
if (assetName === null || assetName === undefined) {
throw new RequiredError('assetName','Required parameter assetName was null or undefined when calling getAsset.');
}
const localVarPath = `/wallets/{walletId}/assets/{policyId}/{assetName}`
.replace(`{${"walletId"}}`, encodeURIComponent(String(walletId)))
.replace(`{${"policyId"}}`, encodeURIComponent(String(policyId)))
.replace(`{${"assetName"}}`, encodeURIComponent(String(assetName)));
// 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: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
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};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
* Fetch the the asset from `policy_id` with an empty name. The asset must be associated with the wallet.
* @summary Get Asset (empty name)
* @param {string} walletId
* @param {string} policyId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAssetDefault: async (walletId: string, policyId: string, options: any = {}): Promise => {
// 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 getAssetDefault.');
}
// verify required parameter 'policyId' is not null or undefined
if (policyId === null || policyId === undefined) {
throw new RequiredError('policyId','Required parameter policyId was null or undefined when calling getAssetDefault.');
}
const localVarPath = `/wallets/{walletId}/assets/{policyId}`
.replace(`{${"walletId"}}`, encodeURIComponent(String(walletId)))
.replace(`{${"policyId"}}`, encodeURIComponent(String(policyId)));
// 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: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
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};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
/**
* List all assets associated with the wallet, and their metadata if known. An asset is _associated_ with a wallet if it is involved in a transaction of the wallet.
* @summary List Assets
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listAssets: async (walletId: string, options: any = {}): Promise => {
// 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 listAssets.');
}
const localVarPath = `/wallets/{walletId}/assets`
.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: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
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};
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
},
}
};
/**
* AssetsApi - functional programming interface
* @export
*/
export const AssetsApiFp = function(configuration?: Configuration) {
return {
/**
* Fetch a single asset from its `policy_id` and `asset_name`, with its metadata if any. The asset must be associated with the wallet.
* @summary Get Asset
* @param {string} walletId
* @param {string} policyId
* @param {string} assetName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAsset(walletId: string, policyId: string, assetName: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await AssetsApiAxiosParamCreator(configuration).getAsset(walletId, policyId, assetName, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* Fetch the the asset from `policy_id` with an empty name. The asset must be associated with the wallet.
* @summary Get Asset (empty name)
* @param {string} walletId
* @param {string} policyId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAssetDefault(walletId: string, policyId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> {
const localVarAxiosArgs = await AssetsApiAxiosParamCreator(configuration).getAssetDefault(walletId, policyId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
/**
* List all assets associated with the wallet, and their metadata if known. An asset is _associated_ with a wallet if it is involved in a transaction of the wallet.
* @summary List Assets
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async listAssets(walletId: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> {
const localVarAxiosArgs = await AssetsApiAxiosParamCreator(configuration).listAssets(walletId, options);
return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
return axios.request(axiosRequestArgs);
};
},
}
};
/**
* AssetsApi - factory interface
* @export
*/
export const AssetsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
return {
/**
* Fetch a single asset from its `policy_id` and `asset_name`, with its metadata if any. The asset must be associated with the wallet.
* @summary Get Asset
* @param {string} walletId
* @param {string} policyId
* @param {string} assetName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAsset(walletId: string, policyId: string, assetName: string, options?: any): AxiosPromise {
return AssetsApiFp(configuration).getAsset(walletId, policyId, assetName, options).then((request) => request(axios, basePath));
},
/**
* Fetch the the asset from `policy_id` with an empty name. The asset must be associated with the wallet.
* @summary Get Asset (empty name)
* @param {string} walletId
* @param {string} policyId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAssetDefault(walletId: string, policyId: string, options?: any): AxiosPromise {
return AssetsApiFp(configuration).getAssetDefault(walletId, policyId, options).then((request) => request(axios, basePath));
},
/**
* List all assets associated with the wallet, and their metadata if known. An asset is _associated_ with a wallet if it is involved in a transaction of the wallet.
* @summary List Assets
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
listAssets(walletId: string, options?: any): AxiosPromise> {
return AssetsApiFp(configuration).listAssets(walletId, options).then((request) => request(axios, basePath));
},
};
};
/**
* AssetsApi - object-oriented interface
* @export
* @class AssetsApi
* @extends {BaseAPI}
*/
export class AssetsApi extends BaseAPI {
/**
* Fetch a single asset from its `policy_id` and `asset_name`, with its metadata if any. The asset must be associated with the wallet.
* @summary Get Asset
* @param {string} walletId
* @param {string} policyId
* @param {string} assetName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AssetsApi
*/
public getAsset(walletId: string, policyId: string, assetName: string, options?: any) {
return AssetsApiFp(this.configuration).getAsset(walletId, policyId, assetName, options).then((request) => request(this.axios, this.basePath));
}
/**
* Fetch the the asset from `policy_id` with an empty name. The asset must be associated with the wallet.
* @summary Get Asset (empty name)
* @param {string} walletId
* @param {string} policyId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AssetsApi
*/
public getAssetDefault(walletId: string, policyId: string, options?: any) {
return AssetsApiFp(this.configuration).getAssetDefault(walletId, policyId, options).then((request) => request(this.axios, this.basePath));
}
/**
* List all assets associated with the wallet, and their metadata if known. An asset is _associated_ with a wallet if it is involved in a transaction of the wallet.
* @summary List Assets
* @param {string} walletId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof AssetsApi
*/
public listAssets(walletId: string, options?: any) {
return AssetsApiFp(this.configuration).listAssets(walletId, options).then((request) => request(this.axios, this.basePath));
}
}