@factset/sdk-factsetglobalprices
Version:
FactSet Global Prices client library for JavaScript
292 lines (278 loc) • 15.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.PostSharesOutstandingResponseWrapper = exports.GetSharesOutstandingResponseWrapper = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _BatchStatusResponse = _interopRequireDefault(require("../model/BatchStatusResponse"));
var _SharesOutstandingRequest = _interopRequireDefault(require("../model/SharesOutstandingRequest"));
var _SharesOutstandingResponse = _interopRequireDefault(require("../model/SharesOutstandingResponse"));
var _SoErrorResponse = _interopRequireDefault(require("../model/SoErrorResponse"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
/**
* FactSet Global Prices API
* The FactSet Global Prices API provides end of day market pricing content using cloud and microservices technology, encompassing both pricing as well as corporate actions and events data.</p>
*
* The version of the OpenAPI document: 1.8.0
* Contact: api@factset.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
/**
* SharesOutstanding service.
* @module api/SharesOutstandingApi
*/
class SharesOutstandingApi {
/**
* Constructs a new SharesOutstandingApi.
* @alias module:api/SharesOutstandingApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
constructor(apiClient) {
this.apiClient = apiClient || _ApiClient.default.instance;
}
/**
* Gets Shares Outstanding information for securities.
* Returns security level shares outstanding data for the given ids and dates. At this time, all values returned are split adjusted.
* @param {Array.<String>} ids The requested list of security identifiers. Accepted ID types include Market Tickers, SEDOL, ISINs, CUSIPs, or FactSet Permanent Ids.<p>***ids limit** = 50 per both non-batch request and batch request*</p> *<p>Make note, GET Method URL request lines are also limited to a total length of 8192 bytes (8KB). In cases where the service allows for thousands of ids, which may lead to exceeding this request line limit of 8KB, it's advised for any requests with large request lines to be requested through the respective \"POST\" method.</p>*
* @param {Object} opts Optional parameters
* @param {String} opts.startDate The start date requested for a given date range in **YYYY-MM-DD** format. The input start date must be before the input end date. Future dates (T+1) are not accepted in this endpoint. (default to '2021-08-27')
* @param {String} opts.endDate The end date requested for a given date range in **YYYY-MM-DD** format. The input end date must be after the input start date. Future dates (T+1) are not accepted in this endpoint.
* @param {module:model/String} opts.frequency Controls the display frequency of the data returned. * **D** = Daily * **AD** = Actual Daily * **W** = Weekly, based on the last day of the week of the start date. * **M** = Monthly, based on the last trading day of the month. * **AM** = Monthly, based on the start date (e.g., if the start date is June 16, data is displayed for June 16, May 16, April 16 etc.). * **AQ** = Actual Quarterly * **CQ** = Quarterly based on the last trading day of the calendar quarter (March, June, September, or December). * **ASA** = Actual Semi-annual * **CSA** = Calendar Semi-annual * **AY** = Actual Annual, based on the start date. * **CY** = Calendar Annual, based on the last trading day of the calendar year. (default to 'D')
* @param {module:model/String} opts.calendar Calendar of data returned. SEVENDAY includes weekends. (default to 'FIVEDAY')
* @param {module:model/String} opts.batch Enables the ability to asynchronously \"batch\" the request, supporting a long-running request for up to 20 minutes. Upon requesting batch=Y, the service will respond with an HTTP Status Code of 202. Once a batch request is submitted, use batch status to see if the job has been completed. Once completed, retrieve the results of the request via batch-result. For single-day requests, the ids limit is 500 for non-batch and 2000 for batch. For multi-day requests, the limit is 50 ids for both batch and non-batch. Limits on query string via GET method still apply. It's advised to submit large lists of ids via POST method. <B>Please note that the number of unique currencies present in the requested ids is limited to 50 per request.</B> (default to 'N')
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SharesOutstandingResponse} and HTTP response
*/
getSharesOutstandingWithHttpInfo(ids, opts) {
opts = opts || {};
let postBody = null;
// verify the required parameter 'ids' is set
if (ids === undefined || ids === null) {
throw new Error("Missing the required parameter 'ids' when calling getSharesOutstanding");
}
let pathParams = {};
let queryParams = {
'ids': this.apiClient.buildCollectionParam(ids, 'csv'),
'startDate': opts['startDate'],
'endDate': opts['endDate'],
'frequency': opts['frequency'],
'calendar': opts['calendar'],
'batch': opts['batch']
};
let headerParams = {};
let formParams = {};
let authNames = ['FactSetApiKey', 'FactSetOAuth2'];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = GetSharesOutstandingResponseWrapperTypeMap;
return this.apiClient.callApi('/factset-global-prices/v1/security-shares', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Gets Shares Outstanding information for securities.
* Returns security level shares outstanding data for the given ids and dates. At this time, all values returned are split adjusted.
* @param {Array.<String>} ids The requested list of security identifiers. Accepted ID types include Market Tickers, SEDOL, ISINs, CUSIPs, or FactSet Permanent Ids.<p>***ids limit** = 50 per both non-batch request and batch request*</p> *<p>Make note, GET Method URL request lines are also limited to a total length of 8192 bytes (8KB). In cases where the service allows for thousands of ids, which may lead to exceeding this request line limit of 8KB, it's advised for any requests with large request lines to be requested through the respective \"POST\" method.</p>*
* @param {Object} opts Optional parameters
* @param {String} opts.startDate The start date requested for a given date range in **YYYY-MM-DD** format. The input start date must be before the input end date. Future dates (T+1) are not accepted in this endpoint. (default to '2021-08-27')
* @param {String} opts.endDate The end date requested for a given date range in **YYYY-MM-DD** format. The input end date must be after the input start date. Future dates (T+1) are not accepted in this endpoint.
* @param {module:model/String} opts.frequency Controls the display frequency of the data returned. * **D** = Daily * **AD** = Actual Daily * **W** = Weekly, based on the last day of the week of the start date. * **M** = Monthly, based on the last trading day of the month. * **AM** = Monthly, based on the start date (e.g., if the start date is June 16, data is displayed for June 16, May 16, April 16 etc.). * **AQ** = Actual Quarterly * **CQ** = Quarterly based on the last trading day of the calendar quarter (March, June, September, or December). * **ASA** = Actual Semi-annual * **CSA** = Calendar Semi-annual * **AY** = Actual Annual, based on the start date. * **CY** = Calendar Annual, based on the last trading day of the calendar year. (default to 'D')
* @param {module:model/String} opts.calendar Calendar of data returned. SEVENDAY includes weekends. (default to 'FIVEDAY')
* @param {module:model/String} opts.batch Enables the ability to asynchronously \"batch\" the request, supporting a long-running request for up to 20 minutes. Upon requesting batch=Y, the service will respond with an HTTP Status Code of 202. Once a batch request is submitted, use batch status to see if the job has been completed. Once completed, retrieve the results of the request via batch-result. For single-day requests, the ids limit is 500 for non-batch and 2000 for batch. For multi-day requests, the limit is 50 ids for both batch and non-batch. Limits on query string via GET method still apply. It's advised to submit large lists of ids via POST method. <B>Please note that the number of unique currencies present in the requested ids is limited to 50 per request.</B> (default to 'N')
* @return { Promise.< GetSharesOutstandingResponseWrapper > } a Promise, with data of type {@link GetSharesOutstandingResponseWrapper }
*/
getSharesOutstanding(ids, opts) {
return this.getSharesOutstandingWithHttpInfo(ids, opts).then(function (response_and_data) {
return response_and_data.data;
});
}
/**
* Gets Shares Outstanding information for securities.
* Returns security level shares outstanding data for the given ids and dates. At this time, all values returned are split adjusted.
* @param {module:model/SharesOutstandingRequest} sharesOutstandingRequest Request object for `Shares Outstanding`.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/SharesOutstandingResponse} and HTTP response
*/
postSharesOutstandingWithHttpInfo(sharesOutstandingRequest) {
let postBody = sharesOutstandingRequest;
// verify the required parameter 'sharesOutstandingRequest' is set
if (sharesOutstandingRequest === undefined || sharesOutstandingRequest === null) {
throw new Error("Missing the required parameter 'sharesOutstandingRequest' when calling postSharesOutstanding");
}
let pathParams = {};
let queryParams = {};
let headerParams = {};
let formParams = {};
let authNames = ['FactSetApiKey', 'FactSetOAuth2'];
let contentTypes = ['application/json'];
let accepts = ['application/json'];
let returnType = PostSharesOutstandingResponseWrapperTypeMap;
return this.apiClient.callApi('/factset-global-prices/v1/security-shares', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Gets Shares Outstanding information for securities.
* Returns security level shares outstanding data for the given ids and dates. At this time, all values returned are split adjusted.
* @param {module:model/SharesOutstandingRequest} sharesOutstandingRequest Request object for `Shares Outstanding`.
* @return { Promise.< PostSharesOutstandingResponseWrapper > } a Promise, with data of type {@link PostSharesOutstandingResponseWrapper }
*/
postSharesOutstanding(sharesOutstandingRequest) {
return this.postSharesOutstandingWithHttpInfo(sharesOutstandingRequest).then(function (response_and_data) {
return response_and_data.data;
});
}
}
exports.default = SharesOutstandingApi;
const GetSharesOutstandingResponseWrapperTypeMap = {
200: _SharesOutstandingResponse.default,
202: _BatchStatusResponse.default,
400: _SoErrorResponse.default,
401: _SoErrorResponse.default,
403: _SoErrorResponse.default,
415: _SoErrorResponse.default,
500: _SoErrorResponse.default,
_createResponseWrapper(statusCode, response) {
return new GetSharesOutstandingResponseWrapper(statusCode, response);
}
};
const PostSharesOutstandingResponseWrapperTypeMap = {
200: _SharesOutstandingResponse.default,
202: _BatchStatusResponse.default,
400: _SoErrorResponse.default,
401: _SoErrorResponse.default,
403: _SoErrorResponse.default,
415: _SoErrorResponse.default,
500: _SoErrorResponse.default,
_createResponseWrapper(statusCode, response) {
return new PostSharesOutstandingResponseWrapper(statusCode, response);
}
};
/**
* Wrapper to support GET /factset-global-prices/v1/security-shares returning different types
* per status code.
*
* <p>
* Responses:
* <ul>
* <li>200 : {@code SharesOutstandingResponse }<br>Array of security shares outstanding information for a given date range and list of securities</li>
*
* <li>202 : {@code BatchStatusResponse }<br>Batch request has been accepted.</li>
* </ul>
*
* </p>
* Example:
* <pre>{@code
* const response = ...;
* switch (response.statusCode) {
* case 200:
* SharesOutstandingResponse data200 = response.getResponse200();
* break;
* case 202:
* BatchStatusResponse data202 = response.getResponse202();
* break;
* }
* }</pre>
*
* @alias module:GetSharesOutstandingResponseWrapper
* @class
*/
class GetSharesOutstandingResponseWrapper {
/**
* @param {number} statusCode
* @param {*} response
*/
constructor(statusCode, response) {
/**
* @type {number}
*/
this.statusCode = statusCode;
/**
* @type {*}
*/
this.response = response;
}
/**
* @returns { SharesOutstandingResponse }
*/
getResponse200() {
if (this.statusCode !== 200) {
throw new Error("Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response");
}
return this.response;
}
/**
* @returns { BatchStatusResponse }
*/
getResponse202() {
if (this.statusCode !== 202) {
throw new Error("Invalid response getter called. getResponse202 can't return a " + this.statusCode + " response");
}
return this.response;
}
}
/**
* Wrapper to support POST /factset-global-prices/v1/security-shares returning different types
* per status code.
*
* <p>
* Responses:
* <ul>
* <li>200 : {@code SharesOutstandingResponse }<br>Array of shares outstanding</li>
*
* <li>202 : {@code BatchStatusResponse }<br>Batch request has been accepted.</li>
* </ul>
*
* </p>
* Example:
* <pre>{@code
* const response = ...;
* switch (response.statusCode) {
* case 200:
* SharesOutstandingResponse data200 = response.getResponse200();
* break;
* case 202:
* BatchStatusResponse data202 = response.getResponse202();
* break;
* }
* }</pre>
*
* @alias module:PostSharesOutstandingResponseWrapper
* @class
*/
exports.GetSharesOutstandingResponseWrapper = GetSharesOutstandingResponseWrapper;
class PostSharesOutstandingResponseWrapper {
/**
* @param {number} statusCode
* @param {*} response
*/
constructor(statusCode, response) {
/**
* @type {number}
*/
this.statusCode = statusCode;
/**
* @type {*}
*/
this.response = response;
}
/**
* @returns { SharesOutstandingResponse }
*/
getResponse200() {
if (this.statusCode !== 200) {
throw new Error("Invalid response getter called. getResponse200 can't return a " + this.statusCode + " response");
}
return this.response;
}
/**
* @returns { BatchStatusResponse }
*/
getResponse202() {
if (this.statusCode !== 202) {
throw new Error("Invalid response getter called. getResponse202 can't return a " + this.statusCode + " response");
}
return this.response;
}
}
exports.PostSharesOutstandingResponseWrapper = PostSharesOutstandingResponseWrapper;