|
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/files.upload |
|
18
|
|
|
*/ |
|
19
|
|
|
class FilesUploadPayload extends AbstractPayload |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $file; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var string|null |
|
28
|
|
|
*/ |
|
29
|
|
|
private $fileType; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string|null |
|
33
|
|
|
*/ |
|
34
|
|
|
private $filename; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string|null |
|
38
|
|
|
*/ |
|
39
|
|
|
private $title; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var string |
|
43
|
|
|
*/ |
|
44
|
|
|
private $content; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var array |
|
48
|
|
|
*/ |
|
49
|
|
|
private $channels = []; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* @var string |
|
53
|
|
|
*/ |
|
54
|
|
|
private $initialComment; |
|
55
|
|
|
|
|
56
|
|
|
/** |
|
57
|
|
|
* @param string $file |
|
58
|
|
|
*/ |
|
59
|
|
|
public function setFile($file) |
|
60
|
|
|
{ |
|
61
|
|
|
$this->file = $file; |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/** |
|
65
|
|
|
* @return string |
|
66
|
|
|
*/ |
|
67
|
|
|
public function getFile() |
|
68
|
|
|
{ |
|
69
|
|
|
return $this->file; |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
/** |
|
73
|
|
|
* @param string|null $filename |
|
74
|
|
|
*/ |
|
75
|
1 |
|
public function setFilename($filename) |
|
76
|
|
|
{ |
|
77
|
1 |
|
$this->filename = $filename; |
|
78
|
1 |
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* @return string|null |
|
82
|
|
|
*/ |
|
83
|
1 |
|
public function getFilename() |
|
84
|
|
|
{ |
|
85
|
1 |
|
return $this->filename; |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* @param string|null $fileType |
|
90
|
|
|
*/ |
|
91
|
1 |
|
public function setFileType($fileType) |
|
92
|
|
|
{ |
|
93
|
1 |
|
$this->fileType = $fileType; |
|
94
|
1 |
|
} |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @return string|null |
|
98
|
|
|
*/ |
|
99
|
1 |
|
public function getFileType() |
|
100
|
|
|
{ |
|
101
|
1 |
|
return $this->fileType; |
|
102
|
|
|
} |
|
103
|
|
|
|
|
104
|
|
|
/** |
|
105
|
|
|
* @param string|null $title |
|
106
|
|
|
*/ |
|
107
|
1 |
|
public function setTitle($title) |
|
108
|
|
|
{ |
|
109
|
1 |
|
$this->title = $title; |
|
110
|
1 |
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* @return string|null |
|
114
|
|
|
*/ |
|
115
|
1 |
|
public function getTitle() |
|
116
|
|
|
{ |
|
117
|
1 |
|
return $this->title; |
|
118
|
|
|
} |
|
119
|
|
|
|
|
120
|
|
|
/** |
|
121
|
|
|
* @param string $content |
|
122
|
|
|
*/ |
|
123
|
1 |
|
public function setContent($content) |
|
124
|
|
|
{ |
|
125
|
1 |
|
$this->content = $content; |
|
126
|
1 |
|
} |
|
127
|
|
|
|
|
128
|
|
|
/** |
|
129
|
|
|
* @return string|null |
|
130
|
|
|
*/ |
|
131
|
1 |
|
public function getContent() |
|
132
|
|
|
{ |
|
133
|
1 |
|
return $this->content; |
|
134
|
|
|
} |
|
135
|
|
|
|
|
136
|
|
|
/** |
|
137
|
|
|
* @param array $channels |
|
138
|
|
|
*/ |
|
139
|
1 |
|
public function setChannels(array $channels) |
|
140
|
|
|
{ |
|
141
|
1 |
|
$this->channels = $channels; |
|
142
|
1 |
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @param string $channel |
|
146
|
|
|
*/ |
|
147
|
|
|
public function addChannel($channel) |
|
148
|
|
|
{ |
|
149
|
|
|
$this->channels[] = $channel; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return array |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getChannels() |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->channels; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @param string $channels |
|
162
|
|
|
*/ |
|
163
|
|
|
public function setChannelsFromString($channels) |
|
164
|
|
|
{ |
|
165
|
|
|
$this->channels = explode(',', $channels); |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @return string |
|
170
|
|
|
*/ |
|
171
|
1 |
|
public function getChannelsAsString() |
|
172
|
|
|
{ |
|
173
|
1 |
|
return implode(',', $this->channels); |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @param string $initialComment |
|
178
|
|
|
*/ |
|
179
|
|
|
public function setInitialComment($initialComment) |
|
180
|
|
|
{ |
|
181
|
|
|
$this->initialComment = $initialComment; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return string |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getInitialComment() |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->initialComment; |
|
190
|
|
|
} |
|
191
|
|
|
|
|
192
|
|
|
/** |
|
193
|
|
|
* @inheritdoc |
|
194
|
|
|
*/ |
|
195
|
1 |
|
public function getMethod() |
|
196
|
|
|
{ |
|
197
|
1 |
|
return 'files.upload'; |
|
198
|
|
|
} |
|
199
|
|
|
} |
|
200
|
|
|
|