var Ceic = require('ceic_api');
,var accessToken = "ENTER YOUR API KEY HERE";
var apiClient = new Ceic.ApiClient();
var seriesApi = new Ceic.SeriesApi(apiClient);
let offset = 0;
const step = 100;
searchArguments = {
keyword: "KEYWORD 1",
country: ["COUNTRY CODE"],
offset: offset,
limit: step,
token: accessToken
};
async function searchSeries(searchArguments) {
let seriesSearchResult = await seriesApi.searchSeries(searchArguments);
while (seriesSearchResult.data.items.length > 0) {
console.log(JSON.stringify(seriesSearchResult));
searchArguments.offset += searchArguments.limit;
seriesSearchResult = await seriesApi.searchSeries(searchArguments);
}
}
(async() => {
try {
await searchSeries(searchArguments);
} catch (err) {
console.log(JSON.stringify(err));
}
})();