@gitchrisqueen/tdameritrade-api-js-client
Version:
TD Ameritrade API integration for node.js
402 lines (346 loc) • 14.3 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
*
* Swagger Codegen version: 2.4.14
*
* Do not edit the class manually.
*
*/
(function(root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define(['ApiClient', 'model/ErrorObject', 'model/WatchListRequest', 'model/WatchListResponse'], factory);
} else if (typeof module === 'object' && module.exports) {
// CommonJS-like environments that support module.exports, like Node.
module.exports = factory(require('../ApiClient'), require('../model/ErrorObject'), require('../model/WatchListRequest'), require('../model/WatchListResponse'));
} else {
// Browser globals (root is window)
if (!root.GitChrisQueen_TDA_JS) {
root.GitChrisQueen_TDA_JS = {};
}
root.GitChrisQueen_TDA_JS.WatchlistApi = factory(root.GitChrisQueen_TDA_JS.ApiClient, root.GitChrisQueen_TDA_JS.ErrorObject, root.GitChrisQueen_TDA_JS.WatchListRequest, root.GitChrisQueen_TDA_JS.WatchListResponse);
}
}(this, function(ApiClient, ErrorObject, WatchListRequest, WatchListResponse) {
'use strict';
/**
* Watchlist service.
* @module api/WatchlistApi
* @version 0.1.4
*/
/**
* 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.
*/
var exports = function(apiClient) {
this.apiClient = apiClient || ApiClient.instance;
/**
* Get Watchlists for Single Account
* all watchlist for an account.
* @param {String} accountId
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WatchListResponse} and HTTP response
*/
this.accountsAccountIdWatchlistsGETWithHttpInfo = function(accountId) {
var postBody = null;
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling accountsAccountIdWatchlistsGET");
}
var pathParams = {
'accountId': accountId
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = WatchListResponse;
return this.apiClient.callApi(
'/accounts/{accountId}/watchlists', 'GET',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Watchlists for Single Account
* all watchlist for an account.
* @param {String} accountId
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WatchListResponse}
*/
this.accountsAccountIdWatchlistsGET = function(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 {String} accountId
* @param {Object} opts Optional parameters
* @param {module:model/WatchListRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.accountsAccountIdWatchlistsPOSTWithHttpInfo = function(accountId, opts) {
opts = opts || {};
var postBody = opts['body'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling accountsAccountIdWatchlistsPOST");
}
var pathParams = {
'accountId': accountId
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = null;
return this.apiClient.callApi(
'/accounts/{accountId}/watchlists', 'POST',
pathParams, queryParams, collectionQueryParams, 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 {String} accountId
* @param {Object} opts Optional parameters
* @param {module:model/WatchListRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.accountsAccountIdWatchlistsPOST = function(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.
* @param {String} accountId
* @param {String} watchlistId
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/WatchListResponse} and HTTP response
*/
this.accountsAccountIdWatchlistsWatchlistIdGETWithHttpInfo = function(accountId, watchlistId) {
var postBody = null;
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling accountsAccountIdWatchlistsWatchlistIdGET");
}
// verify the required parameter 'watchlistId' is set
if (watchlistId === undefined || watchlistId === null) {
throw new Error("Missing the required parameter 'watchlistId' when calling accountsAccountIdWatchlistsWatchlistIdGET");
}
var pathParams = {
'accountId': accountId,
'watchlistId': watchlistId
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = WatchListResponse;
return this.apiClient.callApi(
'/accounts/{accountId}/watchlists/{watchlistId}', 'GET',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Watchlists
* Specific watchlist for a specific account.
* @param {String} accountId
* @param {String} watchlistId
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/WatchListResponse}
*/
this.accountsAccountIdWatchlistsWatchlistIdGET = function(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 {String} accountId
* @param {String} watchlistId
* @param {Object} opts Optional parameters
* @param {module:model/WatchListRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.accountsAccountIdWatchlistsWatchlistIdPATCHWithHttpInfo = function(accountId, watchlistId, opts) {
opts = opts || {};
var postBody = opts['body'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling accountsAccountIdWatchlistsWatchlistIdPATCH");
}
// verify the required parameter 'watchlistId' is set
if (watchlistId === undefined || watchlistId === null) {
throw new Error("Missing the required parameter 'watchlistId' when calling accountsAccountIdWatchlistsWatchlistIdPATCH");
}
var pathParams = {
'accountId': accountId,
'watchlistId': watchlistId
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = null;
return this.apiClient.callApi(
'/accounts/{accountId}/watchlists/{watchlistId}', 'PATCH',
pathParams, queryParams, collectionQueryParams, 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 {String} accountId
* @param {String} watchlistId
* @param {Object} opts Optional parameters
* @param {module:model/WatchListRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.accountsAccountIdWatchlistsWatchlistIdPATCH = function(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 {String} accountId
* @param {String} watchlistId
* @param {Object} opts Optional parameters
* @param {module:model/WatchListRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.accountsAccountIdWatchlistsWatchlistIdPUTWithHttpInfo = function(accountId, watchlistId, opts) {
opts = opts || {};
var postBody = opts['body'];
// verify the required parameter 'accountId' is set
if (accountId === undefined || accountId === null) {
throw new Error("Missing the required parameter 'accountId' when calling accountsAccountIdWatchlistsWatchlistIdPUT");
}
// verify the required parameter 'watchlistId' is set
if (watchlistId === undefined || watchlistId === null) {
throw new Error("Missing the required parameter 'watchlistId' when calling accountsAccountIdWatchlistsWatchlistIdPUT");
}
var pathParams = {
'accountId': accountId,
'watchlistId': watchlistId
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = null;
return this.apiClient.callApi(
'/accounts/{accountId}/watchlists/{watchlistId}', 'PUT',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Replace Watchlist
* Replace watchlist for a specific account.
* @param {String} accountId
* @param {String} watchlistId
* @param {Object} opts Optional parameters
* @param {module:model/WatchListRequest} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.accountsAccountIdWatchlistsWatchlistIdPUT = function(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
*/
this.accountsWatchlistsGETWithHttpInfo = function() {
var postBody = null;
var pathParams = {
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = WatchListResponse;
return this.apiClient.callApi(
'/accounts/watchlists', 'GET',
pathParams, queryParams, collectionQueryParams, 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}
*/
this.accountsWatchlistsGET = function() {
return this.accountsWatchlistsGETWithHttpInfo()
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
return exports;
}));