/**
 * CoinAPI Market Data 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).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */


import ApiClient from "../ApiClient";
import V1MetricInfo from '../model/V1MetricInfo';

/**
* MetricsV2 service.
* @module api/MetricsV2Api
* @version v1
*/
export default class MetricsV2Api {

    /**
    * Constructs a new MetricsV2Api. 
    * @alias module:api/MetricsV2Api
    * @class
    * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
    * default to {@link module:ApiClient#instance} if unspecified.
    */
    constructor(apiClient) {
        this.apiClient = apiClient || ApiClient.instance;
    }


    /**
     * Callback function to receive the result of the v2MetricsAssetHistoryGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsAssetHistoryGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<Object>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Historical metrics for the asset
     * Get asset metrics history.
     * @param {String} metricId Metric identifier (e.g., `TVL`, `STABLES_BRIDGED_USD`)
     * @param {String} assetId Asset identifier (e.g., `USDC`, `USDT`)
     * @param {Object} opts Optional parameters
     * @param {Date} [timeStart] Starting time in ISO 8601
     * @param {Date} [timeEnd] Ending time in ISO 8601
     * @param {String} [timeFormat] If set, returned values will be in unix timestamp format (valid values: unix_sec, unix_millisec, unix_microsec, unix_nanosec)
     * @param {String} [periodId] Identifier of requested timeseries period (e.g. `1MIN` or `2MTH`), default value is `1MIN`
     * @param {Number} [limit = 100)] Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
     * @param {module:api/MetricsV2Api~v2MetricsAssetHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<Object>}
     */
    v2MetricsAssetHistoryGet(metricId, assetId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'metricId' is set
      if (metricId === undefined || metricId === null) {
        throw new Error("Missing the required parameter 'metricId' when calling v2MetricsAssetHistoryGet");
      }
      // verify the required parameter 'assetId' is set
      if (assetId === undefined || assetId === null) {
        throw new Error("Missing the required parameter 'assetId' when calling v2MetricsAssetHistoryGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': metricId,
        'asset_id': assetId,
        'time_start': opts['timeStart'],
        'time_end': opts['timeEnd'],
        'time_format': opts['timeFormat'],
        'period_id': opts['periodId'],
        'limit': opts['limit']
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [Object];
      return this.apiClient.callApi(
        '/v2/metrics/asset/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v2MetricsAssetListingGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsAssetListingGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/V1MetricInfo>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Listing of metrics available for specific asset
     * Get all metrics that are actually available for the specified asset.
     * @param {String} assetId Asset identifier (e.g., USDC, USDT)
     * @param {module:api/MetricsV2Api~v2MetricsAssetListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricInfo>}
     */
    v2MetricsAssetListingGet(assetId, callback) {
      let postBody = null;
      // verify the required parameter 'assetId' is set
      if (assetId === undefined || assetId === null) {
        throw new Error("Missing the required parameter 'assetId' when calling v2MetricsAssetListingGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'asset_id': assetId
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [V1MetricInfo];
      return this.apiClient.callApi(
        '/v2/metrics/asset/listing', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v2MetricsChainHistoryGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsChainHistoryGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<Object>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Historical metrics for the chain
     * Get chain metrics history.
     * @param {String} metricId Metric identifier (e.g., `TVL`, `STABLES_BRIDGED_USD`)
     * @param {String} chainId Chain identifier (e.g., `Ethereum`, `Arbitrum`)
     * @param {Object} opts Optional parameters
     * @param {Date} [timeStart] Starting time in ISO 8601
     * @param {Date} [timeEnd] Ending time in ISO 8601
     * @param {String} [timeFormat] If set, returned values will be in unix timestamp format (valid values: unix_sec, unix_millisec, unix_microsec, unix_nanosec)
     * @param {String} [periodId] Identifier of requested timeseries period (e.g. `1MIN` or `2MTH`), default value is `1MIN`
     * @param {Number} [limit = 100)] Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
     * @param {module:api/MetricsV2Api~v2MetricsChainHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<Object>}
     */
    v2MetricsChainHistoryGet(metricId, chainId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'metricId' is set
      if (metricId === undefined || metricId === null) {
        throw new Error("Missing the required parameter 'metricId' when calling v2MetricsChainHistoryGet");
      }
      // verify the required parameter 'chainId' is set
      if (chainId === undefined || chainId === null) {
        throw new Error("Missing the required parameter 'chainId' when calling v2MetricsChainHistoryGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': metricId,
        'chain_id': chainId,
        'time_start': opts['timeStart'],
        'time_end': opts['timeEnd'],
        'time_format': opts['timeFormat'],
        'period_id': opts['periodId'],
        'limit': opts['limit']
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [Object];
      return this.apiClient.callApi(
        '/v2/metrics/chain/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v2MetricsChainListingGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsChainListingGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/V1MetricInfo>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Listing of metrics available for specific chain
     * Get all metrics that are actually available for the specified blockchain chain.
     * @param {String} chainId Chain identifier (e.g., ETHEREUM, ARBITRUM)
     * @param {module:api/MetricsV2Api~v2MetricsChainListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricInfo>}
     */
    v2MetricsChainListingGet(chainId, callback) {
      let postBody = null;
      // verify the required parameter 'chainId' is set
      if (chainId === undefined || chainId === null) {
        throw new Error("Missing the required parameter 'chainId' when calling v2MetricsChainListingGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'chain_id': chainId
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [V1MetricInfo];
      return this.apiClient.callApi(
        '/v2/metrics/chain/listing', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v2MetricsExchangeHistoryGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsExchangeHistoryGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<Object>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Historical metrics for the exchange
     * Get exchange metrics history.
     * @param {String} metricId Metric identifier (e.g., `TVL`, `STABLES_BRIDGED_USD`)
     * @param {String} exchangeId Exchange identifier (e.g., `BINANCE`, `UNISWAP-V3-ETHEREUM`)
     * @param {Object} opts Optional parameters
     * @param {Date} [timeStart] Starting time in ISO 8601
     * @param {Date} [timeEnd] Ending time in ISO 8601
     * @param {String} [timeFormat] If set, returned values will be in unix timestamp format (valid values: unix_sec, unix_millisec, unix_microsec, unix_nanosec)
     * @param {String} [periodId] Identifier of requested timeseries period (e.g. `1MIN` or `2MTH`), default value is `1MIN`
     * @param {Number} [limit = 100)] Amount of items to return (optional, mininum is 1, maximum is 100000, default value is 100, if the parameter is used then every 100 output items are counted as one request)
     * @param {module:api/MetricsV2Api~v2MetricsExchangeHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<Object>}
     */
    v2MetricsExchangeHistoryGet(metricId, exchangeId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'metricId' is set
      if (metricId === undefined || metricId === null) {
        throw new Error("Missing the required parameter 'metricId' when calling v2MetricsExchangeHistoryGet");
      }
      // verify the required parameter 'exchangeId' is set
      if (exchangeId === undefined || exchangeId === null) {
        throw new Error("Missing the required parameter 'exchangeId' when calling v2MetricsExchangeHistoryGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': metricId,
        'exchange_id': exchangeId,
        'time_start': opts['timeStart'],
        'time_end': opts['timeEnd'],
        'time_format': opts['timeFormat'],
        'period_id': opts['periodId'],
        'limit': opts['limit']
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [Object];
      return this.apiClient.callApi(
        '/v2/metrics/exchange/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v2MetricsExchangeListingGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsExchangeListingGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/V1MetricInfo>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Listing of metrics available for specific exchange
     * Get all metrics that are actually available for the specified exchange.
     * @param {String} exchangeId Exchange identifier (e.g., BINANCE, UNISWAP-V3-ETHEREUM)
     * @param {module:api/MetricsV2Api~v2MetricsExchangeListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricInfo>}
     */
    v2MetricsExchangeListingGet(exchangeId, callback) {
      let postBody = null;
      // verify the required parameter 'exchangeId' is set
      if (exchangeId === undefined || exchangeId === null) {
        throw new Error("Missing the required parameter 'exchangeId' when calling v2MetricsExchangeListingGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'exchange_id': exchangeId
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [V1MetricInfo];
      return this.apiClient.callApi(
        '/v2/metrics/exchange/listing', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v2MetricsListingGet operation.
     * @callback module:api/MetricsV2Api~v2MetricsListingGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/V1MetricInfo>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Listing of all supported metrics
     * Get all metrics available in the system.
     * @param {module:api/MetricsV2Api~v2MetricsListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricInfo>}
     */
    v2MetricsListingGet(callback) {
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [V1MetricInfo];
      return this.apiClient.callApi(
        '/v2/metrics/listing', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }


}
