A read-only library for accessing version 3 of GitHub's API and driven by Garden HTTP.
- Issues
- Pull Requests
- Repositories
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 theLink
header returned by API requests to extract the following pagination data: first page, last page, next page and previous page.getRateLimit
- Will parse theX-RateLimit-*
headers to determine the account limit, remaining requests until the limit is reached and a timestamp of when the limit will be reset.
// 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();
- 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, if necessary. In addition, methods likegetBody
can be used to retrieve the data and convert from JSON to an object, automatically, if possible.