43 lines
986 B
PHP
Raw Normal View History

2024-12-20 23:45:55 +01:00
<?php
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Exceptions\BaseException;
use GuzzleHttp\Exception\GuzzleException;
2024-12-21 19:25:33 +01:00
use GuzzleHttp\RequestOptions;
2024-12-20 23:45:55 +01:00
class Account extends Model
{
/**
* @throws BaseException|GuzzleException
*/
public function login(): array
{
$response = $this->connection->request(
'POST',
'account/login',
[
2024-12-21 19:25:33 +01:00
RequestOptions::FORM_PARAMS => [
2024-12-20 23:45:55 +01:00
'username' => $this->connection->getClientKey(),
'password' => $this->connection->getSecretKey()
]
]
);
return $this->connection->parseResponse($response);
}
/**
* @throws BaseException|GuzzleException
*/
public function logout(): bool
{
$response = $this->connection->requestAndParse(
'POST',
2024-12-21 19:25:33 +01:00
'account/logout'
2024-12-20 23:45:55 +01:00
);
return (bool) current($response);
}
}