class JGithubPackageAuthorization extends JGithubPackage

GitHub API Authorization class for the Joomla Platform.

Methods

__construct( Registry $options = null, JGithubHttp $client = null)

Constructor.

__get( string $name)

Magic method to lazily create API objects

object
create( array $scopes = array(), string $note = '', string $url = '')

Method to create an authorization.

object
delete( integer $id)

Method to delete an authorization

object
edit( integer $id, array $scopes = array(), array $addScopes = array(), array $removeScopes = array(), string $note = '', string $url = '')

Method to edit an authorization.

object
get( integer $id)

Method to get details about an authorised application for the authenticated user.

object
getList()

Method to get the authorised applications for the authenticated user.

object
getRateLimit()

Method to get the rate limit for the authenticated user.

JUri
getAuthorizationLink( string $client_id, string $redirect_uri = '', string $scope = '', string $state = '')

  1. Request authorization on GitHub.

string
requestToken( string $client_id, string $client_secret, string $code, string $redirect_uri = '', string $format = '')

  1. Request the access token.

Details

__construct( Registry $options = null, JGithubHttp $client = null)

Constructor.

Parameters

Registry $options GitHub options object.
JGithubHttp $client The HTTP client object.

JGithubPackage __get( string $name)

Magic method to lazily create API objects

Parameters

string $name Name of property to retrieve

Return Value

JGithubPackage GitHub API package object.

Exceptions

RuntimeException

object create( array $scopes = array(), string $note = '', string $url = '')

Method to create an authorization.

Parameters

array $scopes A list of scopes that this authorization is in.
string $note A note to remind you what the OAuth token is for.
string $url A URL to remind you what app the OAuth token is for.

Return Value

object

Exceptions

DomainException

object delete( integer $id)

Method to delete an authorization

Parameters

integer $id ID of the authorization to delete

Return Value

object

Exceptions

DomainException

object edit( integer $id, array $scopes = array(), array $addScopes = array(), array $removeScopes = array(), string $note = '', string $url = '')

Method to edit an authorization.

Parameters

integer $id ID of the authorization to edit
array $scopes Replaces the authorization scopes with these.
array $addScopes A list of scopes to add to this authorization.
array $removeScopes A list of scopes to remove from this authorization.
string $note A note to remind you what the OAuth token is for.
string $url A URL to remind you what app the OAuth token is for.

Return Value

object

Exceptions

RuntimeException
DomainException

object get( integer $id)

Method to get details about an authorised application for the authenticated user.

Parameters

integer $id ID of the authorization to retrieve

Return Value

object

Exceptions

DomainException

object getList()

Method to get the authorised applications for the authenticated user.

Return Value

object

Exceptions

DomainException

object getRateLimit()

Method to get the rate limit for the authenticated user.

Return Value

object

Exceptions

DomainException

  1. Request authorization on GitHub.

Parameters

string $client_id The client ID you received from GitHub when you registered.
string $redirect_uri URL in your app where users will be sent after authorization.
string $scope Comma separated list of scopes.
string $state An unguessable random string. It is used to protect against cross-site request forgery attacks.

Return Value

JUri

string requestToken( string $client_id, string $client_secret, string $code, string $redirect_uri = '', string $format = '')

  1. Request the access token.

Parameters

string $client_id The client ID you received from GitHub when you registered.
string $client_secret The client secret you received from GitHub when you registered.
string $code The code you received as a response to Step 1.
string $redirect_uri URL in your app where users will be sent after authorization.
string $format The response format (json, xml, ).

Return Value

string

Exceptions

UnexpectedValueException