Repository navigation
Expand file tree
/
Copy pathAddActivityRequest.php
More file actions
52 lines (47 loc) · 1.62 KB
/
Copy pathAddActivityRequest.php
File metadata and controls
52 lines (47 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
declare(strict_types=1);
namespace GetStream\Requests;
class AddActivityRequest implements \JsonSerializable
{
public function __construct(
public string $type,
public array $fids,
public ?string $expiresAt = null,
public ?string $id = null,
public ?string $parentId = null,
public ?string $pollId = null,
public ?string $text = null,
public ?string $userId = null,
public ?string $visibility = null,
public ?string $visibilityTag = null,
public array $attachments = [],
public array $filterTags = [],
public array $interestTags = [],
public array $mentionedUserIds = [],
public array $custom = []
) {}
public function jsonSerialize(): array
{
return array_filter([
'type' => $this->type,
'fids' => $this->fids,
'expires_at' => $this->expiresAt,
'id' => $this->id,
'parent_id' => $this->parentId,
'poll_id' => $this->pollId,
'text' => $this->text,
'user_id' => $this->userId,
'visibility' => $this->visibility,
'visibility_tag' => $this->visibilityTag,
'attachments' => $this->attachments ?: null,
'filter_tags' => $this->filterTags ?: null,
'interest_tags' => $this->interestTags ?: null,
'mentioned_user_ids' => $this->mentionedUserIds ?: null,
'custom' => $this->custom ?: null,
], static fn ($v) => $v !== null);
}
public function toArray(): array
{
return $this->jsonSerialize();
}
}