feat, refac: 메시지 삭제

This commit is contained in:
2022-12-05 01:40:12 +09:00
parent 4f21eab7b1
commit 83f233cc99
2 changed files with 43 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\Message;
use sammo\Validator;
use function sammo\getMailboxList;
class DeleteMessage extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', ['msgID']);
$v->rule('integer', 'msgID');
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['msgID'] = (int)($this->args['msgID'] ?? -1);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$msgID = $this->args['msgID'];
$generalID = $session->generalID;
return Message::deleteMsg($msgID, $generalID);
}
}
+3
View File
@@ -172,6 +172,9 @@ const apiRealPath = {
}, InheritLogResponse>
},
Message: {
DeleteMessage: PATCH as APICallT<{
msgID: number,
}>,
GetContactList: GET as APICallT<undefined, MabilboxListResponse>,
GetRecentMessage: GET as APICallT<{
sequence?: number;