diff options
Diffstat (limited to 'matrix-specification/Requests/ClientSyncGetRequest.php')
| -rw-r--r-- | matrix-specification/Requests/ClientSyncGetRequest.php | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/matrix-specification/Requests/ClientSyncGetRequest.php b/matrix-specification/Requests/ClientSyncGetRequest.php index 2921fcf..2ab7d9e 100644 --- a/matrix-specification/Requests/ClientSyncGetRequest.php +++ b/matrix-specification/Requests/ClientSyncGetRequest.php @@ -2,7 +2,37 @@ namespace Matrix\Requests; -class ClientSyncGetRequest +use Matrix\Enums\PresenceState; + +class ClientSyncGetRequest implements RequiresAuthentication { - # TODO + public function __construct( + private ?string $filter = null, + private ?bool $fullState = null, + private ?PresenceState $setPresence = null, + private ?string $since = null, + private ?int $timeout = null, + private ?bool $useStateAfter = null, + ) + {} + + public function setDefaults(): void + { + $this->fullState ??= false; + $this->setPresence ??= PresenceState::ONLINE; + $this->timeout ??= 0; + $this->useStateAfter ??= false; + } + + public function getQueryParameters(): array + { + return array_filter([ + "filter" => $this->filter, + "full_state" => $this->fullState, + "set_presence" => $this->setPresence, + "since" => $this->since, + "timeout" => $this->timeout, + "use_state_after" => $this->useStateAfter, + ], "is_null"); + } } |
