// @flow
/* eslint-disable no-use-before-define */
/**
 * FX Historical REST API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: v1
 * Contact: support@apibricks.io
 *
 * NOTE: This class is auto generated by OpenAPI-Generator
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as url from "url";
import * as portableFetch from "portable-fetch";
import { Configuration } from "./configuration";

const BASE_PATH: string = "https://api-historical.fx.finfeedapi.com".replace(/\/+$/, "");

/**
 *
 * @export
 */
export const COLLECTION_FORMATS = {
    csv: ",",
    ssv: " ",
    tsv: "\t",
    pipes: "|",
};

/**
 *
 * @export
 */
export type FetchAPI = {
    (url: string, init?: any): Promise<Response>;
}

/**
 *
 * @export
 */
export type FetchArgs = {
    url: string;
    options: {};
}

/**
 *
 * @export
 */
export type RequestOptions = {
    headers?: {};
    query?: {};
    body?: string | FormData;
}

/**
 * * @export
 * @class RequiredError
 * @extends {Error}
 */
export class RequiredError extends Error {
    name:string = "RequiredError"
    constructor(field: string, msg?: string) {
        super(msg);
    }
}

/**
 * Represents an asset.
 * @export
 */
export type V1Asset = {
    /**
     * Gets or sets the asset ID.
     * @type {string}
     * @memberof V1Asset
     */
    asset_id?: string;
    /**
     * Gets or sets the name of the asset.
     * @type {string}
     * @memberof V1Asset
     */
    name?: string;
    /**
     * Gets or sets a value indicating whether the asset is a cryptocurrency.
     * @type {number}
     * @memberof V1Asset
     */
    type_is_crypto?: number;
    /**
     * Gets or sets the start date of quote data.
     * @type {Date}
     * @memberof V1Asset
     */
    data_quote_start?: Date;
    /**
     * Gets or sets the end date of quote data.
     * @type {Date}
     * @memberof V1Asset
     */
    data_quote_end?: Date;
    /**
     * Gets or sets the start date of order book data.
     * @type {Date}
     * @memberof V1Asset
     */
    data_orderbook_start?: Date;
    /**
     * Gets or sets the end date of order book data.
     * @type {Date}
     * @memberof V1Asset
     */
    data_orderbook_end?: Date;
    /**
     * Gets or sets the start date of trade data.
     * @type {Date}
     * @memberof V1Asset
     */
    data_trade_start?: Date;
    /**
     * Gets or sets the end date of trade data.
     * @type {Date}
     * @memberof V1Asset
     */
    data_trade_end?: Date;
    /**
     * Gets or sets the number of symbols.
     * @type {number}
     * @memberof V1Asset
     */
    data_symbols_count?: number;
    /**
     * Gets or sets the USD volume in the last 1 hour.
     * @type {number}
     * @memberof V1Asset
     */
    volume_1hrs_usd?: number;
    /**
     * Gets or sets the USD volume in the last 1 day.
     * @type {number}
     * @memberof V1Asset
     */
    volume_1day_usd?: number;
    /**
     * Gets or sets the USD volume in the last 1 month.
     * @type {number}
     * @memberof V1Asset
     */
    volume_1mth_usd?: number;
    /**
     * Gets or sets the USD price of the asset.
     * @type {number}
     * @memberof V1Asset
     */
    price_usd?: number;
    /**
     * Gets or sets the ID of the icon for the asset.
     * @type {string}
     * @memberof V1Asset
     */
    id_icon?: string;
    /**
     * Gets or sets the current supply of the asset.
     * @type {number}
     * @memberof V1Asset
     */
    supply_current?: number;
    /**
     * Gets or sets the total supply of the asset.
     * @type {number}
     * @memberof V1Asset
     */
    supply_total?: number;
    /**
     * Gets or sets the maximum supply of the asset.
     * @type {number}
     * @memberof V1Asset
     */
    supply_max?: number;
    /**
     * 
     * @type {Array<V1ChainNetworkAddress>}
     * @memberof V1Asset
     */
    chain_addresses?: Array<V1ChainNetworkAddress>;
    /**
     * 
     * @type {string}
     * @memberof V1Asset
     */
    data_start?: string;
    /**
     * 
     * @type {string}
     * @memberof V1Asset
     */
    data_end?: string;
}

/**
 * Contains information about assets\' chain network addresses
 * @export
 */
export type V1ChainNetworkAddress = {
    /**
     * Gets or sets chain id
     * @type {string}
     * @memberof V1ChainNetworkAddress
     */
    chain_id?: string;
    /**
     * Gets or sets network id
     * @type {string}
     * @memberof V1ChainNetworkAddress
     */
    network_id?: string;
    /**
     * Gets or sets chain address
     * @type {string}
     * @memberof V1ChainNetworkAddress
     */
    address?: string;
}

/**
 * Represents an exchange rate.
 * @export
 */
export type V1ExchangeRate = {
    /**
     * Gets or sets the time of the exchange rate.
     * @type {Date}
     * @memberof V1ExchangeRate
     */
    time?: Date;
    /**
     * Gets or sets the base asset ID of the exchange rate.
     * @type {string}
     * @memberof V1ExchangeRate
     */
    asset_id_base?: string;
    /**
     * Gets or sets the quote asset ID of the exchange rate.
     * @type {string}
     * @memberof V1ExchangeRate
     */
    asset_id_quote?: string;
    /**
     * Gets or sets the exchange rate value.
     * @type {number}
     * @memberof V1ExchangeRate
     */
    rate?: number;
}

/**
 * Represents exchange rates for a specific base asset.
 * @export
 */
export type V1ExchangeRates = {
    /**
     * Gets or sets the base asset ID.
     * @type {string}
     * @memberof V1ExchangeRates
     */
    asset_id_base?: string;
    /**
     * Gets or sets the list of exchange rates.
     * @type {Array<V1ExchangeRatesRate>}
     * @memberof V1ExchangeRates
     */
    rates?: Array<V1ExchangeRatesRate>;
}

/**
 * Represents an exchange rate within a collection of exchange rates.
 * @export
 */
export type V1ExchangeRatesRate = {
    /**
     * Gets or sets the time of the exchange rate.
     * @type {Date}
     * @memberof V1ExchangeRatesRate
     */
    time?: Date;
    /**
     * Gets or sets the quote asset ID of the exchange rate.
     * @type {string}
     * @memberof V1ExchangeRatesRate
     */
    asset_id_quote?: string;
    /**
     * Gets or sets the exchange rate value.
     * @type {number}
     * @memberof V1ExchangeRatesRate
     */
    rate?: number;
}

/**
 * Represents an item in the exchange rate timeseries.
 * @export
 */
export type V1ExchangeRatesTimeseriesItem = {
    /**
     * Gets or sets the start time of the period.
     * @type {Date}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    time_period_start?: Date;
    /**
     * Gets or sets the end time of the period.
     * @type {Date}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    time_period_end?: Date;
    /**
     * Gets or sets the opening time of the period.
     * @type {Date}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    time_open?: Date;
    /**
     * Gets or sets the closing time of the period.
     * @type {Date}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    time_close?: Date;
    /**
     * Gets or sets the opening rate for the period.
     * @type {number}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    rate_open?: number;
    /**
     * Gets or sets the highest rate for the period.
     * @type {number}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    rate_high?: number;
    /**
     * Gets or sets the lowest rate for the period.
     * @type {number}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    rate_low?: number;
    /**
     * Gets or sets the closing rate for the period.
     * @type {number}
     * @memberof V1ExchangeRatesTimeseriesItem
     */
    rate_close?: number;
}

/**
 * Represents an icon.
 * @export
 */
export type V1Icon = {
    /**
     * Gets or sets the exchange ID associated with the icon.
     * @type {string}
     * @memberof V1Icon
     */
    exchange_id?: string;
    /**
     * Gets or sets the asset ID associated with the icon.
     * @type {string}
     * @memberof V1Icon
     */
    asset_id?: string;
    /**
     * Gets or sets the URL of the icon.
     * @type {string}
     * @memberof V1Icon
     */
    url?: string;
}

/**
 * Represents a timeseries period used in exchange rate data.
 * @export
 */
export type V1TimeseriesPeriod = {
    /**
     * The period ID.
     * @type {string}
     * @memberof V1TimeseriesPeriod
     */
    period_id?: string;
    /**
     * The length of the period in seconds.
     * @type {number}
     * @memberof V1TimeseriesPeriod
     */
    length_seconds?: number;
    /**
     * The length of the period in months.
     * @type {number}
     * @memberof V1TimeseriesPeriod
     */
    length_months?: number;
    /**
     * The unit count.
     * @type {number}
     * @memberof V1TimeseriesPeriod
     */
    unit_count?: number;
    /**
     * The unit name.
     * @type {string}
     * @memberof V1TimeseriesPeriod
     */
    unit_name?: string;
    /**
     * The display name of the timeseries period.
     * @type {string}
     * @memberof V1TimeseriesPeriod
     */
    display_name?: string;
}



/**
 * ExchangeRatesApi - fetch parameter creator
 * @export
 */
export const ExchangeRatesApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Retrieves the exchange rate for a specific base and quote asset at a given time or the current rate.              :::info If you are using an exchange rate for mission-critical operations, then for best reliability, you should measure the difference between current time and the time returned from the response to ensure that value of the difference between those meets your internal requirements. :::
         * @summary Get specific rate
         * @throws {RequiredError}
         */
        getSpecificRate(assetIdBase: string, assetIdQuote: string, time?: string, options: RequestOptions): FetchArgs {
            // verify required parameter 'assetIdBase' is not null or undefined
            if (assetIdBase === null || assetIdBase === undefined) {
                throw new RequiredError('assetIdBase','Required parameter assetIdBase was null or undefined when calling getSpecificRate.');
            }
            // verify required parameter 'assetIdQuote' is not null or undefined
            if (assetIdQuote === null || assetIdQuote === undefined) {
                throw new RequiredError('assetIdQuote','Required parameter assetIdQuote was null or undefined when calling getSpecificRate.');
            }
            const localVarPath = `/v1/exchangerate/{asset_id_base}/{asset_id_quote}`
                .replace(`{${"asset_id_base"}}`, encodeURIComponent(String(assetIdBase)))
                .replace(`{${"asset_id_quote"}}`, encodeURIComponent(String(assetIdQuote)));
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            if (time !== undefined) {
                localVarQueryParameter['time'] = ((time:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Get the historical exchange rates between two assets in the form of the timeseries.
         * @summary Timeseries data
         * @throws {RequiredError}
         */
        v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet(assetIdBase: string, assetIdQuote: string, periodId?: string, timeStart?: string, timeEnd?: string, limit?: number, options: RequestOptions): FetchArgs {
            // verify required parameter 'assetIdBase' is not null or undefined
            if (assetIdBase === null || assetIdBase === undefined) {
                throw new RequiredError('assetIdBase','Required parameter assetIdBase was null or undefined when calling v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet.');
            }
            // verify required parameter 'assetIdQuote' is not null or undefined
            if (assetIdQuote === null || assetIdQuote === undefined) {
                throw new RequiredError('assetIdQuote','Required parameter assetIdQuote was null or undefined when calling v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet.');
            }
            const localVarPath = `/v1/exchangerate/{asset_id_base}/{asset_id_quote}/history`
                .replace(`{${"asset_id_base"}}`, encodeURIComponent(String(assetIdBase)))
                .replace(`{${"asset_id_quote"}}`, encodeURIComponent(String(assetIdQuote)));
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            if (periodId !== undefined) {
                localVarQueryParameter['period_id'] = ((periodId:any):string);
            }

            if (timeStart !== undefined) {
                localVarQueryParameter['time_start'] = ((timeStart:any):string);
            }

            if (timeEnd !== undefined) {
                localVarQueryParameter['time_end'] = ((timeEnd:any):string);
            }

            if (limit !== undefined) {
                localVarQueryParameter['limit'] = ((limit:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Get the current exchange rate between requested asset and all other assets.              :::info If you are using an exchange rate for mission-critical operations, then for best reliability, you should measure the difference between current time and the time returned from the response to ensure that value of the difference between those meets your internal requirements. :::              :::info You can invert the rates by using Y = 1 / X equation, for example BTC/USD = 1 / (USD/BTC); :::
         * @summary Get all current rates
         * @throws {RequiredError}
         */
        v1ExchangerateAssetIdBaseGet(assetIdBase: string, filterAssetId?: string, invert?: boolean, time?: string, options: RequestOptions): FetchArgs {
            // verify required parameter 'assetIdBase' is not null or undefined
            if (assetIdBase === null || assetIdBase === undefined) {
                throw new RequiredError('assetIdBase','Required parameter assetIdBase was null or undefined when calling v1ExchangerateAssetIdBaseGet.');
            }
            const localVarPath = `/v1/exchangerate/{asset_id_base}`
                .replace(`{${"asset_id_base"}}`, encodeURIComponent(String(assetIdBase)));
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            if (filterAssetId !== undefined) {
                localVarQueryParameter['filter_asset_id'] = ((filterAssetId:any):string);
            }

            if (invert !== undefined) {
                localVarQueryParameter['invert'] = ((invert:any):string);
            }

            if (time !== undefined) {
                localVarQueryParameter['time'] = ((time:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * You can also obtain historical exchange rates of any asset pair, grouped into time periods. Get full list of supported time periods available for requesting exchange rates historical timeseries data.              ## Timeseries periods Time unit | Period identifiers --- | --- Second | 1SEC, 2SEC, 3SEC, 4SEC, 5SEC, 6SEC, 10SEC, 15SEC, 20SEC, 30SEC Minute | 1MIN, 2MIN, 3MIN, 4MIN, 5MIN, 6MIN, 10MIN, 15MIN, 20MIN, 30MIN Hour | 1HRS, 2HRS, 3HRS, 4HRS, 6HRS, 8HRS, 12HRS Day | 1DAY, 2DAY, 3DAY, 5DAY, 7DAY, 10DAY
         * @summary Timeseries periods
         * @throws {RequiredError}
         */
        v1ExchangerateHistoryPeriodsGet(options: RequestOptions): FetchArgs {
            const localVarPath = `/v1/exchangerate/history/periods`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type ExchangeRatesApiType = { 
    getSpecificRate(assetIdBase: string, assetIdQuote: string, time?: string, options?: RequestOptions): Promise<V1ExchangeRate>,

    v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet(assetIdBase: string, assetIdQuote: string, periodId?: string, timeStart?: string, timeEnd?: string, limit?: number, options?: RequestOptions): Promise<Array<V1ExchangeRatesTimeseriesItem>>,

    v1ExchangerateAssetIdBaseGet(assetIdBase: string, filterAssetId?: string, invert?: boolean, time?: string, options?: RequestOptions): Promise<V1ExchangeRates>,

    v1ExchangerateHistoryPeriodsGet(options?: RequestOptions): Promise<Array<V1TimeseriesPeriod>>,
}

/**
 * ExchangeRatesApi - factory function to inject configuration 
 * @export
 */
export const ExchangeRatesApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): ExchangeRatesApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * Retrieves the exchange rate for a specific base and quote asset at a given time or the current rate.              :::info If you are using an exchange rate for mission-critical operations, then for best reliability, you should measure the difference between current time and the time returned from the response to ensure that value of the difference between those meets your internal requirements. :::
         * @summary Get specific rate
         * @throws {RequiredError}
         */
        getSpecificRate(assetIdBase: string, assetIdQuote: string, time?: string, options?: RequestOptions = {}): Promise<V1ExchangeRate> {
            const localVarFetchArgs = ExchangeRatesApiFetchParamCreator(configuration).getSpecificRate(assetIdBase, assetIdQuote, time, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
        /**
         * Get the historical exchange rates between two assets in the form of the timeseries.
         * @summary Timeseries data
         * @throws {RequiredError}
         */
        v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet(assetIdBase: string, assetIdQuote: string, periodId?: string, timeStart?: string, timeEnd?: string, limit?: number, options?: RequestOptions = {}): Promise<Array<V1ExchangeRatesTimeseriesItem>> {
            const localVarFetchArgs = ExchangeRatesApiFetchParamCreator(configuration).v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet(assetIdBase, assetIdQuote, periodId, timeStart, timeEnd, limit, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
        /**
         * Get the current exchange rate between requested asset and all other assets.              :::info If you are using an exchange rate for mission-critical operations, then for best reliability, you should measure the difference between current time and the time returned from the response to ensure that value of the difference between those meets your internal requirements. :::              :::info You can invert the rates by using Y = 1 / X equation, for example BTC/USD = 1 / (USD/BTC); :::
         * @summary Get all current rates
         * @throws {RequiredError}
         */
        v1ExchangerateAssetIdBaseGet(assetIdBase: string, filterAssetId?: string, invert?: boolean, time?: string, options?: RequestOptions = {}): Promise<V1ExchangeRates> {
            const localVarFetchArgs = ExchangeRatesApiFetchParamCreator(configuration).v1ExchangerateAssetIdBaseGet(assetIdBase, filterAssetId, invert, time, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
        /**
         * You can also obtain historical exchange rates of any asset pair, grouped into time periods. Get full list of supported time periods available for requesting exchange rates historical timeseries data.              ## Timeseries periods Time unit | Period identifiers --- | --- Second | 1SEC, 2SEC, 3SEC, 4SEC, 5SEC, 6SEC, 10SEC, 15SEC, 20SEC, 30SEC Minute | 1MIN, 2MIN, 3MIN, 4MIN, 5MIN, 6MIN, 10MIN, 15MIN, 20MIN, 30MIN Hour | 1HRS, 2HRS, 3HRS, 4HRS, 6HRS, 8HRS, 12HRS Day | 1DAY, 2DAY, 3DAY, 5DAY, 7DAY, 10DAY
         * @summary Timeseries periods
         * @throws {RequiredError}
         */
        v1ExchangerateHistoryPeriodsGet(options?: RequestOptions = {}): Promise<Array<V1TimeseriesPeriod>> {
            const localVarFetchArgs = ExchangeRatesApiFetchParamCreator(configuration).v1ExchangerateHistoryPeriodsGet(options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
    }
};


/**
 * MetadataApi - fetch parameter creator
 * @export
 */
export const MetadataApiFetchParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * 
         * @summary List all assets by asset ID
         * @throws {RequiredError}
         */
        v1AssetsAssetIdGet(assetId: string, options: RequestOptions): FetchArgs {
            // verify required parameter 'assetId' is not null or undefined
            if (assetId === null || assetId === undefined) {
                throw new RequiredError('assetId','Required parameter assetId was null or undefined when calling v1AssetsAssetIdGet.');
            }
            const localVarPath = `/v1/assets/{asset_id}`
                .replace(`{${"asset_id"}}`, encodeURIComponent(String(assetId)));
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Retrieves all assets.              :::info Our asset identifiers are aligned with the ISO 4217 currency codes standard only for fiat money (government or law regulated currency). :::              :::info Properties of the output are providing aggregated information from across all symbols related to the specific asset. If you need to calculate your aggregation (e.g., limiting only the particular type of symbols), you should use /v1/symbols endpoint as a data source. :::
         * @summary List all assets
         * @throws {RequiredError}
         */
        v1AssetsGet(filterAssetId?: string, options: RequestOptions): FetchArgs {
            const localVarPath = `/v1/assets`;
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            if (filterAssetId !== undefined) {
                localVarQueryParameter['filter_asset_id'] = ((filterAssetId:any):string);
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Gets the list of icons (of the given size) for all the assets.
         * @summary List all asset icons
         * @throws {RequiredError}
         */
        v1AssetsIconsSizeGet(size: number, options: RequestOptions): FetchArgs {
            // verify required parameter 'size' is not null or undefined
            if (size === null || size === undefined) {
                throw new RequiredError('size','Required parameter size was null or undefined when calling v1AssetsIconsSizeGet.');
            }
            const localVarPath = `/v1/assets/icons/{size}`
                .replace(`{${"size"}}`, encodeURIComponent(String(size)));
            const localVarUrlObj = url.parse(localVarPath, true);
            const localVarRequestOptions: RequestOptions = Object.assign({}, { method: 'GET' }, options);
            const localVarHeaderParameter = {};
            const localVarQueryParameter = {};

            // authentication APIKey required
            if (configuration && configuration.apiKey) {
                const localVarApiKeyValue = typeof configuration.apiKey === 'function'
                    ? configuration.apiKey("X-CoinAPI-Key")
                    : configuration.apiKey;
                localVarHeaderParameter["X-CoinAPI-Key"] = localVarApiKeyValue;
            }

            localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query);
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            localVarUrlObj.search = null;
            localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers);

            return {
                url: url.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

export type MetadataApiType = { 
    v1AssetsAssetIdGet(assetId: string, options?: RequestOptions): Promise<Array<V1Asset>>,

    v1AssetsGet(filterAssetId?: string, options?: RequestOptions): Promise<Array<V1Asset>>,

    v1AssetsIconsSizeGet(size: number, options?: RequestOptions): Promise<Array<V1Icon>>,
}

/**
 * MetadataApi - factory function to inject configuration 
 * @export
 */
export const MetadataApi = function(configuration?: Configuration, fetch: FetchAPI = portableFetch): MetadataApiType {
    const basePath: string = (configuration && configuration.basePath) || BASE_PATH;
    return {
        /**
         * 
         * @summary List all assets by asset ID
         * @throws {RequiredError}
         */
        v1AssetsAssetIdGet(assetId: string, options?: RequestOptions = {}): Promise<Array<V1Asset>> {
            const localVarFetchArgs = MetadataApiFetchParamCreator(configuration).v1AssetsAssetIdGet(assetId, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
        /**
         * Retrieves all assets.              :::info Our asset identifiers are aligned with the ISO 4217 currency codes standard only for fiat money (government or law regulated currency). :::              :::info Properties of the output are providing aggregated information from across all symbols related to the specific asset. If you need to calculate your aggregation (e.g., limiting only the particular type of symbols), you should use /v1/symbols endpoint as a data source. :::
         * @summary List all assets
         * @throws {RequiredError}
         */
        v1AssetsGet(filterAssetId?: string, options?: RequestOptions = {}): Promise<Array<V1Asset>> {
            const localVarFetchArgs = MetadataApiFetchParamCreator(configuration).v1AssetsGet(filterAssetId, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
        /**
         * Gets the list of icons (of the given size) for all the assets.
         * @summary List all asset icons
         * @throws {RequiredError}
         */
        v1AssetsIconsSizeGet(size: number, options?: RequestOptions = {}): Promise<Array<V1Icon>> {
            const localVarFetchArgs = MetadataApiFetchParamCreator(configuration).v1AssetsIconsSizeGet(size, options);
            return fetch(basePath + localVarFetchArgs.url, localVarFetchArgs.options).then((response) => {
                if (response.status >= 200 && response.status < 300) {
                    return response.json();
                } else {
                    throw response;
                }
            });
        },
    }
};


export type ApiTypes = { 
    ExchangeRatesApi: ExchangeRatesApiType,

    MetadataApi: MetadataApiType,
 }
