@gitchrisqueen/tdameritrade-api-js-client
Version:
TD Ameritrade API integration for node.js
266 lines (230 loc) • 9.78 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/Preferences', 'model/SubscriptionKey', 'model/UserPrincipal'], 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/Preferences'), require('../model/SubscriptionKey'), require('../model/UserPrincipal'));
} else {
// Browser globals (root is window)
if (!root.GitChrisQueen_TDA_JS) {
root.GitChrisQueen_TDA_JS = {};
}
root.GitChrisQueen_TDA_JS.UserInfoPreferencesApi = factory(root.GitChrisQueen_TDA_JS.ApiClient, root.GitChrisQueen_TDA_JS.ErrorObject, root.GitChrisQueen_TDA_JS.Preferences, root.GitChrisQueen_TDA_JS.SubscriptionKey, root.GitChrisQueen_TDA_JS.UserPrincipal);
}
}(this, function(ApiClient, ErrorObject, Preferences, SubscriptionKey, UserPrincipal) {
'use strict';
/**
* UserInfoPreferences service.
* @module api/UserInfoPreferencesApi
* @version 0.1.4
*/
/**
* Constructs a new UserInfoPreferencesApi.
* @alias module:api/UserInfoPreferencesApi
* @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 Preferences
* Preferences for a specific account.
* @param {String} accountId
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Preferences} and HTTP response
*/
this.accountsAccountIdPreferencesGETWithHttpInfo = 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 accountsAccountIdPreferencesGET");
}
var pathParams = {
'accountId': accountId
};
var queryParams = {
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = Preferences;
return this.apiClient.callApi(
'/accounts/{accountId}/preferences', 'GET',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Preferences
* Preferences for a specific account.
* @param {String} accountId
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Preferences}
*/
this.accountsAccountIdPreferencesGET = function(accountId) {
return this.accountsAccountIdPreferencesGETWithHttpInfo(accountId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Update Preferences
* Update preferences for a specific account. Please note that the directOptionsRouting and directEquityRouting values cannot be modified via this operation.
* @param {String} accountId
* @param {Object} opts Optional parameters
* @param {module:model/Preferences} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing HTTP response
*/
this.accountsAccountIdPreferencesPUTWithHttpInfo = 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 accountsAccountIdPreferencesPUT");
}
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}/preferences', 'PUT',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Update Preferences
* Update preferences for a specific account. Please note that the directOptionsRouting and directEquityRouting values cannot be modified via this operation.
* @param {String} accountId
* @param {Object} opts Optional parameters
* @param {module:model/Preferences} opts.body
* @return {Promise} a {@link https://www.promisejs.org/|Promise}
*/
this.accountsAccountIdPreferencesPUT = function(accountId, opts) {
return this.accountsAccountIdPreferencesPUTWithHttpInfo(accountId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get User Principals
* User Principal details.
* @param {Object} opts Optional parameters
* @param {String} opts.fields A comma separated String which allows one to specify additional fields to return. None of these fields are returned by default. Possible values in this String can be: streamerSubscriptionKeys,streamerConnectionInfo,preferences, surrogateIds. Example: fields=streamerSubscriptionKeys,streamerConnectionInfo
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UserPrincipal} and HTTP response
*/
this.userprincipalsGETWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
var queryParams = {
'fields': opts['fields'],
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = UserPrincipal;
return this.apiClient.callApi(
'/userprincipals', 'GET',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get User Principals
* User Principal details.
* @param {Object} opts Optional parameters
* @param {String} opts.fields A comma separated String which allows one to specify additional fields to return. None of these fields are returned by default. Possible values in this String can be: streamerSubscriptionKeys,streamerConnectionInfo,preferences, surrogateIds. Example: fields=streamerSubscriptionKeys,streamerConnectionInfo
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UserPrincipal}
*/
this.userprincipalsGET = function(opts) {
return this.userprincipalsGETWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get Streamer Subscription Keys
* SubscriptionKey for provided accounts or default accounts.
* @param {Object} opts Optional parameters
* @param {String} opts.accountIds A comma separated string of account IDs, to fetch subscription keys for each of them.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SubscriptionKey} and HTTP response
*/
this.userprincipalsStreamersubscriptionkeysGETWithHttpInfo = function(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {
};
var queryParams = {
'accountIds': opts['accountIds'],
};
var collectionQueryParams = {
};
var headerParams = {
};
var formParams = {
};
var authNames = ['bearerAuth'];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = SubscriptionKey;
return this.apiClient.callApi(
'/userprincipals/streamersubscriptionkeys', 'GET',
pathParams, queryParams, collectionQueryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Streamer Subscription Keys
* SubscriptionKey for provided accounts or default accounts.
* @param {Object} opts Optional parameters
* @param {String} opts.accountIds A comma separated string of account IDs, to fetch subscription keys for each of them.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/SubscriptionKey}
*/
this.userprincipalsStreamersubscriptionkeysGET = function(opts) {
return this.userprincipalsStreamersubscriptionkeysGETWithHttpInfo(opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
};
return exports;
}));