Skip to content

initvector/mittens

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mittens

A read-only library for accessing version 3 of GitHub's API and driven by Garden HTTP.

Currently Supported

Convenience Methods

Initvector\Mittens\GitHubData contains a few functions to simplify the extraction of key data from GitHub API responses. These functions are:

  • getEtag - Grabs the entity tag from a response and returns it, along with a strong/weak flag.
  • getPagination - Breaks the Link header returned by API requests to extract the following pagination data: first page, last page, next page and previous page.
  • getRateLimit - Will parse the X-RateLimit-* headers to determine the account limit, remaining requests until the limit is reached and a timestamp of when the limit will be reset.

Example Usage

// Grab the first page of results of all repos the current API user is associated with
use Initvector\Mittens\Client as mittens;

$mittens = new mittens('authentication-token-goes-here');
$result = $mittens->repo()->getOwn()->getBody();

Now $result contains the response body from GitHub's List Your Repos endpoint as an array.

Usage Notes

  • API requests will return an Garden\Http\HttpResponse object representing the full state of the HTTP response. This object can be used to pull raw header or body contents.
  • Use getBody to retrieve the data and convert from JSON to an array, if possible.

About

A read-only GitHub library, driven by Garden HTTP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages