@gitchrisqueen/tdameritrade-api-js-client
Version:
TD Ameritrade API integration for node.js
133 lines (115 loc) • 3.92 kB
JavaScript
/**
* 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 SearchInstrumentResponse from '../model/SearchInstrumentResponse';
/**
* Instruments service.
* @module api/InstrumentsApi
* @version 0.1.4
*/
export default class InstrumentsApi {
/**
* Constructs a new InstrumentsApi.
* @alias module:api/InstrumentsApi
* @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 Instrument
* Get an instrument by CUSIP
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SearchInstrumentResponse} and HTTP response
*/
instrumentsCusipGETWithHttpInfo(cusip, opts) {
opts = opts || {};
let postBody = null;
let pathParams = {
'cusip': cusip
};
let queryParams = {
'apikey': opts['apikey']
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = SearchInstrumentResponse;
return this.apiClient.callApi(
'/instruments/{cusip}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Instrument
* Get an instrument by CUSIP
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SearchInstrumentResponse}
*/
instrumentsCusipGET(cusip, opts) {
return this.instrumentsCusipGETWithHttpInfo(cusip, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Search Instruments
* Search or retrieve instrument data, including fundamental data
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SearchInstrumentResponse} and HTTP response
*/
instrumentsGETWithHttpInfo(symbol, projection, opts) {
opts = opts || {};
let postBody = null;
let pathParams = {
};
let queryParams = {
'apikey': opts['apikey'],
'symbol': symbol,
'projection': projection
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = SearchInstrumentResponse;
return this.apiClient.callApi(
'/instruments', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Search Instruments
* Search or retrieve instrument data, including fundamental data
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SearchInstrumentResponse}
*/
instrumentsGET(symbol, projection, opts) {
return this.instrumentsGETWithHttpInfo(symbol, projection, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}