feat: 연감을 가져오는 API

- Global/GetHistory - 과거 기록. 캐싱 가능
- GetCurrentHistory - 현재 기록. 캐싱 불가
This commit is contained in:
2022-04-18 03:05:08 +09:00
parent 4653725564
commit 6d20257cf1
7 changed files with 289 additions and 23 deletions
@@ -0,0 +1,31 @@
<?php
namespace sammo\API\Global;
use sammo\Session;
use DateTimeInterface;
use function sammo\getCurrentHistory;
class GetCurrentHistory extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$history = getCurrentHistory();
return [
'result' => true,
'data' => $history,
];
}
}