upstox-js-sdk
Version:
The official Node Js client for communicating with the Upstox API
224 lines (187 loc) • 7.55 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.54
*
* Do not edit the class manually.
*
*/
import {ApiClient} from "../ApiClient";
import {ApiGatewayErrorResponse} from '../model/ApiGatewayErrorResponse';
import {GetExchangeTimingResponse} from '../model/GetExchangeTimingResponse';
import {GetHolidayResponse} from '../model/GetHolidayResponse';
import {GetMarketStatusResponse} from '../model/GetMarketStatusResponse';
/**
* MarketHolidaysAndTimings service.
* @module api/MarketHolidaysAndTimingsApi
* @version v0
*/
export class MarketHolidaysAndTimingsApi {
/**
* Constructs a new MarketHolidaysAndTimingsApi.
* @alias module:api/MarketHolidaysAndTimingsApi
* @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 getExchangeTimings operation.
* @callback moduleapi/MarketHolidaysAndTimingsApi~getExchangeTimingsCallback
* @param {String} error Error message, if any.
* @param {module:model/GetExchangeTimingResponse{ data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Exchange Timings on particular date
* This API provides the functionality to retrieve the exchange timings on particular date
* @param {String} _date
* @param {module:api/MarketHolidaysAndTimingsApi~getExchangeTimingsCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}
*/
getExchangeTimings(_date, callback) {
let postBody = null;
// verify the required parameter '_date' is set
if (_date === undefined || _date === null) {
throw new Error("Missing the required parameter '_date' when calling getExchangeTimings");
}
let pathParams = {
'date': _date
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json', '*/*'];
let returnType = GetExchangeTimingResponse;
return this.apiClient.callApi(
'/v2/market/timings/{date}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the getHoliday operation.
* @callback moduleapi/MarketHolidaysAndTimingsApi~getHolidayCallback
* @param {String} error Error message, if any.
* @param {module:model/GetHolidayResponse{ data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Holiday on particular date
* This API provides the functionality to retrieve the holiday on particular date
* @param {String} _date
* @param {module:api/MarketHolidaysAndTimingsApi~getHolidayCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}
*/
getHoliday(_date, callback) {
let postBody = null;
// verify the required parameter '_date' is set
if (_date === undefined || _date === null) {
throw new Error("Missing the required parameter '_date' when calling getHoliday");
}
let pathParams = {
'date': _date
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json', '*/*'];
let returnType = GetHolidayResponse;
return this.apiClient.callApi(
'/v2/market/holidays/{date}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the getHolidays operation.
* @callback moduleapi/MarketHolidaysAndTimingsApi~getHolidaysCallback
* @param {String} error Error message, if any.
* @param {module:model/GetHolidayResponse{ data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Holiday list of current year
* This API provides the functionality to retrieve the holiday list of current year
* @param {module:api/MarketHolidaysAndTimingsApi~getHolidaysCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}
*/
getHolidays(callback) {
let postBody = null;
let pathParams = {
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json', '*/*'];
let returnType = GetHolidayResponse;
return this.apiClient.callApi(
'/v2/market/holidays', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
/**
* Callback function to receive the result of the getMarketStatus operation.
* @callback moduleapi/MarketHolidaysAndTimingsApi~getMarketStatusCallback
* @param {String} error Error message, if any.
* @param {module:model/GetMarketStatusResponse{ data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Get Market status for particular exchange
* This API provides the functionality to retrieve the market status for particular exchange
* @param {String} exchange
* @param {module:api/MarketHolidaysAndTimingsApi~getMarketStatusCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link <&vendorExtensions.x-jsdoc-type>}
*/
getMarketStatus(exchange, callback) {
let postBody = null;
// verify the required parameter 'exchange' is set
if (exchange === undefined || exchange === null) {
throw new Error("Missing the required parameter 'exchange' when calling getMarketStatus");
}
let pathParams = {
'exchange': exchange
};
let queryParams = {
};
let headerParams = {
};
let formParams = {
};
let authNames = ['OAUTH2'];
let contentTypes = [];
let accepts = ['application/json', '*/*'];
let returnType = GetMarketStatusResponse;
return this.apiClient.callApi(
'/v2/market/status/{exchange}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, callback
);
}
}