Source for file account.php
Documentation is available at account.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* GitHub API Account class for the Joomla Platform.
* @package Joomla.Platform
* Method to create an authorisation.
* @param array $scopes A list of scopes that this authorisation is in.
* @param string $note A note to remind you what the OAuth token is for.
* @param string $url A URL to remind you what app the OAuth token is for.
* @throws DomainException
// Build the request path.
$path =
'/authorizations';
array('scopes' =>
$scopes, 'note' =>
$note, 'note_url' =>
$url)
// Validate the response code.
if ($response->code !=
201)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to delete an authorisation
* @param integer $id ID of the authorisation to delete
* @throws DomainException
// Build the request path.
$path =
'/authorizations/' .
$id;
// Validate the response code.
if ($response->code !=
204)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to edit an authorisation.
* @param integer $id ID of the authorisation to edit
* @param array $scopes Replaces the authorisation scopes with these.
* @param array $addScopes A list of scopes to add to this authorisation.
* @param array $removeScopes A list of scopes to remove from this authorisation.
* @param string $note A note to remind you what the OAuth token is for.
* @param string $url A URL to remind you what app the OAuth token is for.
* @throws DomainException
* @throws RuntimeException
public function editAuthorisation($id, array $scopes =
array(), array $addScopes =
array(), array $removeScopes =
array(), $note =
'', $url =
'')
// Check if more than one scopes array contains data
if (!empty($removeScopes))
$scope =
'remove_scopes';
$scopeData =
$removeScopes;
// Only allowed to send data for one scope parameter
throw
new RuntimeException('You can only send one scope key in this request.');
// Build the request path.
$path =
'/authorizations/' .
$id;
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get details about an authorised application for the authenticated user.
* @param integer $id ID of the authorisation to retrieve
* @note This method will only accept Basic Authentication
* @throws DomainException
// Build the request path.
$path =
'/authorizations/' .
$id;
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get the authorised applications for the authenticated user.
* @throws DomainException
* @note This method will only accept Basic Authentication
// Build the request path.
$path =
'/authorizations';
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
* Method to get the rate limit for the authenticated user.
* @throws DomainException
// Build the request path.
// Validate the response code.
if ($response->code !=
200)
// Decode the error response and throw an exception.
throw
new DomainException($error->message, $response->code);
Documentation generated on Tue, 19 Nov 2013 14:53:18 +0100 by phpDocumentor 1.4.3