@gitchrisqueen/tdameritrade-api-js-client
Version:
TD Ameritrade API integration for node.js
262 lines (226 loc) • 8.7 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 EASObject from '../model/EASObject';
import OrderGet from '../model/OrderGet';
/**
* SavedOrders service.
* @module api/SavedOrdersApi
* @version 0.1.4
*/
export default class SavedOrdersApi {
/**
* Constructs a new SavedOrdersApi.
* @alias module:api/SavedOrdersApi
* @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 Saved Orders by Path
* Saved orders for a specific account.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrderGet} and HTTP response
*/
accountsAccountIdSavedordersGETWithHttpInfo(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 = OrderGet;
return this.apiClient.callApi(
'/accounts/{accountId}/savedorders', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Saved Orders by Path
* Saved orders for a specific account.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrderGet}
*/
accountsAccountIdSavedordersGET(accountId) {
return this.accountsAccountIdSavedordersGETWithHttpInfo(accountId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Create Saved Orders
* Save an order for a specific account. See our Place Order Samples Guide - https://developer.tdameritrade.com/content/place-order-samples.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrderGet} and HTTP response
*/
accountsAccountIdSavedordersPOSTWithHttpInfo(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 = OrderGet;
return this.apiClient.callApi(
'/accounts/{accountId}/savedorders', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Create Saved Orders
* Save an order for a specific account. See our Place Order Samples Guide - https://developer.tdameritrade.com/content/place-order-samples.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrderGet}
*/
accountsAccountIdSavedordersPOST(accountId, opts) {
return this.accountsAccountIdSavedordersPOSTWithHttpInfo(accountId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Delete Saved Orders
* Delete a specific saved order for a specific account.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/EASObject} and HTTP response
*/
accountsAccountIdSavedordersSavedOrderIdDELETEWithHttpInfo(accountId, savedOrderId) {
let postBody = null;
let pathParams = {
'accountId': accountId,
'savedOrderId': savedOrderId
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = EASObject;
return this.apiClient.callApi(
'/accounts/{accountId}/savedorders/{savedOrderId}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Delete Saved Orders
* Delete a specific saved order for a specific account.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/EASObject}
*/
accountsAccountIdSavedordersSavedOrderIdDELETE(accountId, savedOrderId) {
return this.accountsAccountIdSavedordersSavedOrderIdDELETEWithHttpInfo(accountId, savedOrderId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Get Saved Orders
* Specific saved order by its ID, for a specific account.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrderGet} and HTTP response
*/
accountsAccountIdSavedordersSavedOrderIdGETWithHttpInfo(accountId, savedOrderId) {
let postBody = null;
let pathParams = {
'accountId': accountId,
'savedOrderId': savedOrderId
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = OrderGet;
return this.apiClient.callApi(
'/accounts/{accountId}/savedorders/{savedOrderId}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Get Saved Orders
* Specific saved order by its ID, for a specific account.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrderGet}
*/
accountsAccountIdSavedordersSavedOrderIdGET(accountId, savedOrderId) {
return this.accountsAccountIdSavedordersSavedOrderIdGETWithHttpInfo(accountId, savedOrderId)
.then(function(response_and_data) {
return response_and_data.data;
});
}
/**
* Replace Saved Orders
* Replace an existing saved order for an account. The existing saved order will be replaced by the new order. see our Place Order Samples Guide - Click here.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrderGet} and HTTP response
*/
accountsAccountIdSavedordersSavedOrderIdPUTWithHttpInfo(accountId, savedOrderId, opts) {
opts = opts || {};
let postBody = opts['body'];
let pathParams = {
'accountId': accountId,
'savedOrderId': savedOrderId
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['bearerAuth'];
let contentTypes = ['application/Json'];
let accepts = ['application/json'];
let returnType = OrderGet;
return this.apiClient.callApi(
'/accounts/{accountId}/savedorders/{savedOrderId}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType
);
}
/**
* Replace Saved Orders
* Replace an existing saved order for an account. The existing saved order will be replaced by the new order. see our Place Order Samples Guide - Click here.
* @param {Object} opts Optional parameters
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrderGet}
*/
accountsAccountIdSavedordersSavedOrderIdPUT(accountId, savedOrderId, opts) {
return this.accountsAccountIdSavedordersSavedOrderIdPUTWithHttpInfo(accountId, savedOrderId, opts)
.then(function(response_and_data) {
return response_and_data.data;
});
}
}