https://github.com/hjfitz/github-tools
A small (read: 1) collection of tools for interfacing with the Github RESTFul API
https://github.com/hjfitz/github-tools
api axios github restful-api tsc typescript
Last synced: 25 days ago
JSON representation
A small (read: 1) collection of tools for interfacing with the Github RESTFul API
- Host: GitHub
- URL: https://github.com/hjfitz/github-tools
- Owner: hjfitz
- License: gpl-2.0
- Created: 2018-03-28T13:10:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-29T18:50:56.000Z (about 8 years ago)
- Last Synced: 2025-07-12T20:55:55.317Z (11 months ago)
- Topics: api, axios, github, restful-api, tsc, typescript
- Language: TypeScript
- Homepage:
- Size: 17.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GitHub Tools
A little TypeScript library because I'm too lazy to rewrite code
## Features:
- Auto pagination
- Waits if about to go over the API limit
## Usage:
```js
const gitTools = require('@hjfitz/github-tools');
const client = gitTools.createClient({ token: process.env.GITHUB_PAT });
const results = await client.request('/orgs/myCoolorg/users');
// use auto pagination
const paginatedResults = await client.request('/orgs/myCoolorg/users', 3, true);
```
## Request signature:
```js
client.request(url, retries, paginate, page number);
```
* `url: string` - the API url to hit
* `retries: number` - the maximum number of retries to attempt (default: 3)
* `paginate: boolean` - whether to auto-paginate (default: false)
* `page number: number` - which page to start on (default: 0)