/**
 * CoinAPI Indexes 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 IndexesIndexDefinitionInputData from '../model/IndexesIndexDefinitionInputData';
import IndexesIndexDefinitionSnapshotEntry from '../model/IndexesIndexDefinitionSnapshotEntry';
import IndexesIndexIdentifier from '../model/IndexesIndexIdentifier';
import IndexesIndexMultiAssetWeight from '../model/IndexesIndexMultiAssetWeight';
import IndexesIndexTimeseriesItem from '../model/IndexesIndexTimeseriesItem';
import IndexesIndexValue from '../model/IndexesIndexValue';

/**
* Indexes service.
* @module api/IndexesApi
* @version v1
*/
export default class IndexesApi {

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

    /**
     * Returns all data inputs for a specific index definition
     * @param {String} indexDefinitionId 
     * @param {module:api/IndexesApi~v1IndexdefInputDataIndexDefinitionIdAllGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexDefinitionInputData>}
     */
    v1IndexdefInputDataIndexDefinitionIdAllGet(indexDefinitionId, callback) {
      let postBody = null;
      // verify the required parameter 'indexDefinitionId' is set
      if (indexDefinitionId === undefined || indexDefinitionId === null) {
        throw new Error("Missing the required parameter 'indexDefinitionId' when calling v1IndexdefInputDataIndexDefinitionIdAllGet");
      }

      let pathParams = {
        'index_definition_id': indexDefinitionId
      };
      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 = [IndexesIndexDefinitionInputData];
      return this.apiClient.callApi(
        '/v1/indexdef/input-data/{index_definition_id}/all', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Returns data inputs for certain index definition and time
     * @param {String} indexDefinitionId 
     * @param {Object} opts Optional parameters
     * @param {Date} [time] 
     * @param {Boolean} [enabledOnly = false)] 
     * @param {Boolean} [pendingOnly = false)] 
     * @param {String} [filterAssetId] 
     * @param {Boolean} [withStatusInfo = false)] 
     * @param {module:api/IndexesApi~v1IndexdefInputDataIndexDefinitionIdGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexDefinitionSnapshotEntry>}
     */
    v1IndexdefInputDataIndexDefinitionIdGet(indexDefinitionId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'indexDefinitionId' is set
      if (indexDefinitionId === undefined || indexDefinitionId === null) {
        throw new Error("Missing the required parameter 'indexDefinitionId' when calling v1IndexdefInputDataIndexDefinitionIdGet");
      }

      let pathParams = {
        'index_definition_id': indexDefinitionId
      };
      let queryParams = {
        'time': opts['time'],
        'enabled_only': opts['enabledOnly'],
        'pending_only': opts['pendingOnly'],
        'filter_asset_id': opts['filterAssetId'],
        'with_status_info': opts['withStatusInfo']
      };
      let headerParams = {
      };
      let formParams = {
      };

      let authNames = ['APIKey', 'JWT'];
      let contentTypes = [];
      let accepts = ['text/plain', 'application/json', 'text/json', 'application/x-msgpack'];
      let returnType = [IndexesIndexDefinitionSnapshotEntry];
      return this.apiClient.callApi(
        '/v1/indexdef/input-data/{index_definition_id}', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Get all multi-asset weights
     * @param {module:api/IndexesApi~v1IndexdefMultiassetGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexMultiAssetWeight>}
     */
    v1IndexdefMultiassetGet(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 = [IndexesIndexMultiAssetWeight];
      return this.apiClient.callApi(
        '/v1/indexdef/multiasset', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Get multi-asset weights for specific index
     * @param {String} indexId 
     * @param {module:api/IndexesApi~v1IndexdefMultiassetIndexIdGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexMultiAssetWeight>}
     */
    v1IndexdefMultiassetIndexIdGet(indexId, callback) {
      let postBody = null;
      // verify the required parameter 'indexId' is set
      if (indexId === undefined || indexId === null) {
        throw new Error("Missing the required parameter 'indexId' when calling v1IndexdefMultiassetIndexIdGet");
      }

      let pathParams = {
        'index_id': indexId
      };
      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 = [IndexesIndexMultiAssetWeight];
      return this.apiClient.callApi(
        '/v1/indexdef/multiasset/{index_id}', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * List indexes
     * @param {module:api/IndexesApi~v1IndexesGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexIdentifier>}
     */
    v1IndexesGet(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 = [IndexesIndexIdentifier];
      return this.apiClient.callApi(
        '/v1/indexes', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Current Index Values for index definition
     * @param {String} indexDefinitionId 
     * @param {module:api/IndexesApi~v1IndexesIndexDefinitionIdCurrentSnapshotGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexDefinitionSnapshotEntry>}
     */
    v1IndexesIndexDefinitionIdCurrentSnapshotGet(indexDefinitionId, callback) {
      let postBody = null;
      // verify the required parameter 'indexDefinitionId' is set
      if (indexDefinitionId === undefined || indexDefinitionId === null) {
        throw new Error("Missing the required parameter 'indexDefinitionId' when calling v1IndexesIndexDefinitionIdCurrentSnapshotGet");
      }

      let pathParams = {
        'index_definition_id': indexDefinitionId
      };
      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 = [IndexesIndexDefinitionSnapshotEntry];
      return this.apiClient.callApi(
        '/v1/indexes/{index_definition_id}/currentSnapshot', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Historical Index Values for index definition
     * @param {String} indexDefinitionId 
     * @param {Object} opts Optional parameters
     * @param {Date} [time] 
     * @param {module:api/IndexesApi~v1IndexesIndexDefinitionIdHistorySnapshotGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexDefinitionSnapshotEntry>}
     */
    v1IndexesIndexDefinitionIdHistorySnapshotGet(indexDefinitionId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'indexDefinitionId' is set
      if (indexDefinitionId === undefined || indexDefinitionId === null) {
        throw new Error("Missing the required parameter 'indexDefinitionId' when calling v1IndexesIndexDefinitionIdHistorySnapshotGet");
      }

      let pathParams = {
        'index_definition_id': indexDefinitionId
      };
      let queryParams = {
        'time': opts['time']
      };
      let headerParams = {
      };
      let formParams = {
      };

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

    /**
     * Callback function to receive the result of the v1IndexesIndexIdCurrentGet operation.
     * @callback module:api/IndexesApi~v1IndexesIndexIdCurrentGetCallback
     * @param {String} error Error message, if any.
     * @param {module:model/IndexesIndexValue} data The data returned by the service call.
     * @param {String} response The complete HTTP response.
     */

    /**
     * Current Index Value
     * @param {String} indexId 
     * @param {module:api/IndexesApi~v1IndexesIndexIdCurrentGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link module:model/IndexesIndexValue}
     */
    v1IndexesIndexIdCurrentGet(indexId, callback) {
      let postBody = null;
      // verify the required parameter 'indexId' is set
      if (indexId === undefined || indexId === null) {
        throw new Error("Missing the required parameter 'indexId' when calling v1IndexesIndexIdCurrentGet");
      }

      let pathParams = {
        'index_id': indexId
      };
      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 = IndexesIndexValue;
      return this.apiClient.callApi(
        '/v1/indexes/{index_id}/current', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Historical Index Value w/Composition
     * @param {String} indexId 
     * @param {Object} opts Optional parameters
     * @param {Date} [timeStart] 
     * @param {Date} [timeEnd] 
     * @param {Number} [limit = 100)] 
     * @param {module:api/IndexesApi~v1IndexesIndexIdHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexValue>}
     */
    v1IndexesIndexIdHistoryGet(indexId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'indexId' is set
      if (indexId === undefined || indexId === null) {
        throw new Error("Missing the required parameter 'indexId' when calling v1IndexesIndexIdHistoryGet");
      }

      let pathParams = {
        'index_id': indexId
      };
      let queryParams = {
        'time_start': opts['timeStart'],
        'time_end': opts['timeEnd'],
        '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 = [IndexesIndexValue];
      return this.apiClient.callApi(
        '/v1/indexes/{index_id}/history', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Timeseries Index Value
     * @param {String} indexId 
     * @param {String} periodId Identifier of requested timeseries period (e.g. `5SEC` or `1DAY`)
     * @param {String} timeStart Timeseries starting time in ISO 8601
     * @param {String} timeEnd Timeseries ending time in ISO 8601
     * @param {Object} opts Optional parameters
     * @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/IndexesApi~v1IndexesIndexIdTimeseriesGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/IndexesIndexTimeseriesItem>}
     */
    v1IndexesIndexIdTimeseriesGet(indexId, periodId, timeStart, timeEnd, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'indexId' is set
      if (indexId === undefined || indexId === null) {
        throw new Error("Missing the required parameter 'indexId' when calling v1IndexesIndexIdTimeseriesGet");
      }
      // verify the required parameter 'periodId' is set
      if (periodId === undefined || periodId === null) {
        throw new Error("Missing the required parameter 'periodId' when calling v1IndexesIndexIdTimeseriesGet");
      }
      // verify the required parameter 'timeStart' is set
      if (timeStart === undefined || timeStart === null) {
        throw new Error("Missing the required parameter 'timeStart' when calling v1IndexesIndexIdTimeseriesGet");
      }
      // verify the required parameter 'timeEnd' is set
      if (timeEnd === undefined || timeEnd === null) {
        throw new Error("Missing the required parameter 'timeEnd' when calling v1IndexesIndexIdTimeseriesGet");
      }

      let pathParams = {
        'index_id': indexId
      };
      let queryParams = {
        'period_id': periodId,
        'time_start': timeStart,
        'time_end': timeEnd,
        '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 = [IndexesIndexTimeseriesItem];
      return this.apiClient.callApi(
        '/v1/indexes/{index_id}/timeseries', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }


}
