https://github.com/vladholubiev/aws-news-api-client
AWS News API Client with retry behavior
https://github.com/vladholubiev/aws-news-api-client
aws npm-package
Last synced: 2 months ago
JSON representation
AWS News API Client with retry behavior
- Host: GitHub
- URL: https://github.com/vladholubiev/aws-news-api-client
- Owner: vladholubiev
- License: mit
- Created: 2023-03-04T19:15:01.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-06-09T20:11:54.000Z (about 2 years ago)
- Last Synced: 2025-01-11T02:52:55.879Z (over 1 year ago)
- Topics: aws, npm-package
- Language: TypeScript
- Homepage: https://awsnews.info
- Size: 27.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: license
Awesome Lists containing this project
README
# aws-news-api-client [](https://circleci.com/gh/shelfio/aws-news-api-client/tree/master)
> AWS News API Client with retry behavior
## Install
```
$ yarn add @vladholubiev/aws-news-api-client
```
## Usage
```js
const {
fetchPageOfNews,
getTotalPagesCount,
getYearsWithData,
} = require('@vladholubiev/aws-news-api-client');
// fetches 100 news from 2023
// page numbering starts from 1
await fetchPageOfNews({year: 2023, pageNumber: 1, pageSize: 100});
// returns total number of pages for 2023, useful for iteration with the fetchPageOfNews method
await getTotalPagesCount({year: 2023, pageSize: 100});
getYearsWithData(); // returns array of years with news from 2004 till now
```
`fetchPageOfNews` has retry logic, so it will retry a request for up to 5 times.
**Note:** API doesn't return more than 100th page. In 2022 there were 2103 news. So if your page size is 100, you will get 21 pages.
Don't select page size < 22, otherwise you'll not get all the news.
## Publish
```sh
$ git checkout master
$ yarn version
$ yarn publish
$ git push origin master --tags
```
## License
MIT