UNPKG

@gitchrisqueen/tdameritrade-api-js-client

Version:
130 lines (112 loc) 3.64 kB
/** * TD Ameritrade API - OAuth2 * This is replication of the TD Ameritrade API. * * OpenAPI spec version: 0.1.4 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * */ import ApiClient from "../ApiClient"; import ErrorObject from '../model/ErrorObject'; import Hours from '../model/Hours'; /** * MarketHours service. * @module api/MarketHoursApi * @version 0.1.4 */ export default class MarketHoursApi { /** * Constructs a new MarketHoursApi. * @alias module:api/MarketHoursApi * @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; } /** * Get Hours for Multiple Markets * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Hours} and HTTP response */ marketdataHoursGETWithHttpInfo(opts) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'apiKey': opts['apiKey'], 'markets': opts['markets'], 'date': opts['_date'] }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = Hours; return this.apiClient.callApi( '/marketdata/hours', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Hours for Multiple Markets * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Hours} */ marketdataHoursGET(opts) { return this.marketdataHoursGETWithHttpInfo(opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get Hours for Multiple Markets * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Hours} and HTTP response */ marketdataMarketHoursGETWithHttpInfo(market, opts) { opts = opts || {}; let postBody = null; let pathParams = { 'market': market }; let queryParams = { 'apiKey': opts['apiKey'], 'date': opts['_date'] }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = Hours; return this.apiClient.callApi( '/marketdata/{market}/hours', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Hours for Multiple Markets * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Hours} */ marketdataMarketHoursGET(market, opts) { return this.marketdataMarketHoursGETWithHttpInfo(market, opts) .then(function(response_and_data) { return response_and_data.data; }); } }