var Ceic = require('ceic_api');
,var accessToken = "ENTER YOUR API KEY HERE";
var apiClient = new Ceic.ApiClient();
var seriesApi = new Ceic.SeriesApi(apiClient);
const seriesIds = ["EXAMPLE SERIES ID"];
async function getSeriesInChunks(seriesIds, chunkSize) {
let chunks = split_array_into_chunks(seriesIds, chunkSize);
for (i in chunks) {
let result = await seriesApi.getSeries(chunks[i], {"token": accessToken});
console.log(JSON.stringify(result));
}
}
function split_array_into_chunks(arr, chunkSize) {
let result = [];
for (let i = 0; i < arr.length; i += chunkSize) {
let chunkArray = arr.slice(i, i + chunkSize);
result.push(result);
}
return result;
}
let chunkSize = 25;
(async() => {
try {
await getSeriesInChunks(seriesIds, chunkSize);
} catch (err) {
console.log(JSON.stringify(err));
}
})();