upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
432 lines (370 loc) • 15.4 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.66
*
* Do not edit the class manually.
*
*/
import {ApiClient} from "../ApiClient";
import {ApiGatewayErrorResponse} from '../model/ApiGatewayErrorResponse';
import {BalanceSheetResponse} from '../model/BalanceSheetResponse';
import {CashFlowResponse} from '../model/CashFlowResponse';
import {CompanyProfileResponse} from '../model/CompanyProfileResponse';
import {CompetitorsResponse} from '../model/CompetitorsResponse';
import {CorporateActionsResponse} from '../model/CorporateActionsResponse';
import {IncomeStatementResponse} from '../model/IncomeStatementResponse';
import {KeyRatiosResponse} from '../model/KeyRatiosResponse';
import {ShareHoldingsResponse} from '../model/ShareHoldingsResponse';
/**
* Fundamentals service.
* @module api/FundamentalsApi
* @version v0
*/
export 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.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;
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;
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;
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;
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;
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;
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;
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;
return this.apiClient.callApi(
'/v2/fundamentals/{isin}/share-holdings', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
}