/**
 * CoinAPI Market Data 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 V1Trade from '../model/V1Trade';

/**
* Trades service.
* @module api/TradesApi
* @version v1
*/
export default class TradesApi {

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

    /**
     * Latest data
     * Get latest trades executed up to 1 minute ago. Latest data is always returned in time descending order.
     * @param {Object} opts Optional parameters
     * @param {String} [filterSymbolId] Comma or semicolon delimited parts of symbol identifier used to filter response. (optional)
     * @param {Boolean} [includeId = false)] Information that additional exchange trade identifier should be included in the `id_trade` parameter of the trade if exchange providing identifiers.
     * @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/TradesApi~v1TradesLatestGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1Trade>}
     */
    v1TradesLatestGet(opts, callback) {
      opts = opts || {};
      let postBody = null;

      let pathParams = {
      };
      let queryParams = {
        'filter_symbol_id': opts['filterSymbolId'],
        'include_id': opts['includeId'],
        '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 = [V1Trade];
      return this.apiClient.callApi(
        '/v1/trades/latest', 'GET',
        pathParams, queryParams, headerParams, formParams, postBody,
        authNames, contentTypes, accepts, returnType, null, callback
      );
    }

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

    /**
     * Historical data
     * Get history transactions from specific symbol, returned in time ascending order.  :::warning The 'time_start' and 'time_end' parameters must be from the same day as this endpoint provides intraday data only for specific day. Please use the 'date' parameter instead for querying data for a specific day without filter. :::
     * @param {String} symbolId Symbol identifier for requested timeseries (from the Metadata -> Symbols)
     * @param {Object} opts Optional parameters
     * @param {String} [date] Date in ISO 8601, returned data is for the whole given day (required if 'time_start' is not provided)
     * @param {String} [timeStart] Starting time in ISO 8601
     * @param {String} [timeEnd] Timeseries ending time in ISO 8601
     * @param {Number} [limit = 100)] 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 {Boolean} [includeId = false)] Information that additional exchange trade identifier should be included in the `id_trade` parameter of the trade if exchange providing identifiers.
     * @param {module:api/TradesApi~v1TradesSymbolIdHistoryGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1Trade>}
     */
    v1TradesSymbolIdHistoryGet(symbolId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'symbolId' is set
      if (symbolId === undefined || symbolId === null) {
        throw new Error("Missing the required parameter 'symbolId' when calling v1TradesSymbolIdHistoryGet");
      }

      let pathParams = {
        'symbol_id': symbolId
      };
      let queryParams = {
        'date': opts['date'],
        'time_start': opts['timeStart'],
        'time_end': opts['timeEnd'],
        'limit': opts['limit'],
        'include_id': opts['includeId']
      };
      let headerParams = {
      };
      let formParams = {
      };

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

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

    /**
     * Latest data by symbol_id
     * Get latest trades executed up to 1 minute ago. Latest data is always returned in time descending order.
     * @param {String} symbolId Symbol identifier for requested timeseries (from the Metadata -> Symbols)
     * @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 {Boolean} [includeId = false)] Information that additional exchange trade identifier should be included in the `id_trade` parameter of the trade if exchange providing identifiers.
     * @param {module:api/TradesApi~v1TradesSymbolIdLatestGetCallback} callback The callback function, accepting three arguments: error, data, response
     * data is of type: {@link Array.<module:model/V1Trade>}
     */
    v1TradesSymbolIdLatestGet(symbolId, opts, callback) {
      opts = opts || {};
      let postBody = null;
      // verify the required parameter 'symbolId' is set
      if (symbolId === undefined || symbolId === null) {
        throw new Error("Missing the required parameter 'symbolId' when calling v1TradesSymbolIdLatestGet");
      }

      let pathParams = {
        'symbol_id': symbolId
      };
      let queryParams = {
        'limit': opts['limit'],
        'include_id': opts['includeId']
      };
      let headerParams = {
      };
      let formParams = {
      };

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


}
