UNPKG

@gitchrisqueen/tdameritrade-api-js-client

Version:
308 lines (266 loc) 9.95 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 WatchListRequest from '../model/WatchListRequest'; import WatchListResponse from '../model/WatchListResponse'; /** * Watchlist service. * @module api/WatchlistApi * @version 0.1.4 */ export default class WatchlistApi { /** * Constructs a new WatchlistApi. * @alias module:api/WatchlistApi * @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 Watchlists for Single Account * all watchlist for an account. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WatchListResponse} and HTTP response */ accountsAccountIdWatchlistsGETWithHttpInfo(accountId) { let postBody = null; let pathParams = { 'accountId': accountId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = WatchListResponse; return this.apiClient.callApi( '/accounts/{accountId}/watchlists', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Watchlists for Single Account * all watchlist for an account. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WatchListResponse} */ accountsAccountIdWatchlistsGET(accountId) { return this.accountsAccountIdWatchlistsGETWithHttpInfo(accountId) .then(function(response_and_data) { return response_and_data.data; }); } /** * Create Watchlist * Create watchlist for specific account.This method does not verify that the symbol or asset type are valid. * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ accountsAccountIdWatchlistsPOSTWithHttpInfo(accountId, opts) { opts = opts || {}; let postBody = opts['body']; let pathParams = { 'accountId': accountId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = null; return this.apiClient.callApi( '/accounts/{accountId}/watchlists', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Create Watchlist * Create watchlist for specific account.This method does not verify that the symbol or asset type are valid. * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ accountsAccountIdWatchlistsPOST(accountId, opts) { return this.accountsAccountIdWatchlistsPOSTWithHttpInfo(accountId, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get Watchlists * Specific watchlist for a specific account. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WatchListResponse} and HTTP response */ accountsAccountIdWatchlistsWatchlistIdGETWithHttpInfo(accountId, watchlistId) { let postBody = null; let pathParams = { 'accountId': accountId, 'watchlistId': watchlistId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = WatchListResponse; return this.apiClient.callApi( '/accounts/{accountId}/watchlists/{watchlistId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Watchlists * Specific watchlist for a specific account. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WatchListResponse} */ accountsAccountIdWatchlistsWatchlistIdGET(accountId, watchlistId) { return this.accountsAccountIdWatchlistsWatchlistIdGETWithHttpInfo(accountId, watchlistId) .then(function(response_and_data) { return response_and_data.data; }); } /** * Update Watchlist * Partially update watchlist for a specific account: change watchlist name, add to the beginning/end of a watchlist, update or delete items in a watchlist. This method does not verify that the symbol or asset type are valid. * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ accountsAccountIdWatchlistsWatchlistIdPATCHWithHttpInfo(accountId, watchlistId, opts) { opts = opts || {}; let postBody = opts['body']; let pathParams = { 'accountId': accountId, 'watchlistId': watchlistId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = null; return this.apiClient.callApi( '/accounts/{accountId}/watchlists/{watchlistId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Update Watchlist * Partially update watchlist for a specific account: change watchlist name, add to the beginning/end of a watchlist, update or delete items in a watchlist. This method does not verify that the symbol or asset type are valid. * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ accountsAccountIdWatchlistsWatchlistIdPATCH(accountId, watchlistId, opts) { return this.accountsAccountIdWatchlistsWatchlistIdPATCHWithHttpInfo(accountId, watchlistId, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Replace Watchlist * Replace watchlist for a specific account. * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response */ accountsAccountIdWatchlistsWatchlistIdPUTWithHttpInfo(accountId, watchlistId, opts) { opts = opts || {}; let postBody = opts['body']; let pathParams = { 'accountId': accountId, 'watchlistId': watchlistId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = null; return this.apiClient.callApi( '/accounts/{accountId}/watchlists/{watchlistId}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Replace Watchlist * Replace watchlist for a specific account. * @param {Object} opts Optional parameters * @return {Promise} a {@link https://www.promisejs.org/|Promise} */ accountsAccountIdWatchlistsWatchlistIdPUT(accountId, watchlistId, opts) { return this.accountsAccountIdWatchlistsWatchlistIdPUTWithHttpInfo(accountId, watchlistId, opts) .then(function(response_and_data) { return response_and_data.data; }); } /** * Get Watchlists for Multiple Accounts * All watchlists for all of the user's linked accounts. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WatchListResponse} and HTTP response */ accountsWatchlistsGETWithHttpInfo() { let postBody = null; let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['bearerAuth']; let contentTypes = []; let accepts = ['application/json']; let returnType = WatchListResponse; return this.apiClient.callApi( '/accounts/watchlists', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType ); } /** * Get Watchlists for Multiple Accounts * All watchlists for all of the user's linked accounts. * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WatchListResponse} */ accountsWatchlistsGET() { return this.accountsWatchlistsGETWithHttpInfo() .then(function(response_and_data) { return response_and_data.data; }); } }