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
|
|
|
|
13
|
|
|
use Directus\SDK\Response\Entry; |
14
|
|
|
use Directus\SDK\Response\EntryCollection; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* Requests Interface |
18
|
|
|
* |
19
|
|
|
* @author Welling Guzmán <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
interface RequestsInterface |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Gets list of all tables |
25
|
|
|
* |
26
|
|
|
* @param array $params |
27
|
|
|
* |
28
|
|
|
* @return EntryCollection |
29
|
|
|
*/ |
30
|
|
|
public function getTables(array $params = []); |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Gets the details of the given table |
34
|
|
|
* |
35
|
|
|
* @param $tableName |
36
|
|
|
* |
37
|
|
|
* @return Entry |
38
|
|
|
*/ |
39
|
|
|
public function getTable($tableName); |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Gets columns of a given table |
43
|
|
|
* |
44
|
|
|
* @param $tableName |
45
|
|
|
* @param $params |
46
|
|
|
* |
47
|
|
|
* @return EntryCollection |
48
|
|
|
*/ |
49
|
|
|
public function getColumns($tableName, array $params = []); |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Gets the details of a given table's column |
53
|
|
|
* |
54
|
|
|
* @param $tableName |
55
|
|
|
* @param $columnName |
56
|
|
|
* |
57
|
|
|
* @return Entry |
58
|
|
|
*/ |
59
|
|
|
public function getColumn($tableName, $columnName); |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Fetch Items from a given table |
63
|
|
|
* |
64
|
|
|
* @param string $tableName |
65
|
|
|
* @param array $options |
66
|
|
|
* |
67
|
|
|
* @return EntryCollection |
68
|
|
|
*/ |
69
|
|
|
public function getEntries($tableName, array $options = []); |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get an entry in a given table by the given ID |
73
|
|
|
* |
74
|
|
|
* @param mixed $id |
75
|
|
|
* @param string $tableName |
76
|
|
|
* @param array $options |
77
|
|
|
* |
78
|
|
|
* @return Entry |
79
|
|
|
*/ |
80
|
|
|
public function getEntry($tableName, $id, array $options = []); |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Gets the list of users |
84
|
|
|
* |
85
|
|
|
* @param array $params |
86
|
|
|
* |
87
|
|
|
* @return EntryCollection |
88
|
|
|
*/ |
89
|
|
|
public function getUsers(array $params = []); |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Gets a user by the given id |
93
|
|
|
* |
94
|
|
|
* @param $id |
95
|
|
|
* @param array $params |
96
|
|
|
* |
97
|
|
|
* @return Entry |
98
|
|
|
*/ |
99
|
|
|
public function getUser($id, array $params = []); |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Gets a list of User groups |
103
|
|
|
* |
104
|
|
|
* @return EntryCollection |
105
|
|
|
*/ |
106
|
|
|
public function getGroups(); |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Gets the information of a given user group |
110
|
|
|
* |
111
|
|
|
* @param $groupID |
112
|
|
|
* |
113
|
|
|
* @return Entry |
114
|
|
|
*/ |
115
|
|
|
public function getGroup($groupID); |
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* Get a given group privileges |
119
|
|
|
* |
120
|
|
|
* @param $groupID |
121
|
|
|
* |
122
|
|
|
* @return EntryCollection |
123
|
|
|
*/ |
124
|
|
|
public function getGroupPrivileges($groupID); |
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Gets a list fo files |
128
|
|
|
* |
129
|
|
|
* @return EntryCollection |
130
|
|
|
*/ |
131
|
|
|
public function getFiles(); |
132
|
|
|
|
133
|
|
|
/** |
134
|
|
|
* Gets the information of a given file ID |
135
|
|
|
* |
136
|
|
|
* @param $fileID |
137
|
|
|
* |
138
|
|
|
* @return Entry |
139
|
|
|
*/ |
140
|
|
|
public function getFile($fileID); |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* Gets all settings |
144
|
|
|
* |
145
|
|
|
* @return object |
146
|
|
|
*/ |
147
|
|
|
public function getSettings(); |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Gets all settings in a given collection name |
151
|
|
|
* |
152
|
|
|
* @param $collectionName |
153
|
|
|
* |
154
|
|
|
* @return EntryCollection |
155
|
|
|
*/ |
156
|
|
|
public function getSettingsByCollection($collectionName); |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Gets all messages from the given user ID |
160
|
|
|
* |
161
|
|
|
* @param $userId |
162
|
|
|
* |
163
|
|
|
* @return EntryCollection |
164
|
|
|
*/ |
165
|
|
|
public function getMessages($userId); |
166
|
|
|
|
167
|
|
|
/** |
168
|
|
|
* Create a new entry in the given table name |
169
|
|
|
* |
170
|
|
|
* @param $tableName |
171
|
|
|
* @param array $data |
172
|
|
|
* |
173
|
|
|
* @return Entry |
174
|
|
|
*/ |
175
|
|
|
public function createEntry($tableName, array $data); |
176
|
|
|
|
177
|
|
|
/** |
178
|
|
|
* Update the entry of the given table and id |
179
|
|
|
* |
180
|
|
|
* @param $tableName |
181
|
|
|
* @param $id |
182
|
|
|
* @param array $data |
183
|
|
|
* |
184
|
|
|
* @return mixed |
185
|
|
|
*/ |
186
|
|
|
public function updateEntry($tableName, $id, array $data); |
187
|
|
|
|
188
|
|
|
/** |
189
|
|
|
* Deletes the given entry id(s) |
190
|
|
|
* |
191
|
|
|
* @param $tableName |
192
|
|
|
* @param string|array|Entry|EntryCollection $ids |
193
|
|
|
* |
194
|
|
|
* @return int |
195
|
|
|
*/ |
196
|
|
|
public function deleteEntry($tableName, $ids); |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Creates a new user |
200
|
|
|
* |
201
|
|
|
* @param array $data |
202
|
|
|
* |
203
|
|
|
* @return Entry |
204
|
|
|
*/ |
205
|
|
|
public function createUser(array $data); |
206
|
|
|
|
207
|
|
|
/** |
208
|
|
|
* Updates the given user id |
209
|
|
|
* |
210
|
|
|
* @param $id |
211
|
|
|
* @param array $data |
212
|
|
|
* |
213
|
|
|
* @return mixed |
214
|
|
|
*/ |
215
|
|
|
public function updateUser($id, array $data); |
216
|
|
|
|
217
|
|
|
/** |
218
|
|
|
* Deletes the given user id(s) |
219
|
|
|
* |
220
|
|
|
* @param string|array|Entry|EntryCollection $ids |
221
|
|
|
* |
222
|
|
|
* @return int |
223
|
|
|
*/ |
224
|
|
|
public function deleteUser($ids); |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Creates a new file |
228
|
|
|
* |
229
|
|
|
* @param File $file |
230
|
|
|
* |
231
|
|
|
* @return Entry |
232
|
|
|
*/ |
233
|
|
|
public function createFile(File $file); |
234
|
|
|
|
235
|
|
|
/** |
236
|
|
|
* Updates the given file id |
237
|
|
|
* |
238
|
|
|
* @param $id |
239
|
|
|
* @param array|File $data |
240
|
|
|
* |
241
|
|
|
* @return mixed |
242
|
|
|
*/ |
243
|
|
|
public function updateFile($id, $data); |
244
|
|
|
|
245
|
|
|
/** |
246
|
|
|
* Deletes the given file id(s) |
247
|
|
|
* |
248
|
|
|
* @param string|array|Entry|EntryCollection $ids |
249
|
|
|
* |
250
|
|
|
* @return int |
251
|
|
|
*/ |
252
|
|
|
public function deleteFile($ids); |
253
|
|
|
|
254
|
|
|
/** |
255
|
|
|
* Creates a new Bookmark |
256
|
|
|
* |
257
|
|
|
* @param $data |
258
|
|
|
* |
259
|
|
|
* @return Entry |
260
|
|
|
*/ |
261
|
|
|
public function createBookmark($data); |
262
|
|
|
|
263
|
|
|
/** |
264
|
|
|
* Creates a new Table preferences |
265
|
|
|
* |
266
|
|
|
* @param $data |
267
|
|
|
* |
268
|
|
|
* @return Entry |
269
|
|
|
*/ |
270
|
|
|
public function createPreferences($data); |
271
|
|
|
|
272
|
|
|
/** |
273
|
|
|
* Creates a new Column |
274
|
|
|
* |
275
|
|
|
* @param $data |
276
|
|
|
* |
277
|
|
|
* @return Entry |
278
|
|
|
*/ |
279
|
|
|
public function createColumn($data); |
280
|
|
|
|
281
|
|
|
/** |
282
|
|
|
* Creates a new group |
283
|
|
|
* |
284
|
|
|
* @param $data |
285
|
|
|
* |
286
|
|
|
* @return Entry |
287
|
|
|
*/ |
288
|
|
|
public function createGroup(array $data); |
289
|
|
|
|
290
|
|
|
/** |
291
|
|
|
* Creates new message |
292
|
|
|
* |
293
|
|
|
* @param array $data |
294
|
|
|
* |
295
|
|
|
* @return Entry |
296
|
|
|
*/ |
297
|
|
|
public function createMessage(array $data); |
298
|
|
|
|
299
|
|
|
/** |
300
|
|
|
* Sends a new message |
301
|
|
|
* |
302
|
|
|
* Alias of createMessage |
303
|
|
|
* |
304
|
|
|
* @param array $data |
305
|
|
|
* |
306
|
|
|
* @return Entry |
307
|
|
|
*/ |
308
|
|
|
public function sendMessage(array $data); |
309
|
|
|
|
310
|
|
|
/** |
311
|
|
|
* Creates a new privileges/permissions |
312
|
|
|
* |
313
|
|
|
* @param array $data |
314
|
|
|
* |
315
|
|
|
* @return Entry |
316
|
|
|
*/ |
317
|
|
|
public function createPrivileges(array $data); |
318
|
|
|
|
319
|
|
|
/** |
320
|
|
|
* Creates |
321
|
|
|
* |
322
|
|
|
* @param $name |
323
|
|
|
* @param array $data |
324
|
|
|
* |
325
|
|
|
* @return Entry |
326
|
|
|
*/ |
327
|
|
|
public function createTable($name, array $data = []); |
328
|
|
|
|
329
|
|
|
/** |
330
|
|
|
* Creates/Updates column ui options |
331
|
|
|
* |
332
|
|
|
* @param array $data |
333
|
|
|
* |
334
|
|
|
* @return Entry |
335
|
|
|
*/ |
336
|
|
|
public function createColumnUIOptions(array $data); |
337
|
|
|
|
338
|
|
|
/** |
339
|
|
|
* Gets preferences |
340
|
|
|
* |
341
|
|
|
* @param $table |
342
|
|
|
* @param $user |
343
|
|
|
* |
344
|
|
|
* @return Entry |
345
|
|
|
*/ |
346
|
|
|
public function getPreferences($table, $user); |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* Deletes a bookmark |
350
|
|
|
* |
351
|
|
|
* @param $id |
352
|
|
|
* |
353
|
|
|
* @return Entry |
354
|
|
|
*/ |
355
|
|
|
public function deleteBookmark($id); |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Deletes a column |
359
|
|
|
* |
360
|
|
|
* @param $name |
361
|
|
|
* @param $table |
362
|
|
|
* |
363
|
|
|
* @return Entry |
364
|
|
|
*/ |
365
|
|
|
public function deleteColumn($name, $table); |
366
|
|
|
|
367
|
|
|
/** |
368
|
|
|
* Deletes a group |
369
|
|
|
* |
370
|
|
|
* @param $id |
371
|
|
|
* |
372
|
|
|
* @return Entry |
373
|
|
|
*/ |
374
|
|
|
public function deleteGroup($id); |
375
|
|
|
|
376
|
|
|
/** |
377
|
|
|
* Deletes a table |
378
|
|
|
* |
379
|
|
|
* @param $name |
380
|
|
|
* |
381
|
|
|
* @return Entry |
382
|
|
|
*/ |
383
|
|
|
public function deleteTable($name); |
384
|
|
|
} |
385
|
|
|
|