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

goog.require('API.Client.Indexes.IndexDefinitionInputData');
goog.require('API.Client.Indexes.IndexDefinitionSnapshotEntry');
goog.require('API.Client.Indexes.IndexIdentifier');
goog.require('API.Client.Indexes.IndexMultiAssetWeight');
goog.require('API.Client.Indexes.IndexTimeseriesItem');
goog.require('API.Client.Indexes.IndexValue');

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

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

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

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

/**
 * Returns all data inputs for a specific index definition
 * 
 * @param {!string} indexDefinitionId 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexDefinitionInputData>>}
 */
API.Client.IndexesApi.prototype.v1IndexdefInputDataIndexDefinitionIdAllGet = function(indexDefinitionId, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexdef/input-data/{index_definition_id}/all'
      .replace('{' + 'index_definition_id' + '}', String(indexDefinitionId));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'indexDefinitionId' is set
  if (!indexDefinitionId) {
    throw new Error('Missing required parameter indexDefinitionId when calling v1IndexdefInputDataIndexDefinitionIdAllGet');
  }
  /** @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);
}

/**
 * Returns data inputs for certain index definition and time
 * 
 * @param {!string} indexDefinitionId 
 * @param {!Date=} opt_time 
 * @param {!boolean=} opt_enabledOnly 
 * @param {!boolean=} opt_pendingOnly 
 * @param {!string=} opt_filterAssetId 
 * @param {!boolean=} opt_withStatusInfo 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexDefinitionSnapshotEntry>>}
 */
API.Client.IndexesApi.prototype.v1IndexdefInputDataIndexDefinitionIdGet = function(indexDefinitionId, opt_time, opt_enabledOnly, opt_pendingOnly, opt_filterAssetId, opt_withStatusInfo, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexdef/input-data/{index_definition_id}'
      .replace('{' + 'index_definition_id' + '}', String(indexDefinitionId));

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

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

  if (opt_enabledOnly !== undefined) {
    queryParameters['enabled_only'] = opt_enabledOnly;
  }

  if (opt_pendingOnly !== undefined) {
    queryParameters['pending_only'] = opt_pendingOnly;
  }

  if (opt_filterAssetId !== undefined) {
    queryParameters['filter_asset_id'] = opt_filterAssetId;
  }

  if (opt_withStatusInfo !== undefined) {
    queryParameters['with_status_info'] = opt_withStatusInfo;
  }

  /** @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 multi-asset weights
 * 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexMultiAssetWeight>>}
 */
API.Client.IndexesApi.prototype.v1IndexdefMultiassetGet = function(opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexdef/multiasset';

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

/**
 * Get multi-asset weights for specific index
 * 
 * @param {!string} indexId 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexMultiAssetWeight>>}
 */
API.Client.IndexesApi.prototype.v1IndexdefMultiassetIndexIdGet = function(indexId, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexdef/multiasset/{index_id}'
      .replace('{' + 'index_id' + '}', String(indexId));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'indexId' is set
  if (!indexId) {
    throw new Error('Missing required parameter indexId when calling v1IndexdefMultiassetIndexIdGet');
  }
  /** @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);
}

/**
 * List indexes
 * 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexIdentifier>>}
 */
API.Client.IndexesApi.prototype.v1IndexesGet = function(opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexes';

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

/**
 * Current Index Values for index definition
 * 
 * @param {!string} indexDefinitionId 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexDefinitionSnapshotEntry>>}
 */
API.Client.IndexesApi.prototype.v1IndexesIndexDefinitionIdCurrentSnapshotGet = function(indexDefinitionId, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexes/{index_definition_id}/currentSnapshot'
      .replace('{' + 'index_definition_id' + '}', String(indexDefinitionId));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'indexDefinitionId' is set
  if (!indexDefinitionId) {
    throw new Error('Missing required parameter indexDefinitionId when calling v1IndexesIndexDefinitionIdCurrentSnapshotGet');
  }
  /** @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 Index Values for index definition
 * 
 * @param {!string} indexDefinitionId 
 * @param {!Date=} opt_time 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexDefinitionSnapshotEntry>>}
 */
API.Client.IndexesApi.prototype.v1IndexesIndexDefinitionIdHistorySnapshotGet = function(indexDefinitionId, opt_time, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexes/{index_definition_id}/historySnapshot'
      .replace('{' + 'index_definition_id' + '}', String(indexDefinitionId));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'indexDefinitionId' is set
  if (!indexDefinitionId) {
    throw new Error('Missing required parameter indexDefinitionId when calling v1IndexesIndexDefinitionIdHistorySnapshotGet');
  }
  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);
}

/**
 * Current Index Value
 * 
 * @param {!string} indexId 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!API.Client.Indexes.IndexValue>}
 */
API.Client.IndexesApi.prototype.v1IndexesIndexIdCurrentGet = function(indexId, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexes/{index_id}/current'
      .replace('{' + 'index_id' + '}', String(indexId));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'indexId' is set
  if (!indexId) {
    throw new Error('Missing required parameter indexId when calling v1IndexesIndexIdCurrentGet');
  }
  /** @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 Index Value w/Composition
 * 
 * @param {!string} indexId 
 * @param {!Date=} opt_timeStart 
 * @param {!Date=} opt_timeEnd 
 * @param {!number=} opt_limit 
 * @param {!angular.$http.Config=} opt_extraHttpRequestParams Extra HTTP parameters to send.
 * @return {!angular.$q.Promise<!Array<!API.Client.Indexes.IndexValue>>}
 */
API.Client.IndexesApi.prototype.v1IndexesIndexIdHistoryGet = function(indexId, opt_timeStart, opt_timeEnd, opt_limit, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexes/{index_id}/history'
      .replace('{' + 'index_id' + '}', String(indexId));

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

  /** @type {!Object} */
  var headerParams = angular.extend({}, this.defaultHeaders_);
  // verify required parameter 'indexId' is set
  if (!indexId) {
    throw new Error('Missing required parameter indexId when calling v1IndexesIndexIdHistoryGet');
  }
  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);
}

/**
 * Timeseries Index Value
 * 
 * @param {!string} indexId 
 * @param {!string} periodId Identifier of requested timeseries period (e.g. &#x60;5SEC&#x60; or &#x60;1DAY&#x60;)
 * @param {!string} timeStart Timeseries starting time in ISO 8601
 * @param {!string} timeEnd Timeseries ending time in ISO 8601
 * @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.Indexes.IndexTimeseriesItem>>}
 */
API.Client.IndexesApi.prototype.v1IndexesIndexIdTimeseriesGet = function(indexId, periodId, timeStart, timeEnd, opt_limit, opt_extraHttpRequestParams) {
  /** @const {string} */
  var path = this.basePath_ + '/v1/indexes/{index_id}/timeseries'
      .replace('{' + 'index_id' + '}', String(indexId));

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

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

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

  if (timeEnd !== undefined) {
    queryParameters['time_end'] = 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);
}
