1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Directus – <http://getdirectus.com> |
5
|
|
|
* |
6
|
|
|
* @link The canonical repository – <https://github.com/directus/directus> |
7
|
|
|
* @copyright Copyright 2006-2016 RANGER Studio, LLC – <http://rangerstudio.com> |
8
|
|
|
* @license GNU General Public License (v3) – <http://www.gnu.org/copyleft/gpl.html> |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace Directus\SDK; |
12
|
|
|
use Directus\SDK\Response\Entry; |
13
|
|
|
use Directus\SDK\Response\EntryCollection; |
14
|
|
|
|
15
|
|
|
/** |
16
|
|
|
* Requests Interface |
17
|
|
|
* |
18
|
|
|
* @author Welling Guzmán <[email protected]> |
19
|
|
|
*/ |
20
|
|
|
interface RequestsInterface |
21
|
|
|
{ |
22
|
|
|
/** |
23
|
|
|
* Gets list of all tables |
24
|
|
|
* |
25
|
|
|
* @param array $params |
26
|
|
|
* |
27
|
|
|
* @return EntryCollection |
28
|
|
|
*/ |
29
|
|
|
public function getTables(array $params = []); |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Gets the details of the given table |
33
|
|
|
* |
34
|
|
|
* @param $tableName |
35
|
|
|
* |
36
|
|
|
* @return Entry |
37
|
|
|
*/ |
38
|
|
|
public function getTable($tableName); |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Gets columns of a given table |
42
|
|
|
* |
43
|
|
|
* @param $tableName |
44
|
|
|
* @param $params |
45
|
|
|
* |
46
|
|
|
* @return EntryCollection |
47
|
|
|
*/ |
48
|
|
|
public function getColumns($tableName, array $params = []); |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Gets the details of a given table's column |
52
|
|
|
* |
53
|
|
|
* @param $tableName |
54
|
|
|
* @param $columnName |
55
|
|
|
* |
56
|
|
|
* @return Entry |
57
|
|
|
*/ |
58
|
|
|
public function getColumn($tableName, $columnName); |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* Fetch Items from a given table |
62
|
|
|
* |
63
|
|
|
* @param string $tableName |
64
|
|
|
* @param array $options |
65
|
|
|
* |
66
|
|
|
* @return EntryCollection |
67
|
|
|
*/ |
68
|
|
|
public function getEntries($tableName, array $options = []); |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* Get an entry in a given table by the given ID |
72
|
|
|
* |
73
|
|
|
* @param mixed $id |
74
|
|
|
* @param string $tableName |
75
|
|
|
* @param array $options |
76
|
|
|
* |
77
|
|
|
* @return Entry |
78
|
|
|
*/ |
79
|
|
|
public function getEntry($tableName, $id, array $options = []); |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Gets the list of users |
83
|
|
|
* |
84
|
|
|
* @param array $params |
85
|
|
|
* |
86
|
|
|
* @return EntryCollection |
87
|
|
|
*/ |
88
|
|
|
public function getUsers(array $params = []); |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Gets a user by the given id |
92
|
|
|
* |
93
|
|
|
* @param $id |
94
|
|
|
* @param array $params |
95
|
|
|
* |
96
|
|
|
* @return Entry |
97
|
|
|
*/ |
98
|
|
|
public function getUser($id, array $params = []); |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* Gets a list of User groups |
102
|
|
|
* |
103
|
|
|
* @return EntryCollection |
104
|
|
|
*/ |
105
|
|
|
public function getGroups(); |
106
|
|
|
|
107
|
|
|
/** |
108
|
|
|
* Gets the information of a given user group |
109
|
|
|
* |
110
|
|
|
* @param $groupID |
111
|
|
|
* |
112
|
|
|
* @return Entry |
113
|
|
|
*/ |
114
|
|
|
public function getGroup($groupID); |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* Get a given group privileges |
118
|
|
|
* |
119
|
|
|
* @param $groupID |
120
|
|
|
* |
121
|
|
|
* @return EntryCollection |
122
|
|
|
*/ |
123
|
|
|
public function getGroupPrivileges($groupID); |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Gets a list fo files |
127
|
|
|
* |
128
|
|
|
* @return EntryCollection |
129
|
|
|
*/ |
130
|
|
|
public function getFiles(); |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Gets the information of a given file ID |
134
|
|
|
* |
135
|
|
|
* @param $fileID |
136
|
|
|
* |
137
|
|
|
* @return Entry |
138
|
|
|
*/ |
139
|
|
|
public function getFile($fileID); |
140
|
|
|
|
141
|
|
|
/** |
142
|
|
|
* Gets all settings |
143
|
|
|
* |
144
|
|
|
* @return object |
145
|
|
|
*/ |
146
|
|
|
public function getSettings(); |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Gets all settings in a given collection name |
150
|
|
|
* |
151
|
|
|
* @param $collectionName |
152
|
|
|
* |
153
|
|
|
* @return EntryCollection |
154
|
|
|
*/ |
155
|
|
|
public function getSettingsByCollection($collectionName); |
156
|
|
|
|
157
|
|
|
/** |
158
|
|
|
* Gets all messages from the given user ID |
159
|
|
|
* |
160
|
|
|
* @param $userId |
161
|
|
|
* |
162
|
|
|
* @return EntryCollection |
163
|
|
|
*/ |
164
|
|
|
public function getMessages($userId); |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Create a new entry in the given table name |
168
|
|
|
* |
169
|
|
|
* @param $tableName |
170
|
|
|
* @param array $data |
171
|
|
|
* |
172
|
|
|
* @return Entry |
173
|
|
|
*/ |
174
|
|
|
public function createEntry($tableName, array $data); |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Update the entry of the given table and id |
178
|
|
|
* |
179
|
|
|
* @param $tableName |
180
|
|
|
* @param $id |
181
|
|
|
* @param array $data |
182
|
|
|
* |
183
|
|
|
* @return mixed |
184
|
|
|
*/ |
185
|
|
|
public function updateEntry($tableName, $id, array $data); |
186
|
|
|
|
187
|
|
|
/** |
188
|
|
|
* Deletes the given entry id(s) |
189
|
|
|
* |
190
|
|
|
* @param $tableName |
191
|
|
|
* @param string|array|Entry|EntryCollection $ids |
192
|
|
|
* |
193
|
|
|
* @return int |
194
|
|
|
*/ |
195
|
|
|
public function deleteEntry($tableName, $ids); |
196
|
|
|
|
197
|
|
|
/** |
198
|
|
|
* Creates a new user |
199
|
|
|
* |
200
|
|
|
* @param array $data |
201
|
|
|
* |
202
|
|
|
* @return Entry |
203
|
|
|
*/ |
204
|
|
|
public function createUser(array $data); |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* Updates the given user id |
208
|
|
|
* |
209
|
|
|
* @param $id |
210
|
|
|
* @param array $data |
211
|
|
|
* |
212
|
|
|
* @return mixed |
213
|
|
|
*/ |
214
|
|
|
public function updateUser($id, array $data); |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Deletes the given user id(s) |
218
|
|
|
* |
219
|
|
|
* @param string|array|Entry|EntryCollection $ids |
220
|
|
|
* |
221
|
|
|
* @return int |
222
|
|
|
*/ |
223
|
|
|
public function deleteUser($ids); |
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* Creates a new file |
227
|
|
|
* |
228
|
|
|
* @param array $data |
229
|
|
|
* |
230
|
|
|
* @return Entry |
231
|
|
|
*/ |
232
|
|
|
public function createFile(array $data); |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Updates the given file id |
236
|
|
|
* |
237
|
|
|
* @param $id |
238
|
|
|
* @param array $data |
239
|
|
|
* |
240
|
|
|
* @return mixed |
241
|
|
|
*/ |
242
|
|
|
public function updateFile($id, array $data); |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Deletes the given file id(s) |
246
|
|
|
* |
247
|
|
|
* @param string|array|Entry|EntryCollection $ids |
248
|
|
|
* |
249
|
|
|
* @return int |
250
|
|
|
*/ |
251
|
|
|
public function deleteFile($ids); |
252
|
|
|
} |
253
|
|
|
|