|
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.list |
|
18
|
|
|
*/ |
|
19
|
|
|
class FilesListPayload extends AbstractPayload |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $user; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var \DateTime |
|
28
|
|
|
*/ |
|
29
|
|
|
private $tsFrom; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var \DateTime |
|
33
|
|
|
*/ |
|
34
|
|
|
private $tsTo; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var int |
|
38
|
|
|
*/ |
|
39
|
|
|
private $count; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var int |
|
43
|
|
|
*/ |
|
44
|
|
|
private $page; |
|
45
|
|
|
|
|
46
|
|
|
/** |
|
47
|
|
|
* @var array |
|
48
|
|
|
*/ |
|
49
|
|
|
private $types = ['all']; |
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* Filter files created by a single user. |
|
53
|
|
|
* |
|
54
|
|
|
* @param string $userId |
|
55
|
|
|
*/ |
|
56
|
1 |
|
public function setUserId($userId) |
|
57
|
|
|
{ |
|
58
|
1 |
|
$this->user = $userId; |
|
59
|
1 |
|
} |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* @return string |
|
63
|
|
|
*/ |
|
64
|
1 |
|
public function getUserId() |
|
65
|
|
|
{ |
|
66
|
1 |
|
return $this->user; |
|
67
|
|
|
} |
|
68
|
|
|
|
|
69
|
|
|
/** |
|
70
|
|
|
* Filter files created after this timestamp (inclusive). |
|
71
|
|
|
* |
|
72
|
|
|
* @param \DateTime|null $timestampFrom |
|
73
|
|
|
*/ |
|
74
|
1 |
|
public function setTimestampFrom(\DateTime $timestampFrom = null) |
|
75
|
|
|
{ |
|
76
|
1 |
|
$this->tsFrom = $timestampFrom; |
|
77
|
1 |
|
} |
|
78
|
|
|
|
|
79
|
|
|
/** |
|
80
|
|
|
* @return \DateTime|null |
|
81
|
|
|
*/ |
|
82
|
1 |
|
public function getTimestampFrom() |
|
83
|
|
|
{ |
|
84
|
1 |
|
return $this->tsFrom; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* Filter files created before this timestamp (inclusive). |
|
89
|
|
|
* |
|
90
|
|
|
* @param \DateTime|null $timestampTo |
|
91
|
|
|
*/ |
|
92
|
1 |
|
public function setTimestampTo(\DateTime $timestampTo = null) |
|
93
|
|
|
{ |
|
94
|
1 |
|
$this->tsTo = $timestampTo; |
|
95
|
1 |
|
} |
|
96
|
|
|
|
|
97
|
|
|
/** |
|
98
|
|
|
* @return \DateTime|null |
|
99
|
|
|
*/ |
|
100
|
1 |
|
public function getTimestampTo() |
|
101
|
|
|
{ |
|
102
|
1 |
|
return $this->tsTo; |
|
103
|
|
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @param int $count Number of items to return per page. |
|
107
|
|
|
*/ |
|
108
|
1 |
|
public function setCount($count) |
|
109
|
|
|
{ |
|
110
|
1 |
|
$this->count = $count; |
|
111
|
1 |
|
} |
|
112
|
|
|
|
|
113
|
|
|
/** |
|
114
|
|
|
* @return int|null Number of items to return per page. |
|
115
|
|
|
*/ |
|
116
|
1 |
|
public function getCount() |
|
117
|
|
|
{ |
|
118
|
1 |
|
return $this->count; |
|
119
|
|
|
} |
|
120
|
|
|
|
|
121
|
|
|
/** |
|
122
|
|
|
* @param int $page Page number of results to return. |
|
123
|
|
|
*/ |
|
124
|
1 |
|
public function setPage($page) |
|
125
|
|
|
{ |
|
126
|
1 |
|
$this->page = $page; |
|
127
|
1 |
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* @return int|null Page number of results to return. |
|
131
|
|
|
*/ |
|
132
|
1 |
|
public function getPage() |
|
133
|
|
|
{ |
|
134
|
1 |
|
return $this->page; |
|
135
|
|
|
} |
|
136
|
|
|
|
|
137
|
|
|
/** |
|
138
|
|
|
* Filter files by type:. |
|
139
|
|
|
* |
|
140
|
|
|
* all - All files |
|
141
|
|
|
* posts - Posts |
|
142
|
|
|
* snippets - Snippets |
|
143
|
|
|
* images - Image files |
|
144
|
|
|
* gdocs - Google docs |
|
145
|
|
|
* zips - Zip files |
|
146
|
|
|
* pdfs - PDF files |
|
147
|
|
|
* |
|
148
|
|
|
* The default value is all, which does not filter the list. |
|
149
|
|
|
* |
|
150
|
|
|
* @param array $types |
|
151
|
|
|
*/ |
|
152
|
1 |
|
public function setTypes(array $types) |
|
153
|
|
|
{ |
|
154
|
1 |
|
$this->types = $types; |
|
155
|
1 |
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* @return array |
|
159
|
|
|
*/ |
|
160
|
1 |
|
public function getTypes() |
|
161
|
|
|
{ |
|
162
|
1 |
|
return $this->types; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* @param string $types |
|
167
|
|
|
*/ |
|
168
|
|
|
public function setTypesFromString($types) |
|
169
|
|
|
{ |
|
170
|
|
|
$this->types = explode(',', $types); |
|
171
|
|
|
} |
|
172
|
|
|
|
|
173
|
|
|
/** |
|
174
|
|
|
* @return string |
|
175
|
|
|
*/ |
|
176
|
|
|
public function getTypesAsString() |
|
177
|
|
|
{ |
|
178
|
|
|
return implode(',', $this->types); |
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
/** |
|
182
|
|
|
* @inheritdoc |
|
183
|
|
|
*/ |
|
184
|
1 |
|
public function getMethod() |
|
185
|
|
|
{ |
|
186
|
1 |
|
return 'files.list'; |
|
187
|
|
|
} |
|
188
|
|
|
} |
|
189
|
|
|
|