Authorization
Extends \Joomla\Github\AbstractPackageGitHub API Authorization class for the Joomla Framework.
documentation | |
---|---|
note |
The methods in this class are only accessible with Basic Authentication |
since |
1.0 |
Methods
__construct
Constructor.
__construct(\Joomla\Registry\Registry $options = null, \Joomla\Http\Http $client = null)
since |
1.0 |
---|
Arguments
- $options
\Joomla\Registry\Registry
GitHub options object.- $client
\Joomla\Http\Http
The HTTP client object.
__get
Magic method to lazily create API objects
__get(string $name) : \Joomla\Github\AbstractPackage
since |
1.0 |
---|---|
throws |
|
Arguments
- $name
string
Name of property to retrieve
Response
\Joomla\Github\AbstractPackage
GitHub API package object.
create
Method to create an authorization.
create(array $scopes = array(), string $note = '', string $url = '') : object
since |
1.0 |
---|---|
throws |
|
Arguments
- $scopes
array
A list of scopes that this authorization is in.- $note
string
A note to remind you what the OAuth token is for.- $url
string
A URL to remind you what app the OAuth token is for.
Response
object
delete
Method to delete an authorization
delete(integer $id) : object
since |
1.0 |
---|---|
throws |
|
Arguments
- $id
integer
ID of the authorization to delete
Response
object
deleteGrant
Delete a grant
deleteGrant(integer $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 |
|
Arguments
- $id
integer
ID of the authorization to delete
Response
object
edit
Method to edit an authorization.
edit(integer $id, array $scopes = array(), array $addScopes = array(), array $removeScopes = array(), string $note = '', string $url = '') : object
since |
1.0 |
---|---|
throws |
|
Arguments
- $id
integer
ID of the authorization to edit- $scopes
array
Replaces the authorization scopes with these.- $addScopes
array
A list of scopes to add to this authorization.- $removeScopes
array
A list of scopes to remove from this authorization.- $note
string
A note to remind you what the OAuth token is for.- $url
string
A 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, integer $page, integer $limit) : string
since |
1.0 |
---|---|
note |
As of 2.0 this method will return a Joomla\Uri\Uri object |
Arguments
- $path
string
URL to inflect- $page
integer
Page to request- $limit
integer
Number of results to return per page
Response
string
The request URL.
get
Method to get details about an authorised application for the authenticated user.
get(integer $id) : object
since |
1.0 |
---|---|
throws |
|
Arguments
- $id
integer
ID of the authorization to retrieve
Response
object
getAuthorizationLink
- Request authorization on GitHub.
getAuthorizationLink(string $clientId, string $redirectUri = '', string $scope = '', string $state = '') : string
since |
1.0 |
---|
Arguments
- $clientId
string
The client ID you received from GitHub when you registered.- $redirectUri
string
URL in your app where users will be sent after authorization.- $scope
string
Comma separated list of scopes.- $state
string
An unguessable random string. It is used to protect against cross-site request forgery attacks.
Response
string
getGrant
Get a single grant
getGrant(integer $id) : object
since |
1.5.0 |
---|---|
throws |
|
Arguments
- $id
integer
ID of the authorization to retrieve
Response
object
getList
Method to get the authorised applications for the authenticated user.
getList() : object
since |
1.0 |
---|---|
throws |
|
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 |
|
Response
object
getRateLimit
Method to get the rate limit for the authenticated user.
getRateLimit() : object
since |
1.0 |
---|---|
throws |
|
Response
object
Returns 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, integer $expectedCode = 200) : mixed
since |
1.0 |
---|---|
throws |
|
Arguments
- $response
\Joomla\Http\Response
The response.- $expectedCode
integer
The expected "good" code.
Response
mixed
requestToken
- Request the access token.
requestToken(string $clientId, string $clientSecret, string $code, string $redirectUri = '', string $format = '') : string
since |
1.0 |
---|---|
throws |
|
Arguments
- $clientId
string
The client ID you received from GitHub when you registered.- $clientSecret
string
The client secret you received from GitHub when you registered.- $code
string
The code you received as a response to Step 1.- $redirectUri
string
URL in your app where users will be sent after authorization.- $format
string
The response format (json, xml, ).
Response
string
revokeGrantForApplication
Revoke a grant for an application
revokeGrantForApplication(integer $clientId, integer $accessToken) : object
OAuth application owners can revoke a grant for their OAuth application and a specific user.
since |
1.5.0 |
---|---|
throws |
|
Arguments
- $clientId
integer
The application client ID- $accessToken
integer
The access token to revoke
Response
object
Properties
client
The HTTP client object to use in sending HTTP requests.
package
The package the object resides in
since |
1.0 |
---|
Type(s)
string
hookEvents
Array containing the allowed hook events
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