UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

223 lines (188 loc) 7.83 kB
/* * OpenAPI definition * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: v0 * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * * Swagger Codegen version: 3.0.79 * * Do not edit the class manually. * */ import {ApiClient} from "../ApiClient"; import {ApiGatewayErrorResponse} from '../model/ApiGatewayErrorResponse'; import {GetMutualFundHoldingsResponse} from '../model/GetMutualFundHoldingsResponse'; import {GetMutualFundOrderDetailsResponse} from '../model/GetMutualFundOrderDetailsResponse'; import {GetMutualFundOrdersResponse} from '../model/GetMutualFundOrdersResponse'; import {GetMutualFundSipsResponse} from '../model/GetMutualFundSipsResponse'; /** * MutualFund service. * @module api/MutualFundApi * @version v0 */ export class MutualFundApi { /** * Constructs a new MutualFundApi. * @alias module:api/MutualFundApi * @class * @param {module:ApiClient} [apiClient] Optional API client implementation to use, * default to {@link module:ApiClient#instanc e} if unspecified. */ constructor(apiClient) { this.apiClient = apiClient || ApiClient.instance; } /** * Callback function to receive the result of the getMutualFundHoldings operation. * @callback moduleapi/MutualFundApi~getMutualFundHoldingsCallback * @param {String} error Error message, if any. * @param {module:model/GetMutualFundHoldingsResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get mutual fund holdings * Returns mutual fund holdings for the authenticated user. * @param {module:api/MutualFundApi~getMutualFundHoldingsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getMutualFundHoldings(callback) { let postBody = null; let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = GetMutualFundHoldingsResponse; return this.apiClient.callApi( '/v2/mf/holdings', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMutualFundOrder operation. * @callback moduleapi/MutualFundApi~getMutualFundOrderCallback * @param {String} error Error message, if any. * @param {module:model/GetMutualFundOrderDetailsResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get mutual fund order by id * Returns a single mutual fund order by order id. * @param {Object} orderId Mutual fund order id * @param {module:api/MutualFundApi~getMutualFundOrderCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getMutualFundOrder(orderId, callback) { let postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { throw new Error("Missing the required parameter 'orderId' when calling getMutualFundOrder"); } let pathParams = { 'order_id': orderId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = GetMutualFundOrderDetailsResponse; return this.apiClient.callApi( '/v2/mf/orders/{order_id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMutualFundOrders operation. * @callback moduleapi/MutualFundApi~getMutualFundOrdersCallback * @param {String} error Error message, if any. * @param {module:model/GetMutualFundOrdersResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get mutual fund orders * Returns mutual fund orders from the last 7 days for the authenticated user. * @param {Object} opts Optional parameters * @param {Object} opts.status Mutual fund order status (default to <.>) * @param {Object} opts.transactionType Mutual fund order transaction type (default to <.>) * @param {Object} opts.pageNumber Page number for pagination. (default to <.>) * @param {Object} opts.records no of records in a single page (default to <.>) * @param {module:api/MutualFundApi~getMutualFundOrdersCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getMutualFundOrders(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'status': opts['status'],'transaction_type': opts['transactionType'],'page_number': opts['pageNumber'],'records': opts['records'] }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = GetMutualFundOrdersResponse; return this.apiClient.callApi( '/v2/mf/orders', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the getMutualFundSips operation. * @callback moduleapi/MutualFundApi~getMutualFundSipsCallback * @param {String} error Error message, if any. * @param {module:model/GetMutualFundSipsResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get mutual fund SIPs * Returns active and paused SIP orders for the authenticated user. * @param {Object} opts Optional parameters * @param {Object} opts.pageNumber Page number for pagination. (default to <.>) * @param {Object} opts.records no of records in a single page (default to <.>) * @param {module:api/MutualFundApi~getMutualFundSipsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getMutualFundSips(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'page_number': opts['pageNumber'],'records': opts['records'] }; let headerParams = { }; let formParams = { }; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = GetMutualFundSipsResponse; return this.apiClient.callApi( '/v2/mf/sips', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }