/**
 * @fileoverview AUTOMATICALLY GENERATED service for API.Client.ExchangeRatesApi.
 * Do not edit this file by hand or your changes will be lost next time it is
 * generated.
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 * Version: v1
* Generator version: 7.14.0
 * Generated by: org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen
 */
/**
 * @license MIT License
 * https://github.com/api-bricks/api-bricks-sdk/blob/master/LICENSE
 */

goog.provide('API.Client.ExchangeRatesApi');

goog.require('API.Client.v1.ExchangeRate');
goog.require('API.Client.v1.ExchangeRates');
goog.require('API.Client.v1.ExchangeRatesTimeseriesItem');
goog.require('API.Client.v1.TimeseriesPeriod');

/**
 * @constructor
 * @param {!angular.$http} $http
 * @param {!Object} $httpParamSerializer
 * @param {!angular.$injector} $injector
 * @struct
 */
API.Client.ExchangeRatesApi = function($http, $httpParamSerializer, $injector) {
  /** @private {!string} */
  this.basePath_ = $injector.has('ExchangeRatesApiBasePath') ?
                   /** @type {!string} */ ($injector.get('ExchangeRatesApiBasePath')) :
                   'https://api-historical.exrates.coinapi.io';

  /** @private {!Object<string, string>} */
  this.defaultHeaders_ = $injector.has('ExchangeRatesApiDefaultHeaders') ?
                   /** @type {!Object<string, string>} */ (
                       $injector.get('ExchangeRatesApiDefaultHeaders')) :
                   {};

  /** @private {!angular.$http} */
  this.http_ = $http;

  /** @package {!Object} */
  this.httpParamSerializer = $injector.get('$httpParamSerializer');
}
API.Client.ExchangeRatesApi.$inject = ['$http', '$httpParamSerializer', '$injector'];

/**
 * Get specific rate
 * 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. :::
 * @param {!string} assetIdBase Requested exchange rate base asset identifier (from the Metadata -&gt; Assets)
 * @param {!string} assetIdQuote Requested exchange rate quote asset identifier (from the Metadata -&gt; Assets)
 * @param {!string=} opt_time Time at which exchange rate is calculated (optional, if not supplied then current rate is returned)
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!API.Client.v1.ExchangeRate>}
 */
API.Client.ExchangeRatesApi.prototype.getSpecificRate = function(assetIdBase, assetIdQuote, opt_time, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/exchangerate/{asset_id_base}/{asset_id_quote}'
      .replace('{' + 'asset_id_base' + '}', String(assetIdBase))
      .replace('{' + 'asset_id_quote' + '}', String(assetIdQuote));

  /** @type {!Object} */
  var queryParameters = {};

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'assetIdBase' is set
  if (!assetIdBase) {
    throw new Error('Missing required parameter assetIdBase when calling getSpecificRate');
  }
  // verify required parameter 'assetIdQuote' is set
  if (!assetIdQuote) {
    throw new Error('Missing required parameter assetIdQuote when calling getSpecificRate');
  }
  if (opt_time !== undefined) {
    queryParameters['time'] = opt_time;
  }

  /** @type {!Object} */
  var httpRequestParams = {
    method: 'GET',
    url: path,
    json: true,
            params: queryParameters,
    headers: headerParams
  };

  if (opt_extraHttpRequestParams) {
    httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
  }

  return (/** @type {?} */ (this.http_))(httpRequestParams);
}

/**
 * Timeseries data
 * Get the historical exchange rates between two assets in the form of the timeseries.
 * @param {!string} assetIdBase Requested exchange rates base asset identifier (from the Metadata -&gt; Assets)
 * @param {!string} assetIdQuote Requested exchange rates base asset identifier (from the Metadata -&gt; Assets)
 * @param {!string=} opt_periodId Identifier of requested timeseries period (required, e.g. &#x60;5SEC&#x60; or &#x60;1HRS&#x60;)
 * @param {!string=} opt_timeStart Timeseries starting time in ISO 8601 (required)
 * @param {!string=} opt_timeEnd Timeseries ending time in ISO 8601 (required)
 * @param {!number=} opt_limit 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 {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.v1.ExchangeRatesTimeseriesItem>>}
 */
API.Client.ExchangeRatesApi.prototype.v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet = function(assetIdBase, assetIdQuote, opt_periodId, opt_timeStart, opt_timeEnd, opt_limit, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/exchangerate/{asset_id_base}/{asset_id_quote}/history'
      .replace('{' + 'asset_id_base' + '}', String(assetIdBase))
      .replace('{' + 'asset_id_quote' + '}', String(assetIdQuote));

  /** @type {!Object} */
  var queryParameters = {};

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'assetIdBase' is set
  if (!assetIdBase) {
    throw new Error('Missing required parameter assetIdBase when calling v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet');
  }
  // verify required parameter 'assetIdQuote' is set
  if (!assetIdQuote) {
    throw new Error('Missing required parameter assetIdQuote when calling v1ExchangerateAssetIdBaseAssetIdQuoteHistoryGet');
  }
  if (opt_periodId !== undefined) {
    queryParameters['period_id'] = opt_periodId;
  }

  if (opt_timeStart !== undefined) {
    queryParameters['time_start'] = opt_timeStart;
  }

  if (opt_timeEnd !== undefined) {
    queryParameters['time_end'] = opt_timeEnd;
  }

  if (opt_limit !== undefined) {
    queryParameters['limit'] = opt_limit;
  }

  /** @type {!Object} */
  var httpRequestParams = {
    method: 'GET',
    url: path,
    json: true,
            params: queryParameters,
    headers: headerParams
  };

  if (opt_extraHttpRequestParams) {
    httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
  }

  return (/** @type {?} */ (this.http_))(httpRequestParams);
}

/**
 * Get all current rates
 * 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 &#x3D; 1 / X equation, for example BTC/USD &#x3D; 1 / (USD/BTC); :::
 * @param {!string} assetIdBase Requested exchange rates base asset identifier (from the Metadata -&gt; Assets)
 * @param {!string=} opt_filterAssetId Comma or semicolon delimited asset identifiers used to filter response (optional)
 * @param {!boolean=} opt_invert True will invert all the rates (optional, if true then rates will be calculated as &#x60;rate &#x3D; 1 / actual_rate&#x60; eg. &#x60;USD/BTC&#x60; as &#x60;BTC/USD&#x60;)
 * @param {!string=} opt_time Time for historical rates (optional)
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!API.Client.v1.ExchangeRates>}
 */
API.Client.ExchangeRatesApi.prototype.v1ExchangerateAssetIdBaseGet = function(assetIdBase, opt_filterAssetId, opt_invert, opt_time, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/exchangerate/{asset_id_base}'
      .replace('{' + 'asset_id_base' + '}', String(assetIdBase));

  /** @type {!Object} */
  var queryParameters = {};

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'assetIdBase' is set
  if (!assetIdBase) {
    throw new Error('Missing required parameter assetIdBase when calling v1ExchangerateAssetIdBaseGet');
  }
  if (opt_filterAssetId !== undefined) {
    queryParameters['filter_asset_id'] = opt_filterAssetId;
  }

  if (opt_invert !== undefined) {
    queryParameters['invert'] = opt_invert;
  }

  if (opt_time !== undefined) {
    queryParameters['time'] = opt_time;
  }

  /** @type {!Object} */
  var httpRequestParams = {
    method: 'GET',
    url: path,
    json: true,
            params: queryParameters,
    headers: headerParams
  };

  if (opt_extraHttpRequestParams) {
    httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
  }

  return (/** @type {?} */ (this.http_))(httpRequestParams);
}

/**
 * Timeseries periods
 * 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
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.v1.TimeseriesPeriod>>}
 */
API.Client.ExchangeRatesApi.prototype.v1ExchangerateHistoryPeriodsGet = function(opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/exchangerate/history/periods';

  /** @type {!Object} */
  var queryParameters = {};

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  /** @type {!Object} */
  var httpRequestParams = {
    method: 'GET',
    url: path,
    json: true,
            params: queryParameters,
    headers: headerParams
  };

  if (opt_extraHttpRequestParams) {
    httpRequestParams = angular.extend(httpRequestParams, opt_extraHttpRequestParams);
  }

  return (/** @type {?} */ (this.http_))(httpRequestParams);
}
