\duncan3dc\GitHubApi

Summary

Methods
Properties
Constants
request()
post()
put()
delete()
get()
getAll()
__construct()
getOrganizations()
getOrganization()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
response()
$app
$key
$client
$organizations
N/A

Properties

$app

$app : integer

Type

integer — The App ID to access the GitHub API via.

$key

$key : string

Type

string — The private key for the app.

$client

$client : \GuzzleHttp\ClientInterface

Type

\GuzzleHttp\ClientInterface — The HTTP client to communicate via.

$organizations

$organizations : array<mixed,\duncan3dc\GitHub\OrganizationInterface>

Type

array<mixed,\duncan3dc\GitHub\OrganizationInterface> — The organizations this app is installed under.

Methods

request()

request(string  $method, string  $url, array  $data = array()) : \Psr\Http\Message\ResponseInterface

Send a request and return the response.

Parameters

string $method

The HTTP verb to use for the request

string $url

The url to issue the request to (https://api.github.com is optional)

array $data

The parameters to send with the request

Returns

\Psr\Http\Message\ResponseInterface

post()

post(string  $url, array  $data = array()) : \stdClass

Send a POST request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

put()

put(string  $url, array  $data = array()) : \stdClass

Send a PUT request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

delete()

delete(string  $url, array  $data = array()) : \stdClass

Send a DELETE request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

get()

get(string  $url, array  $data = array()) : \stdClass

Send a GET request and return the response.

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

Returns

\stdClass

getAll()

getAll(string  $url, array  $data = array(), callable  $callback = null) : \Traversable|array<mixed,\stdClass>

Send a GET request and return the response.

This method will loop through all the pages until one returns no results

Parameters

string $url

The url to issue the request to

array $data

The parameters to send with the request

callable $callback

An optional handler to yield items via

Returns

\Traversable|array<mixed,\stdClass>

__construct()

__construct(integer  $app, string  $key, \GuzzleHttp\ClientInterface  $client = null) 

Create a new instance.

Parameters

integer $app

The App ID to access the GitHub API via.

string $key

The app key (.pem file contents)

\GuzzleHttp\ClientInterface $client

The HTTP client to communicate via

getOrganizations()

getOrganizations() : array<mixed,\duncan3dc\GitHub\OrganizationInterface>

Get all the organizations this app is installed under.

Returns

array<mixed,\duncan3dc\GitHub\OrganizationInterface>

getOrganization()

getOrganization(string  $name) : \duncan3dc\GitHub\OrganizationInterface

Get an organization this app is installed under.

Parameters

string $name

The name of the organisation

Returns

\duncan3dc\GitHub\OrganizationInterface

response()

response(\Psr\Http\Message\ResponseInterface  $response) : \stdClass

Convert a response into a simple object.

Parameters

\Psr\Http\Message\ResponseInterface $response

The response to convert

Returns

\stdClass