/**
 * @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');

/**
 * @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-realtime.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 {!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_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');
  }
  /** @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 {!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_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;
  }

  /** @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);
}
