PHP Class Milo\Github\Api

See also: https://developer.github.com/v3/
Author: Miloslav Hůla (https://github.com/milo)
Inheritance: extends Milo\Github\Sanity
Show file Open project: milo/github-api Class Usage Examples

Public Methods

Method Description
__construct ( Milo\Github\Http\IClient $client = NULL )
createRequest ( $method, $urlPath, array $parameters = [], array $headers = [], $content = NULL ) : Milo\Github\Http\Request
decode ( Milo\Github\Http\Response $response, array $okCodes = NULL ) : mixed
delete ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
get ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
getClient ( ) : Milo\Github\Http\IClient
getDefaultParameters ( ) : array
getToken ( ) : Milo\Github\OAuth\Token | null
getUrl ( ) : string
head ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
paginator ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Paginator Creates paginator for HTTP GET requests.
patch ( $urlPath, $content, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
post ( $urlPath, $content, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
put ( $urlPath, $content = NULL, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
request ( Milo\Github\Http\Request $request ) : Milo\Github\Http\Response
setDefaultParameters ( array $defaults = NULL ) : self
setToken ( Milo\Github\OAuth\Token $token = NULL ) : self
setUrl ( $url ) : self
withUrl ( $url ) : Api

Protected Methods

Method Description
expandColonParameters ( $url, array $parameters, array $defaultParameters ) : string
expandUriTemplate ( $url, array $parameters, array $defaultParameters ) : string Expands URI template (RFC 6570).

Private Methods

Method Description
errorMessage ( $content ) : string
escape ( array $flags, $value, $maxLength = NULL ) : string
prefix ( array $flags, $name, $value ) : string
walk ( array $array, $cb )

Method Details

__construct() public method

public __construct ( Milo\Github\Http\IClient $client = NULL )
$client Milo\Github\Http\IClient

createRequest() public method

public createRequest ( $method, $urlPath, array $parameters = [], array $headers = [], $content = NULL ) : Milo\Github\Http\Request
$parameters array
$headers array
return Milo\Github\Http\Request

decode() public method

public decode ( Milo\Github\Http\Response $response, array $okCodes = NULL ) : mixed
$response Milo\Github\Http\Response
$okCodes array
return mixed

delete() public method

See also: createRequest()
See also: request()
public delete ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
$parameters array
$headers array
return Milo\Github\Http\Response

expandColonParameters() protected method

protected expandColonParameters ( $url, array $parameters, array $defaultParameters ) : string
$parameters array
$defaultParameters array
return string

expandUriTemplate() protected method

Expands URI template (RFC 6570).
See also: http://tools.ietf.org/html/rfc6570
protected expandUriTemplate ( $url, array $parameters, array $defaultParameters ) : string
$parameters array
$defaultParameters array
return string

get() public method

See also: createRequest()
See also: request()
public get ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
$parameters array
$headers array
return Milo\Github\Http\Response

getClient() public method

public getClient ( ) : Milo\Github\Http\IClient
return Milo\Github\Http\IClient

getDefaultParameters() public method

public getDefaultParameters ( ) : array
return array

getToken() public method

public getToken ( ) : Milo\Github\OAuth\Token | null
return Milo\Github\OAuth\Token | null

getUrl() public method

public getUrl ( ) : string
return string

head() public method

See also: createRequest()
See also: request()
public head ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
$parameters array
$headers array
return Milo\Github\Http\Response

paginator() public method

Creates paginator for HTTP GET requests.
See also: get()
public paginator ( $urlPath, array $parameters = [], array $headers = [] ) : Milo\Github\Paginator
$parameters array
$headers array
return Milo\Github\Paginator

patch() public method

See also: createRequest()
See also: request()
public patch ( $urlPath, $content, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
$parameters array
$headers array
return Milo\Github\Http\Response

post() public method

See also: createRequest()
See also: request()
public post ( $urlPath, $content, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
$parameters array
$headers array
return Milo\Github\Http\Response

put() public method

See also: createRequest()
See also: request()
public put ( $urlPath, $content = NULL, array $parameters = [], array $headers = [] ) : Milo\Github\Http\Response
$parameters array
$headers array
return Milo\Github\Http\Response

request() public method

public request ( Milo\Github\Http\Request $request ) : Milo\Github\Http\Response
$request Milo\Github\Http\Request
return Milo\Github\Http\Response

setDefaultParameters() public method

public setDefaultParameters ( array $defaults = NULL ) : self
$defaults array
return self

setToken() public method

public setToken ( Milo\Github\OAuth\Token $token = NULL ) : self
$token Milo\Github\OAuth\Token
return self

setUrl() public method

public setUrl ( $url ) : self
return self

withUrl() public method

public withUrl ( $url ) : Api
return Api