/**
 * 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 V1GeneralData from '../model/V1GeneralData';
import V1ListingItem from '../model/V1ListingItem';
import V1Metric from '../model/V1Metric';
import V1MetricData from '../model/V1MetricData';

/**
* MetricsV1 service.
* @module api/MetricsV1Api
* @version v1
*/
export default class MetricsV1Api {

    /**
    * Constructs a new MetricsV1Api. 
    * @alias module:api/MetricsV1Api
    * @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 v1MetricsAssetCurrentGet operation.
     * @callback module:api/MetricsV1Api~v1MetricsAssetCurrentGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/V1GeneralData>} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Current metrics for given asset
     * Get current asset metrics.
     * @param {Object} opts Optional parameters
     * @param {String} [metricId] Metric identifier (from the Metrics -> Listing)
     * @param {String} [assetId] Asset identifier (from the Metadata -> Assets)
     * @param {String} [assetIdExternal] Exchange asset identifier
     * @param {String} [exchangeId] Exchange identifier (from the Metadata -> Exchanges)
     * @param {module:api/MetricsV1Api~v1MetricsAssetCurrentGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1GeneralData>}
     */
    v1MetricsAssetCurrentGet(opts, callback) {
      opts = opts || {};
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
        'metric_id': opts['metricId'],
        'asset_id': opts['assetId'],
        'asset_id_external': opts['assetIdExternal'],
        'exchange_id': opts['exchangeId']
      };
      let headerParams = {
      };
      let formParams = {
      };

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

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

    /**
     * Historical metrics for asset
     * Get asset metrics history.
     * @param {String} metricId Metric identifier (from the Metrics -> Listing)
     * @param {String} exchangeId Exchange identifier (from the Metadata -> Exchanges)
     * @param {Object} opts Optional parameters
     * @param {String} [assetId] Asset identifier (from the Metadata -> Assets)
     * @param {String} [assetIdExternal] Exchange asset identifier
     * @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. `5SEC` or `2MTH`), default value is `1SEC`
     * @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/MetricsV1Api~v1MetricsAssetHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricData>}
     */
    v1MetricsAssetHistoryGet(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 v1MetricsAssetHistoryGet");
      }
      // verify the required parameter 'exchangeId' is set
      if (exchangeId === undefined || exchangeId === null) {
        throw new Error("Missing the required parameter 'exchangeId' when calling v1MetricsAssetHistoryGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': metricId,
        'asset_id': opts['assetId'],
        'asset_id_external': opts['assetIdExternal'],
        '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 = [V1MetricData];
      return this.apiClient.callApi(
        '/v1/metrics/asset/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Listing of all supported metrics for asset
     * Get data metrics for asset.
     * @param {Object} opts Optional parameters
     * @param {String} [metricId] Metric identifier (from the Metrics -> Listing)
     * @param {String} [exchangeId] Exchange identifier (from the Metadata -> Exchanges)
     * @param {String} [chainId] Chain identifier
     * @param {String} [networkId] Network identifier
     * @param {String} [assetId] Asset identifier (from the Metadata -> Assets)
     * @param {String} [assetIdExternal] The asset external identifier
     * @param {module:api/MetricsV1Api~v1MetricsAssetListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1ListingItem>}
     */
    v1MetricsAssetListingGet(opts, callback) {
      opts = opts || {};
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
        'metric_id': opts['metricId'],
        'exchange_id': opts['exchangeId'],
        'chain_id': opts['chainId'],
        'network_id': opts['networkId'],
        'asset_id': opts['assetId'],
        'asset_id_external': opts['assetIdExternal']
      };
      let headerParams = {
      };
      let formParams = {
      };

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

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

    /**
     * Current metrics for given exchange
     * Get current exchange metrics values.
     * @param {String} exchangeId The exchange identifier (from the Metadata -> Exchanges)
     * @param {Object} opts Optional parameters
     * @param {String} [metricId] The metric identifier (from the Metrics -> Listing)
     * @param {module:api/MetricsV1Api~v1MetricsExchangeCurrentGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1GeneralData>}
     */
    v1MetricsExchangeCurrentGet(exchangeId, opts, callback) {
      opts = opts || {};
      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 v1MetricsExchangeCurrentGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': opts['metricId'],
        '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 = [V1GeneralData];
      return this.apiClient.callApi(
        '/v1/metrics/exchange/current', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

    /**
     * Callback function to receive the result of the v1MetricsExchangeHistoryGet operation.
     * @callback module:api/MetricsV1Api~v1MetricsExchangeHistoryGetCallback
     * @param {String} error Error message, if any.
     * @param {Array.<module:model/V1MetricData>} 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 (from the Metrics -> Listing)
     * @param {String} exchangeId Exchange identifier (from the Metadata -> Exchanges)
     * @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. `5SEC` or `2MTH`), default value is `1SEC`
     * @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/MetricsV1Api~v1MetricsExchangeHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricData>}
     */
    v1MetricsExchangeHistoryGet(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 v1MetricsExchangeHistoryGet");
      }
      // verify the required parameter 'exchangeId' is set
      if (exchangeId === undefined || exchangeId === null) {
        throw new Error("Missing the required parameter 'exchangeId' when calling v1MetricsExchangeHistoryGet");
      }

      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 = [V1MetricData];
      return this.apiClient.callApi(
        '/v1/metrics/exchange/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Listing of all supported exchange metrics
     * Get data metrics for exchange.
     * @param {String} exchangeId The exchange identifier (from the Metadata -> Exchanges)
     * @param {Object} opts Optional parameters
     * @param {String} [metricId] The metric identifier (from the Metrics -> Listing)
     * @param {module:api/MetricsV1Api~v1MetricsExchangeListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1ListingItem>}
     */
    v1MetricsExchangeListingGet(exchangeId, opts, callback) {
      opts = opts || {};
      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 v1MetricsExchangeListingGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': opts['metricId'],
        '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 = [V1ListingItem];
      return this.apiClient.callApi(
        '/v1/metrics/exchange/listing', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Listing of all supported metrics by CoinAPI
     * Get all data metrics.
     * @param {module:api/MetricsV1Api~v1MetricsListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1Metric>}
     */
    v1MetricsListingGet(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 = [V1Metric];
      return this.apiClient.callApi(
        '/v1/metrics/listing', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Current metrics for given symbol
     * Get current symbol metrics.
     * @param {Object} opts Optional parameters
     * @param {String} [metricId] Metric identifier (from the Metrics -> Listing)
     * @param {String} [symbolId] Symbol identifier (from the Metadata -> Symbols)
     * @param {String} [exchangeId] Exchange id (from the Metadata -> Exchanges)
     * @param {module:api/MetricsV1Api~v1MetricsSymbolCurrentGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1GeneralData>}
     */
    v1MetricsSymbolCurrentGet(opts, callback) {
      opts = opts || {};
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
        'metric_id': opts['metricId'],
        'symbol_id': opts['symbolId'],
        'exchange_id': opts['exchangeId']
      };
      let headerParams = {
      };
      let formParams = {
      };

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

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

    /**
     * Historical metrics for symbol
     * Get symbol metrics history.
     * @param {String} metricId Metric identifier (from the Metrics -> Listing)
     * @param {String} symbolId Symbol identifier (from the Metadata -> Symbols)
     * @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. `5SEC` or `2MTH`), default value is `1SEC`
     * @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/MetricsV1Api~v1MetricsSymbolHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1MetricData>}
     */
    v1MetricsSymbolHistoryGet(metricId, symbolId, 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 v1MetricsSymbolHistoryGet");
      }
      // verify the required parameter 'symbolId' is set
      if (symbolId === undefined || symbolId === null) {
        throw new Error("Missing the required parameter 'symbolId' when calling v1MetricsSymbolHistoryGet");
      }

      let pathParams = {
      };
      let queryParams = {
        'metric_id': metricId,
        'symbol_id': symbolId,
        '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 = [V1MetricData];
      return this.apiClient.callApi(
        '/v1/metrics/symbol/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Listing of all supported metrics for symbol
     * Get data metrics for symbol.
     * @param {Object} opts Optional parameters
     * @param {String} [metricId] Metric identifier (from the Metrics -> Listing)
     * @param {String} [exchangeId] Exchange identifier (from the Metadata -> Exchanges)
     * @param {String} [symbolId] Symbol identifier (from the Metadata -> Symbols)
     * @param {module:api/MetricsV1Api~v1MetricsSymbolListingGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1ListingItem>}
     */
    v1MetricsSymbolListingGet(opts, callback) {
      opts = opts || {};
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
        'metric_id': opts['metricId'],
        'exchange_id': opts['exchangeId'],
        'symbol_id': opts['symbolId']
      };
      let headerParams = {
      };
      let formParams = {
      };

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


}
