UNPKG

upstox-js-sdk

Version:

The official Node Js client for communicating with the Upstox API

338 lines (327 loc) 14.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FundamentalsApi = void 0; var _ApiClient = require("../ApiClient"); var _ApiGatewayErrorResponse = require("../model/ApiGatewayErrorResponse"); var _BalanceSheetResponse = require("../model/BalanceSheetResponse"); var _CashFlowResponse = require("../model/CashFlowResponse"); var _CompanyProfileResponse = require("../model/CompanyProfileResponse"); var _CompetitorsResponse = require("../model/CompetitorsResponse"); var _CorporateActionsResponse = require("../model/CorporateActionsResponse"); var _IncomeStatementResponse = require("../model/IncomeStatementResponse"); var _KeyRatiosResponse = require("../model/KeyRatiosResponse"); var _ShareHoldingsResponse = require("../model/ShareHoldingsResponse"); /* * 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.66 * * Do not edit the class manually. * */ /** * Fundamentals service. * @module api/FundamentalsApi * @version v0 */ class FundamentalsApi { /** * Constructs a new FundamentalsApi. * @alias module:api/FundamentalsApi * @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 getBalanceSheet operation. * @callback moduleapi/FundamentalsApi~getBalanceSheetCallback * @param {String} error Error message, if any. * @param {module:model/BalanceSheetResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Balance Sheet * Fetches balance sheet data for the given ISIN. * @param {Object} isin ISIN of the company * @param {Object} opts Optional parameters * @param {Object} opts.type Report type. Allowed values: consolidated or standalone (default to <.>) * @param {Object} opts.fs Whether to include the full financial statement (default to <.>) * @param {module:api/FundamentalsApi~getBalanceSheetCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getBalanceSheet(isin, opts, callback) { opts = opts || {}; let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getBalanceSheet"); } let pathParams = { 'isin': isin }; let queryParams = { 'type': opts['type'], 'fs': opts['fs'] }; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _BalanceSheetResponse.BalanceSheetResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/balance-sheet', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getCashFlow operation. * @callback moduleapi/FundamentalsApi~getCashFlowCallback * @param {String} error Error message, if any. * @param {module:model/CashFlowResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Cash Flow * Fetches cash flow data for the given ISIN. * @param {Object} isin ISIN of the company * @param {Object} opts Optional parameters * @param {Object} opts.type Report type. Allowed values: consolidated, standalone (default to <.>) * @param {Object} opts.fs Whether to include the full financial statement (default to <.>) * @param {module:api/FundamentalsApi~getCashFlowCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getCashFlow(isin, opts, callback) { opts = opts || {}; let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getCashFlow"); } let pathParams = { 'isin': isin }; let queryParams = { 'type': opts['type'], 'fs': opts['fs'] }; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _CashFlowResponse.CashFlowResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/cash-flow', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getCompanyProfile operation. * @callback moduleapi/FundamentalsApi~getCompanyProfileCallback * @param {String} error Error message, if any. * @param {module:model/CompanyProfileResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Company Profile * Fetches company profile information for the given ISIN. * @param {Object} isin ISIN of the company * @param {module:api/FundamentalsApi~getCompanyProfileCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getCompanyProfile(isin, callback) { let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getCompanyProfile"); } let pathParams = { 'isin': isin }; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _CompanyProfileResponse.CompanyProfileResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/profile', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getCompetitors operation. * @callback moduleapi/FundamentalsApi~getCompetitorsCallback * @param {String} error Error message, if any. * @param {module:model/CompetitorsResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Competitors * Fetches the list of competitors for the given instrument_key. * @param {Object} instrumentKey Instrument key of the company * @param {module:api/FundamentalsApi~getCompetitorsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getCompetitors(instrumentKey, callback) { let postBody = null; // verify the required parameter 'instrumentKey' is set if (instrumentKey === undefined || instrumentKey === null) { throw new Error("Missing the required parameter 'instrumentKey' when calling getCompetitors"); } let pathParams = { 'instrument_key': instrumentKey }; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _CompetitorsResponse.CompetitorsResponse; return this.apiClient.callApi('/v2/fundamentals/{instrument_key}/competitors', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getCorporateActions operation. * @callback moduleapi/FundamentalsApi~getCorporateActionsCallback * @param {String} error Error message, if any. * @param {module:model/CorporateActionsResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Corporate Actions * Fetches corporate actions for the given ISIN. * @param {Object} isin ISIN of the company * @param {module:api/FundamentalsApi~getCorporateActionsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getCorporateActions(isin, callback) { let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getCorporateActions"); } let pathParams = { 'isin': isin }; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _CorporateActionsResponse.CorporateActionsResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/corporate-actions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getIncomeStatement operation. * @callback moduleapi/FundamentalsApi~getIncomeStatementCallback * @param {String} error Error message, if any. * @param {module:model/IncomeStatementResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Income Statement * Fetches income statement data for the given ISIN. * @param {Object} isin ISIN of the company * @param {Object} opts Optional parameters * @param {Object} opts.type Report type. Allowed values: consolidated or standalone (default to <.>) * @param {Object} opts.timePeriod Time period. Allowed values: yearly, quarterly (default to <.>) * @param {Object} opts.fs Whether to include the full financial statement (default to <.>) * @param {module:api/FundamentalsApi~getIncomeStatementCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getIncomeStatement(isin, opts, callback) { opts = opts || {}; let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getIncomeStatement"); } let pathParams = { 'isin': isin }; let queryParams = { 'type': opts['type'], 'time_period': opts['timePeriod'], 'fs': opts['fs'] }; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _IncomeStatementResponse.IncomeStatementResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/income-statement', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getKeyRatios operation. * @callback moduleapi/FundamentalsApi~getKeyRatiosCallback * @param {String} error Error message, if any. * @param {module:model/KeyRatiosResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Key Ratios * Fetches key financial ratios for the given ISIN. * @param {Object} isin ISIN of the company * @param {module:api/FundamentalsApi~getKeyRatiosCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getKeyRatios(isin, callback) { let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getKeyRatios"); } let pathParams = { 'isin': isin }; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _KeyRatiosResponse.KeyRatiosResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/key-ratios', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the getShareHoldings operation. * @callback moduleapi/FundamentalsApi~getShareHoldingsCallback * @param {String} error Error message, if any. * @param {module:model/ShareHoldingsResponse{ data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Get Share Holdings * Fetches shareholding pattern for the given ISIN. * @param {Object} isin ISIN of the company * @param {module:api/FundamentalsApi~getShareHoldingsCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link <&vendorExtensions.x-jsdoc-type>} */ getShareHoldings(isin, callback) { let postBody = null; // verify the required parameter 'isin' is set if (isin === undefined || isin === null) { throw new Error("Missing the required parameter 'isin' when calling getShareHoldings"); } let pathParams = { 'isin': isin }; let queryParams = {}; let headerParams = {}; let formParams = {}; let authNames = ['OAUTH2']; let contentTypes = []; let accepts = ['*/*', 'application/json']; let returnType = _ShareHoldingsResponse.ShareHoldingsResponse; return this.apiClient.callApi('/v2/fundamentals/{isin}/share-holdings', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } } exports.FundamentalsApi = FundamentalsApi;