upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
176 lines (169 loc) • 7.51 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.MutualFundApi = void 0;
var _ApiClient = require("../ApiClient");
var _ApiGatewayErrorResponse = require("../model/ApiGatewayErrorResponse");
var _GetMutualFundHoldingsResponse = require("../model/GetMutualFundHoldingsResponse");
var _GetMutualFundOrderDetailsResponse = require("../model/GetMutualFundOrderDetailsResponse");
var _GetMutualFundOrdersResponse = require("../model/GetMutualFundOrdersResponse");
var _GetMutualFundSipsResponse = require("../model/GetMutualFundSipsResponse");
/*
* 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.
*
*/
/**
* MutualFund service.
* @module api/MutualFundApi
* @version v0
*/
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.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.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.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.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.GetMutualFundSipsResponse;
return this.apiClient.callApi('/v2/mf/sips', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback);
}
}
exports.MutualFundApi = MutualFundApi;