1 | <?php |
||
5 | class IntercomMessage |
||
6 | { |
||
7 | public const TYPE_EMAIL = 'email'; |
||
8 | |||
9 | public const TYPE_INAPP = 'inapp'; |
||
10 | |||
11 | public const TEMPLATE_PLAIN = 'plain'; |
||
12 | |||
13 | public const TEMPLATE_PERSONAL = 'personal'; |
||
14 | |||
15 | /** |
||
16 | * @param string $body |
||
17 | * |
||
18 | * @return IntercomMessage |
||
19 | */ |
||
20 | 7 | public static function create(?string $body = null): self |
|
24 | |||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | public $payload; |
||
29 | |||
30 | /** |
||
31 | * @param string|null $body |
||
32 | */ |
||
33 | 23 | public function __construct(?string $body = null) |
|
41 | |||
42 | /** |
||
43 | * @param string $body |
||
44 | * |
||
45 | * @return IntercomMessage |
||
46 | */ |
||
47 | 10 | public function body(string $body): self |
|
53 | |||
54 | /** |
||
55 | * @return IntercomMessage |
||
56 | */ |
||
57 | 3 | public function email(): self |
|
63 | |||
64 | /** |
||
65 | * @return IntercomMessage |
||
66 | */ |
||
67 | 23 | public function inapp(): self |
|
73 | |||
74 | /** |
||
75 | * @param string $value |
||
76 | * |
||
77 | * @return IntercomMessage |
||
78 | */ |
||
79 | 2 | public function subject(string $value): self |
|
85 | |||
86 | /** |
||
87 | * @return IntercomMessage |
||
88 | */ |
||
89 | 1 | public function plain(): self |
|
95 | |||
96 | /** |
||
97 | * @return IntercomMessage |
||
98 | */ |
||
99 | 2 | public function personal(): self |
|
105 | |||
106 | /** |
||
107 | * @param string $adminId |
||
108 | * |
||
109 | * @return IntercomMessage |
||
110 | */ |
||
111 | 8 | public function from(string $adminId): self |
|
120 | |||
121 | /** |
||
122 | * @param array $value |
||
123 | * |
||
124 | * @return IntercomMessage |
||
125 | */ |
||
126 | 2 | public function to(array $value): self |
|
132 | |||
133 | /** |
||
134 | * @param string $id |
||
135 | * |
||
136 | * @return IntercomMessage |
||
137 | */ |
||
138 | 6 | public function toUserId(string $id): self |
|
147 | |||
148 | /** |
||
149 | * @param string $email |
||
150 | * |
||
151 | * @return IntercomMessage |
||
152 | */ |
||
153 | 2 | public function toUserEmail(string $email): self |
|
162 | |||
163 | /** |
||
164 | * @param string $id |
||
165 | * |
||
166 | * @return IntercomMessage |
||
167 | */ |
||
168 | 1 | public function toContactId(string $id): self |
|
177 | |||
178 | /** |
||
179 | * @return bool |
||
180 | */ |
||
181 | 5 | public function isValid(): bool |
|
189 | |||
190 | /** |
||
191 | * @return bool |
||
192 | */ |
||
193 | 6 | public function toIsGiven(): bool |
|
197 | |||
198 | /** |
||
199 | * @return array |
||
200 | */ |
||
201 | 4 | public function toArray(): array |
|
205 | } |
||
206 |