mirror of
https://github.com/opdavies/glassboxx-sdk-php.git
synced 2025-02-17 22:50:48 +00:00
Re-organise the src and tests directories
This commit is contained in:
parent
ae766763b2
commit
b238e6655a
26 changed files with 13 additions and 13 deletions
30
src/Request/AuthTokenRequest.php
Normal file
30
src/Request/AuthTokenRequest.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Opdavies\Glassboxx\Request;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
final class AuthTokenRequest extends AbstractRequest implements AuthTokenRequestInterface
|
||||
{
|
||||
public function getToken(): string
|
||||
{
|
||||
if (!$this->config) {
|
||||
throw new RuntimeException('There is no config');
|
||||
}
|
||||
|
||||
$response = $this->client->request(
|
||||
'POST',
|
||||
self::ENDPOINT,
|
||||
[
|
||||
'query' => [
|
||||
'password' => $this->config->getPassword(),
|
||||
'username' => $this->config->getUsername(),
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
return json_decode($response->getContent());
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue