Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/intevel/gh-notifications
📬 Lightweight (<3KB) Wrapper around the GitHub Notifications API
https://github.com/intevel/gh-notifications
gh-notifications github github-api inbox notifications typescript wrapper
Last synced: about 2 months ago
JSON representation
📬 Lightweight (<3KB) Wrapper around the GitHub Notifications API
- Host: GitHub
- URL: https://github.com/intevel/gh-notifications
- Owner: Intevel
- License: mit
- Created: 2023-02-27T21:17:30.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-02-28T21:21:55.000Z (almost 2 years ago)
- Last Synced: 2024-04-25T23:00:29.903Z (8 months ago)
- Topics: gh-notifications, github, github-api, inbox, notifications, typescript, wrapper
- Language: TypeScript
- Homepage:
- Size: 64.5 KB
- Stars: 9
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# gh-notifications
[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![License][license-src]][license-href]📬 Lightweight (<3KB) Wrapper around the GitHub Notifications API
## Install
```sh
# Using npm
npm install gh-notifications# Using yarn
yarn add gh-notifications
```## Usage
> Warning:
> Usage of _gh-notifications_ requires a valid github api token: [Documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github#authenticating-with-the-api)```js
const APITOKEN = "**************";async function main() {
// get a GitHubInbox instance and pass the api token to it
const inbox = new GitHubInbox(APITOKEN);
// initialize the inbox
await inbox.initialize();// fetch all unread notifications
const unreadNotifications = await inbox.fetchUnreadNotifications();
// view src/types.ts for all fields in the notification object
console.log(unreadNotifications);// mark the latest unread notification as read
await inbox.markAsRead(unreadNotifications[0]?.id);
}main();
```## License
Published under MIT - Made with ❤️ by Conner Bachmann
[npm-version-src]: https://img.shields.io/npm/v/gh-notifications/latest.svg
[npm-version-href]: https://npmjs.com/package/gh-notifications
[npm-downloads-src]: https://img.shields.io/npm/dt/gh-notifications.svg
[npm-downloads-href]: https://npmjs.com/package/gh-notifications
[github-actions-ci-src]: https://github.com/intevel/gh-notifications/actions/workflows/ci.yml/badge.svg
[github-actions-ci-href]: https://github.com/intevel/gh-notifications/actions?query=workflow%3Aci
[license-src]: https://img.shields.io/npm/l/gh-notifications.svg
[license-href]: https://npmjs.com/package/gh-notifications