Authorization

Extends AbstractPackage

GitHub API Authorization class for the Joomla Framework.

documentation

http://developer.github.com/v3/oauth/

http://developer.github.com/v3/oauth_authorizations/

note

The methods in this class are only accessible with Basic Authentication

since

1.0

package

Joomla Framework

Methods

__construct

Constructor.

__construct(\Joomla\Registry\Registry options = null, \Joomla\Http\Http client = null) : mixed
inherited
since

1.0

Arguments

options

\Joomla\Registry\RegistryGitHub options object.

client

\Joomla\Http\HttpThe HTTP client object.

Response

mixed

__get

Magic method to lazily create API objects

__get(string name) : \Joomla\Github\AbstractPackage
inherited
since

1.0

throws

\InvalidArgumentException

Arguments

name

stringName of property to retrieve

Response

\Joomla\Github\AbstractPackageGitHub API package object.

create

Method to create an authorization.

create(array scopes = [], string note = '', string url = '') : object
since

1.0

throws

\DomainException

Arguments

scopes

arrayA list of scopes that this authorization is in.

note

stringA note to remind you what the OAuth token is for.

url

stringA URL to remind you what app the OAuth token is for.

Response

object

delete

Method to delete an authorization

delete(int id) : object
since

1.0

throws

\DomainException

Arguments

id

intID of the authorization to delete

Response

object

deleteGrant

Delete a grant

deleteGrant(int id) : object

Deleting an OAuth application's grant will also delete all OAuth tokens associated with the application for your user.

since

1.5.0

throws

\DomainException

Arguments

id

intID of the authorization to delete

Response

object

edit

Method to edit an authorization.

edit(int id, array scopes = [], array addScopes = [], array removeScopes = [], string note = '', string url = '') : object
since

1.0

throws

\DomainException

\RuntimeException

Arguments

id

intID of the authorization to edit

scopes

arrayReplaces the authorization scopes with these.

addScopes

arrayA list of scopes to add to this authorization.

removeScopes

arrayA list of scopes to remove from this authorization.

note

stringA note to remind you what the OAuth token is for.

url

stringA URL to remind you what app the OAuth token is for.

Response

object

fetchUrl

Method to build and return a full request URL for the request. This method will add appropriate pagination details if necessary and also prepend the API url to have a complete URL for the request.

fetchUrl(string path, int page, int limit) : \Joomla\Uri\Uri
inherited
since

1.0

Arguments

path

stringURL to inflect

page

intPage to request

limit

intNumber of results to return per page

Response

\Joomla\Uri\Uri

get

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

get(int id) : object
since

1.0

throws

\DomainException

Arguments

id

intID of the authorization to retrieve

Response

object

getGrant

Get a single grant

getGrant(int id) : object
since

1.5.0

throws

\DomainException

Arguments

id

intID of the authorization to retrieve

Response

object

getList

Method to get the authorised applications for the authenticated user.

getList() : object
since

1.0

throws

\DomainException

Response

object

getListGrants

List your grants.

getListGrants() : object

You can use this API to list the set of OAuth applications that have been granted access to your account.

since

1.5.0

throws

\DomainException

Response

object

getRateLimit

Method to get the rate limit for the authenticated user.

getRateLimit() : object
since

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

Response

objectReturns an object with the properties of limit and remaining. If there is no limit, the limit property will be false.

processResponse

Process the response and decode it.

processResponse(\Joomla\Http\Response response, int expectedCode = 200) : mixed
inherited
since

1.0

throws

\Joomla\Http\Exception\UnexpectedResponseException

Arguments

response

\Joomla\Http\ResponseThe response.

expectedCode

intThe expected "good" code.

Response

mixed

requestToken

  1. Request the access token.
requestToken(string clientId, string clientSecret, string code, string redirectUri = '', string format = '') : string
since

1.0

throws

\UnexpectedValueException

Arguments

clientId

stringThe client ID you received from GitHub when you registered.

clientSecret

stringThe client secret you received from GitHub when you registered.

code

stringThe code you received as a response to Step 1.

redirectUri

stringURL in your app where users will be sent after authorization.

format

stringThe response format (json, xml, ).

Response

string

revokeGrantForApplication

Revoke a grant for an application

revokeGrantForApplication(int clientId, int accessToken) : object

OAuth application owners can revoke a grant for their OAuth application and a specific user.

since

1.5.0

throws

\DomainException

Arguments

clientId

intThe application client ID

accessToken

intThe access token to revoke

Response

object

Properties

options

Options for the GitHub object.

inherited
since

1.0

Type(s)

\Joomla\Registry\Registry

client

The HTTP client object to use in sending HTTP requests.

inherited
since

1.0

Type(s)

\Joomla\Http\Http

package

The package the object resides in

inherited
since

1.0

Type(s)

string

hookEvents

Array containing the allowed hook events

inherited
since

1.5.2

link
note

From 1.4.0 to 1.5.1 this was named $events, it was renamed due to naming conflicts with package subclasses

Type(s)

array