@gitchrisqueen/tdameritrade-api-js-client
Version:
TD Ameritrade API integration for node.js
131 lines (113 loc) • 3.72 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 Account from '../model/Account';
import EASObject from '../model/EASObject';
/**
* Accounts service.
* @module api/AccountsApi
* @version 0.1.4
*/
export default class AccountsApi {
/**
* Constructs a new AccountsApi.
* @alias module:api/AccountsApi
* @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 Account
* Account balances, positions, and orders for a specific account.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Account} and HTTP response
*/
accountsAccountIdGETWithHttpInfo(accountId, opts) {
opts = opts || {};
let postBody = null;
let pathParams = {
'accountId': accountId
};
let queryParams = {
'fields': opts['fields']
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = Account;
return this.apiClient.callApi(
'/accounts/{accountId}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Account
* Account balances, positions, and orders for a specific account.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Account}
*/
accountsAccountIdGET(accountId, opts) {
return this.accountsAccountIdGETWithHttpInfo(accountId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get Accounts
* Account balances, positions, and orders for all linked accounts.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Account} and HTTP response
*/
accountsGETWithHttpInfo(opts) {
opts = opts || {};
let postBody = null;
let pathParams = {
};
let queryParams = {
'fields': opts['fields']
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = Account;
return this.apiClient.callApi(
'/accounts', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Accounts
* Account balances, positions, and orders for all linked accounts.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Account}
*/
accountsGET(opts) {
return this.accountsGETWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}