1 | <?php |
||
23 | class ChatPostMessagePayload extends AbstractPayload implements AdvancedSerializeInterface |
||
24 | { |
||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $channel; |
||
29 | |||
30 | /** |
||
31 | * @var string |
||
32 | */ |
||
33 | private $text; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | private $username; |
||
39 | |||
40 | /** |
||
41 | * @var bool |
||
42 | */ |
||
43 | private $asUser; |
||
44 | |||
45 | /** |
||
46 | * @var string |
||
47 | */ |
||
48 | private $iconEmoji; |
||
49 | |||
50 | /** |
||
51 | * @var string |
||
52 | */ |
||
53 | private $iconUrl; |
||
54 | |||
55 | /** |
||
56 | * @var bool |
||
57 | */ |
||
58 | private $unfurlLinks; |
||
59 | |||
60 | /** |
||
61 | * @var bool |
||
62 | */ |
||
63 | private $unfurlMedia; |
||
64 | |||
65 | /** |
||
66 | * @var bool |
||
67 | */ |
||
68 | private $linkNames; |
||
69 | |||
70 | /** |
||
71 | * @var string |
||
72 | */ |
||
73 | private $parse; |
||
74 | |||
75 | /** |
||
76 | * @var Attachment[]|ArrayCollection |
||
77 | */ |
||
78 | private $attachments; |
||
79 | |||
80 | /** |
||
81 | * @var string |
||
82 | */ |
||
83 | private $attachmentsJson; |
||
84 | |||
85 | 1 | public function __construct() |
|
89 | |||
90 | /** |
||
91 | * Sets the channel to send the message to. |
||
92 | * Can be a public channel, private group, IM channel, encoded ID, or a name. |
||
93 | * |
||
94 | * @param string $channel |
||
95 | */ |
||
96 | 1 | public function setChannel($channel) |
|
100 | |||
101 | /** |
||
102 | * @return string The channel to send the message to. |
||
103 | */ |
||
104 | 1 | public function getChannel() |
|
108 | |||
109 | /** |
||
110 | * @param string $text Actual message to send. |
||
111 | * |
||
112 | * @see https://api.slack.com/docs/formatting for an explanation of formatting. |
||
113 | */ |
||
114 | 1 | public function setText($text) |
|
118 | |||
119 | /** |
||
120 | * @return string Actual message to send. |
||
121 | */ |
||
122 | 1 | public function getText() |
|
126 | |||
127 | /** |
||
128 | * @param string $message |
||
129 | * |
||
130 | * @deprecated Will be removed soon, use `setText()` instead |
||
131 | */ |
||
132 | public function setMessage($message) |
||
136 | |||
137 | /** |
||
138 | * @return string |
||
139 | * |
||
140 | * @deprecated Will be removed soon, use `getText()` instead |
||
141 | */ |
||
142 | public function getMessage() |
||
146 | |||
147 | /** |
||
148 | * @param string $username Name of bot that will send the message (can be any name you want). |
||
149 | */ |
||
150 | 1 | public function setUsername($username) |
|
154 | |||
155 | /** |
||
156 | * @return string Name of the bot that will send the message. |
||
157 | */ |
||
158 | 1 | public function getUsername() |
|
162 | |||
163 | /** |
||
164 | * @param bool $asUser Pass message as authorized user |
||
165 | */ |
||
166 | 1 | public function setAsUser($asUser) |
|
170 | |||
171 | /** |
||
172 | * @return bool Returns true if message will be sent as authorized user |
||
173 | */ |
||
174 | 1 | public function getAsUser() |
|
178 | |||
179 | /** |
||
180 | * @param string $parse Change how messages are treated. |
||
181 | * |
||
182 | * @see https://api.slack.com/docs/formatting |
||
183 | */ |
||
184 | 1 | public function setParse($parse) |
|
188 | |||
189 | /** |
||
190 | * @return string Change how messages are treated. |
||
191 | */ |
||
192 | 1 | public function getParse() |
|
196 | |||
197 | /** |
||
198 | * Sets the emoji to use as the icon for this message (overrides icon URL). |
||
199 | * |
||
200 | * You can use one of Slack's emoji's or upload your own. |
||
201 | * |
||
202 | * @see https://{YOURSLACKTEAMHERE}.slack.com/customize/emoji |
||
203 | * |
||
204 | * @param string|null $iconEmoji Emoji to use as the icon for this message (overrides icon URL). |
||
205 | */ |
||
206 | 1 | public function setIconEmoji($iconEmoji) |
|
214 | |||
215 | /** |
||
216 | * @return string|null Emoji to use as the icon for this message. |
||
217 | */ |
||
218 | 1 | public function getIconEmoji() |
|
222 | |||
223 | /** |
||
224 | * @param string|null $iconUrl URL to an image to use as the icon for this message. |
||
225 | */ |
||
226 | 1 | public function setIconUrl($iconUrl) |
|
230 | |||
231 | /** |
||
232 | * @return string|null URL to an image to use as the icon for this message. |
||
233 | */ |
||
234 | 1 | public function getIconUrl() |
|
238 | |||
239 | /** |
||
240 | * By default links to media are unfurled, but links to text content are not. |
||
241 | * For more information on the differences and how to control this, see the the unfurling documentation. |
||
242 | * |
||
243 | * @see https://api.slack.com/docs/unfurling |
||
244 | * |
||
245 | * @param bool $unfurlLinks Pass true to enable unfurling of primarily text-based content. |
||
246 | */ |
||
247 | 1 | public function setUnfurlLinks($unfurlLinks) |
|
251 | |||
252 | /** |
||
253 | * @return bool|null |
||
254 | */ |
||
255 | 1 | public function getUnfurlLinks() |
|
259 | |||
260 | /** |
||
261 | * @see https://api.slack.com/docs/unfurling |
||
262 | * |
||
263 | * @param bool $unfurlMedia Pass false to disable unfurling of media content. |
||
264 | */ |
||
265 | 1 | public function setUnfurlMedia($unfurlMedia) |
|
269 | |||
270 | /** |
||
271 | * @return bool|null |
||
272 | */ |
||
273 | 1 | public function getUnfurlMedia() |
|
277 | |||
278 | /** |
||
279 | * @param bool $linkNames Set to true to automatically find and link channel names and usernames in the message. |
||
280 | */ |
||
281 | 1 | public function setLinkNames($linkNames) |
|
285 | |||
286 | /** |
||
287 | * @see https://api.slack.com/docs/unfurling |
||
288 | * |
||
289 | * @return bool|null Whether channel names and usernames in the message should be linked automatically. |
||
290 | */ |
||
291 | 1 | public function getLinkNames() |
|
295 | |||
296 | /** |
||
297 | * @return Attachment[]|ArrayCollection |
||
298 | */ |
||
299 | 1 | public function getAttachments() |
|
303 | |||
304 | /** |
||
305 | * @param Attachment $attachment |
||
306 | */ |
||
307 | 1 | public function addAttachment(Attachment $attachment) |
|
311 | |||
312 | /** |
||
313 | * Use for serialization. |
||
314 | * |
||
315 | * @return string |
||
316 | */ |
||
317 | 1 | public function getAttachmentsJson() |
|
321 | |||
322 | /** |
||
323 | * {@inheritdoc} |
||
324 | */ |
||
325 | 1 | public function getMethod() |
|
329 | |||
330 | /** |
||
331 | * {@inheritdoc} |
||
332 | */ |
||
333 | 1 | public function beforeSerialize(Serializer $serializer) |
|
337 | } |
||
338 |