|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Slack API library. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Cas Leentfaar <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace CL\Slack\Payload; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* @author Cas Leentfaar <[email protected]> |
|
16
|
|
|
* |
|
17
|
|
|
* @link Official documentation at https://api.slack.com/methods/chat.delete |
|
18
|
|
|
*/ |
|
19
|
|
|
class ChatUpdatePayload extends AbstractPayload |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $channel; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
private $ts; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
private $text; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
private $parse; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var bool |
|
43
|
|
|
*/ |
|
44
|
|
|
private $linkNames; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @param string $channelId |
|
48
|
|
|
*/ |
|
49
|
1 |
|
public function setChannelId($channelId) |
|
50
|
|
|
{ |
|
51
|
1 |
|
$this->channel = $channelId; |
|
52
|
1 |
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return string |
|
56
|
|
|
*/ |
|
57
|
1 |
|
public function getChannelId() |
|
58
|
|
|
{ |
|
59
|
1 |
|
return $this->channel; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @param string $timestamp |
|
64
|
|
|
*/ |
|
65
|
1 |
|
public function setSlackTimestamp($timestamp) |
|
66
|
|
|
{ |
|
67
|
1 |
|
$this->ts = $timestamp; |
|
68
|
1 |
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @return string |
|
72
|
|
|
*/ |
|
73
|
1 |
|
public function getSlackTimestamp() |
|
74
|
|
|
{ |
|
75
|
1 |
|
return $this->ts; |
|
76
|
|
|
} |
|
77
|
|
|
|
|
78
|
|
|
/** |
|
79
|
|
|
* @param string $text |
|
80
|
|
|
*/ |
|
81
|
1 |
|
public function setText($text) |
|
82
|
|
|
{ |
|
83
|
1 |
|
$this->text = $text; |
|
84
|
1 |
|
} |
|
85
|
|
|
|
|
86
|
|
|
/** |
|
87
|
|
|
* @return string |
|
88
|
|
|
*/ |
|
89
|
1 |
|
public function getText() |
|
90
|
|
|
{ |
|
91
|
1 |
|
return $this->text; |
|
92
|
|
|
} |
|
93
|
|
|
|
|
94
|
|
|
/** |
|
95
|
|
|
* @deprecated Will be removed soon, use `setText()` instead |
|
96
|
|
|
* |
|
97
|
|
|
* @param string $message |
|
98
|
|
|
*/ |
|
99
|
|
|
public function setMessage($message) |
|
100
|
|
|
{ |
|
101
|
|
|
$this->setText($message); |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @deprecated Will be removed soon, use `getText()` instead |
|
106
|
|
|
* |
|
107
|
|
|
* @return string |
|
108
|
|
|
*/ |
|
109
|
|
|
public function getMessage() |
|
110
|
|
|
{ |
|
111
|
|
|
return $this->getText(); |
|
112
|
|
|
} |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* @param string $parse Change how messages are treated. |
|
116
|
|
|
* |
|
117
|
|
|
* @see https://api.slack.com/docs/formatting |
|
118
|
|
|
*/ |
|
119
|
|
|
public function setParse($parse) |
|
120
|
|
|
{ |
|
121
|
|
|
$this->parse = $parse; |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* @return string Change how messages are treated. |
|
126
|
|
|
*/ |
|
127
|
|
|
public function getParse() |
|
128
|
|
|
{ |
|
129
|
|
|
return $this->parse; |
|
130
|
|
|
} |
|
131
|
|
|
|
|
132
|
|
|
/** |
|
133
|
|
|
* @param bool $linkNames Set to true to automatically find and link channel names and usernames in the message. |
|
134
|
|
|
*/ |
|
135
|
|
|
public function setLinkNames($linkNames) |
|
136
|
|
|
{ |
|
137
|
|
|
$this->linkNames = $linkNames; |
|
138
|
|
|
} |
|
139
|
|
|
|
|
140
|
|
|
/** |
|
141
|
|
|
* @see https://api.slack.com/docs/unfurling |
|
142
|
|
|
* |
|
143
|
|
|
* @return bool|null Whether channel names and usernames in the message should be linked automatically. |
|
144
|
|
|
*/ |
|
145
|
|
|
public function getLinkNames() |
|
146
|
|
|
{ |
|
147
|
|
|
return $this->linkNames; |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
/** |
|
151
|
|
|
* @inheritdoc |
|
152
|
|
|
*/ |
|
153
|
1 |
|
public function getMethod() |
|
154
|
|
|
{ |
|
155
|
1 |
|
return 'chat.update'; |
|
156
|
|
|
} |
|
157
|
|
|
} |
|
158
|
|
|
|