GithubHelp home page GithubHelp logo

mittens's Introduction

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();

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, if necessary. In addition, methods like getBody can be used to retrieve the data and convert from JSON to an object, automatically, if possible.

mittens's People

Contributors

initvector avatar linc avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.