53 lines
1.2 KiB
PHP
Raw Normal View History

2024-12-20 23:45:55 +01:00
<?php
/**
* Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
2024-12-20 23:45:55 +01:00
namespace D3\KlicktippPhpClient\Resources;
use D3\KlicktippPhpClient\Exceptions\BaseException;
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
2024-12-20 23:45:55 +01:00
*/
public function login(): array
{
return $this->connection->requestAndParse(
2024-12-20 23:45:55 +01:00
'POST',
'account/login.json',
2024-12-20 23:45:55 +01:00
[
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(),
],
2024-12-20 23:45:55 +01:00
]
);
}
/**
* @throws BaseException
2024-12-20 23:45:55 +01:00
*/
public function logout(): bool
{
$response = $this->connection->requestAndParse(
'POST',
'account/logout.json'
2024-12-20 23:45:55 +01:00
);
return (bool)current($response);
2024-12-20 23:45:55 +01:00
}
}