Skip to content

A small (read: 1) collection of tools for interfacing with the Github RESTFul API

License

Notifications You must be signed in to change notification settings

hjfitz/github-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

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:

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)

About

A small (read: 1) collection of tools for interfacing with the Github RESTFul API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published