/**
 * @fileoverview AUTOMATICALLY GENERATED service for API.Client.OrderBookApi.
 * 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.OrderBookApi');

goog.require('API.Client.v1.OrderBook');
goog.require('API.Client.v1.OrderBookBase');
goog.require('API.Client.v1.OrderBookDepth');

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

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

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

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

/**
 * Get current order book
 * Retrieves the current order book for the specified symbol.
 * @param {!string} symbolId The symbol ID (from the Metadata -&gt; Symbols)
 * @param {!number=} opt_limitLevels The maximum number of levels to include in the response.
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!API.Client.v1.OrderBookBase>}
 */
API.Client.OrderBookApi.prototype.v1OrderbooksSymbolIdCurrentGet = function(symbolId, opt_limitLevels, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/orderbooks/{symbol_id}/current'
      .replace('{' + 'symbol_id' + '}', String(symbolId));

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

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

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

/**
 * Current depth of the order book
 * Retrieves the current depth of the order book for the specified symbol.
 * @param {!string} symbolId The symbol ID (from the Metadata -&gt; Symbols)
 * @param {!number=} opt_limitLevels The maximum number of levels to include in the response.
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!API.Client.v1.OrderBookDepth>}
 */
API.Client.OrderBookApi.prototype.v1OrderbooksSymbolIdDepthCurrentGet = function(symbolId, opt_limitLevels, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/orderbooks/{symbol_id}/depth/current'
      .replace('{' + 'symbol_id' + '}', String(symbolId));

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

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

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

/**
 * Historical data
 * Get historical order book snapshots for a specific symbol within time range, returned in time ascending order.              :::info The historical order book data via the REST API is currently limited by a number of updates and to the maximum number of 20 levels. :::  :::warning The &#39;time_start&#39; and &#39;time_end&#39; parameters must be from the same day as this endpoint provides intraday data only for specific day. Please use the &#39;date&#39; parameter instead for querying data for a specific day without filter. :::
 * @param {!string} symbolId Symbol identifier for requested timeseries (from the Metadata -&gt; Symbols)
 * @param {!string=} opt_date Date in ISO 8601, returned data is for the whole given day (preferred method, required if &#39;time_start&#39; is not provided)
 * @param {!string=} opt_timeStart Starting time in ISO 8601 (deprecated, use &#39;date&#39; instead)
 * @param {!string=} opt_timeEnd Timeseries ending time in ISO 8601 (deprecated, use &#39;date&#39; instead)
 * @param {!number=} opt_limit Amount of items to return (optional, minimum 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 {!number=} opt_limitLevels Maximum amount of levels from each side of the book to include in response (optional)
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.v1.OrderBook>>}
 */
API.Client.OrderBookApi.prototype.v1OrderbooksSymbolIdHistoryGet = function(symbolId, opt_date, opt_timeStart, opt_timeEnd, opt_limit, opt_limitLevels, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/orderbooks/{symbol_id}/history'
      .replace('{' + 'symbol_id' + '}', String(symbolId));

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

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

  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;
  }

  if (opt_limitLevels !== undefined) {
    queryParameters['limit_levels'] = opt_limitLevels;
  }

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

/**
 * Latest data
 * Get latest order book snapshots for a specific symbol, returned in time descending order.              :::info The historical order book data via the REST API is currently limited by a number of updates and to the maximum number of 20 levels. :::
 * @param {!string} symbolId Symbol identifier of requested timeseries (from the Metadata -&gt; Symbols)
 * @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 {!number=} opt_limitLevels Maximum amount of levels from each side of the book to include in response (optional)
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.v1.OrderBook>>}
 */
API.Client.OrderBookApi.prototype.v1OrderbooksSymbolIdLatestGet = function(symbolId, opt_limit, opt_limitLevels, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/orderbooks/{symbol_id}/latest'
      .replace('{' + 'symbol_id' + '}', String(symbolId));

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

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

  if (opt_limitLevels !== undefined) {
    queryParameters['limit_levels'] = opt_limitLevels;
  }

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