upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
134 lines (115 loc) • 4.39 kB
JavaScript
/*
* 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 {IpoDetailsResponse} from '../model/IpoDetailsResponse';
import {IpoListingResponse} from '../model/IpoListingResponse';
/**
* IPO service.
* @module api/IPOApi
* @version v0
*/
export class IPOApi {
/**
* Constructs a new IPOApi.
* @alias module:api/IPOApi
* @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 getIpoDetails operation.
* @callback moduleapi/IPOApi~getIpoDetailsCallback
* @param {String} error Error message, if any.
* @param {module:model/IpoDetailsResponse{ data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get IPO Details
* Fetches detailed information for an IPO by its slug ID.
* @param {Object} id IPO slug ID
* @param {module:api/IPOApi~getIpoDetailsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}
*/
getIpoDetails(id, callback) {
let postBody = null;
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling getIpoDetails");
}
let pathParams = {
'id': id
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['OAUTH2'];
let contentTypes = [];
let accepts = ['*/*', 'application/json'];
let returnType = IpoDetailsResponse;
return this.apiClient.callApi(
'/v2/ipos/{id}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the getIpoListing operation.
* @callback moduleapi/IPOApi~getIpoListingCallback
* @param {String} error Error message, if any.
* @param {module:model/IpoListingResponse{ data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get IPO Listing
* Fetches list of IPOs filtered by status.
* @param {Object} opts Optional parameters
* @param {Object} opts.status IPO status. Allowed values: open, closed, listed, upcoming (default to <.>)
* @param {Object} opts.issueType Issue type filter. Allowed values: regular, sme
* @param {Object} opts.pageNumber Page number (default: 1) (default to <.>)
* @param {Object} opts.records Number of records per page (default: 20, max: 30) (default to <.>)
* @param {module:api/IPOApi~getIpoListingCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}
*/
getIpoListing(opts, callback) {
opts = opts || {};
let postBody = null;
let pathParams = {
};
let queryParams = {
'status': opts['status'],'issue_type': opts['issueType'],'page_number': opts['pageNumber'],'records': opts['records']
};
let headerParams = {
};
let formParams = {
};
let authNames = ['OAUTH2'];
let contentTypes = [];
let accepts = ['*/*', 'application/json'];
let returnType = IpoListingResponse;
return this.apiClient.callApi(
'/v2/ipos', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
}