mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-11-28 19:19:52 +09:00
Update to laravel 7
This commit is contained in:
@@ -12,111 +12,54 @@ namespace Github\Api;
|
||||
class Authorizations extends AbstractApi
|
||||
{
|
||||
/**
|
||||
* List all authorizations.
|
||||
* Check an application token.
|
||||
*
|
||||
* @param string $clientId
|
||||
* @param string|null $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all()
|
||||
public function checkToken($clientId, $token = null)
|
||||
{
|
||||
return $this->get('/authorizations');
|
||||
return $this->post('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show a single authorization.
|
||||
* Reset an application token.
|
||||
*
|
||||
* @param string $clientId
|
||||
* @param string $clientId
|
||||
* @param string|null $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function show($clientId)
|
||||
public function resetToken($clientId, $token = null)
|
||||
{
|
||||
return $this->get('/authorizations/'.rawurlencode($clientId));
|
||||
return $this->patch('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an authorization.
|
||||
* Revoke an application token.
|
||||
*
|
||||
* @param array $params
|
||||
* @param null $OTPCode
|
||||
* @param string $clientId
|
||||
* @param string|null $token
|
||||
*
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function create(array $params, $OTPCode = null)
|
||||
public function deleteToken($clientId, $token = null)
|
||||
{
|
||||
$headers = null === $OTPCode ? [] : ['X-GitHub-OTP' => $OTPCode];
|
||||
|
||||
return $this->post('/authorizations', $params, $headers);
|
||||
$this->delete('/applications/'.rawurlencode($clientId).'/token', $token ? ['access_token' => $token] : []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an authorization.
|
||||
* Revoke an application authorization.
|
||||
*
|
||||
* @param string $clientId
|
||||
* @param array $params
|
||||
* @param string $clientId
|
||||
* @param string|null $token
|
||||
*
|
||||
* @return array
|
||||
* @return void
|
||||
*/
|
||||
public function update($clientId, array $params)
|
||||
public function deleteGrant($clientId, $token = null)
|
||||
{
|
||||
return $this->patch('/authorizations/'.rawurlencode($clientId), $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an authorization.
|
||||
*
|
||||
* @param string $clientId
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function remove($clientId)
|
||||
{
|
||||
return $this->delete('/authorizations/'.rawurlencode($clientId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check an authorization.
|
||||
*
|
||||
* @param string $clientId
|
||||
* @param string $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function check($clientId, $token)
|
||||
{
|
||||
return $this->get('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset an authorization.
|
||||
*
|
||||
* @param string $clientId
|
||||
* @param string $token
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function reset($clientId, $token)
|
||||
{
|
||||
return $this->post('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an authorization.
|
||||
*
|
||||
* @param string $clientId
|
||||
* @param string $token
|
||||
*/
|
||||
public function revoke($clientId, $token)
|
||||
{
|
||||
$this->delete('/applications/'.rawurlencode($clientId).'/tokens/'.rawurlencode($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke all authorizations.
|
||||
*
|
||||
* @param string $clientId
|
||||
*/
|
||||
public function revokeAll($clientId)
|
||||
{
|
||||
$this->delete('/applications/'.rawurlencode($clientId).'/tokens');
|
||||
$this->delete('/applications/'.rawurlencode($clientId).'/grant', $token ? ['access_token' => $token] : []);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user