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
|
|
|
/** |
14
|
|
|
* Client Remote |
15
|
|
|
* |
16
|
|
|
* @author Welling Guzmán <[email protected]> |
17
|
|
|
*/ |
18
|
|
|
class ClientRemote extends BaseClientRemote |
19
|
|
|
{ |
20
|
|
|
protected $baseEndpoint = 'http://localhost/api'; |
21
|
|
|
protected $hostedBaseEndpointFormat = 'https://%s.directus.io/api'; |
22
|
|
|
|
23
|
2 |
|
public function getTables(array $params = []) |
24
|
|
|
{ |
25
|
2 |
|
return $this->performRequest('GET', static::TABLE_LIST_ENDPOINT); |
|
|
|
|
26
|
|
|
} |
27
|
|
|
|
28
|
4 |
|
public function getTable($tableName) |
29
|
|
|
{ |
30
|
4 |
|
return $this->performRequest('GET', static::TABLE_INFORMATION_ENDPOINT, $tableName); |
|
|
|
|
31
|
|
|
} |
32
|
|
|
|
33
|
2 |
|
public function getColumns($tableName, array $params = []) |
34
|
|
|
{ |
35
|
2 |
|
return $this->performRequest('GET', static::COLUMN_LIST_ENDPOINT, $tableName); |
|
|
|
|
36
|
|
|
} |
37
|
|
|
|
38
|
2 |
|
public function getColumn($tableName, $columnName) |
39
|
|
|
{ |
40
|
2 |
|
return $this->performRequest('GET', static::COLUMN_INFORMATION_ENDPOINT, [$tableName, $columnName]); |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
2 |
|
public function getEntries($tableName, array $options = []) |
44
|
|
|
{ |
45
|
2 |
|
return $this->performRequest('GET', static::TABLE_ENTRIES_ENDPOINT, $tableName); |
|
|
|
|
46
|
|
|
} |
47
|
|
|
|
48
|
2 |
|
public function getEntry($tableName, $id, array $options = []) |
49
|
|
|
{ |
50
|
2 |
|
return $this->performRequest('GET', static::TABLE_ENTRY_ENDPOINT, [$tableName, $id]); |
|
|
|
|
51
|
|
|
} |
52
|
|
|
|
53
|
2 |
|
public function getUsers(array $params = []) |
54
|
|
|
{ |
55
|
2 |
|
return $this->getEntries('directus_users', $params); |
56
|
|
|
} |
57
|
|
|
|
58
|
2 |
|
public function getUser($id, array $params = []) |
59
|
|
|
{ |
60
|
2 |
|
return $this->getEntry($id, 'directus_users', $params); |
61
|
|
|
} |
62
|
|
|
|
63
|
2 |
|
public function getGroups() |
64
|
|
|
{ |
65
|
2 |
|
return $this->performRequest('GET', static::GROUP_LIST_ENDPOINT); |
|
|
|
|
66
|
|
|
} |
67
|
|
|
|
68
|
2 |
|
public function getGroup($groupID) |
69
|
|
|
{ |
70
|
2 |
|
return $this->performRequest('GET', static::GROUP_INFORMATION_ENDPOINT, $groupID); |
|
|
|
|
71
|
|
|
} |
72
|
|
|
|
73
|
2 |
|
public function getGroupPrivileges($groupID) |
74
|
|
|
{ |
75
|
2 |
|
return $this->performRequest('GET', static::GROUP_PRIVILEGES_ENDPOINT, $groupID); |
|
|
|
|
76
|
|
|
} |
77
|
|
|
|
78
|
2 |
|
public function getFiles() |
79
|
|
|
{ |
80
|
2 |
|
return $this->performRequest('GET', static::FILE_LIST_ENDPOINT); |
|
|
|
|
81
|
|
|
} |
82
|
|
|
|
83
|
2 |
|
public function getFile($fileID) |
84
|
|
|
{ |
85
|
2 |
|
return $this->performRequest('GET', static::FILE_INFORMATION_ENDPOINT, $fileID); |
|
|
|
|
86
|
|
|
} |
87
|
|
|
|
88
|
2 |
|
public function getSettings() |
89
|
|
|
{ |
90
|
2 |
|
return $this->performRequest('GET', static::SETTING_LIST_ENDPOINT); |
91
|
|
|
} |
92
|
|
|
|
93
|
2 |
|
public function getSettingsByCollection($collectionName) |
94
|
|
|
{ |
95
|
2 |
|
return $this->performRequest('GET', static::SETTING_COLLECTION_ENDPOINT, $collectionName); |
|
|
|
|
96
|
|
|
} |
97
|
|
|
|
98
|
2 |
|
public function getMessages($userId) |
99
|
|
|
{ |
100
|
2 |
|
return $this->performRequest('GET', static::MESSAGES_USER_ENDPOINT, $userId); |
|
|
|
|
101
|
|
|
} |
102
|
|
|
|
103
|
2 |
|
public function createEntry($tableName, array $data) |
104
|
|
|
{ |
105
|
|
|
return $this->performRequest('POST', static::TABLE_ENTRY_CREATE_ENDPOINT, $tableName, $data); |
|
|
|
|
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function updateEntry($tableName, $id, array $data) |
109
|
|
|
{ |
110
|
|
|
// TODO: Implement updateEntry() method. |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function deleteEntry($tableName, $ids) |
114
|
|
|
{ |
115
|
|
|
// TODO: Implement deleteEntry() method. |
116
|
|
|
} |
117
|
|
|
|
118
|
|
|
public function createUser(array $data) |
119
|
|
|
{ |
120
|
|
|
// TODO: Implement createUser() method. |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
public function updateUser($id, array $data) |
124
|
|
|
{ |
125
|
|
|
// TODO: Implement updateUser() method. |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function deleteUser($ids) |
129
|
|
|
{ |
130
|
|
|
// TODO: Implement deleteUser() method. |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
public function createFile(array $data) |
134
|
|
|
{ |
135
|
|
|
// TODO: Implement createFile() method. |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function updateFile($id, array $data) |
139
|
|
|
{ |
140
|
|
|
// TODO: Implement updateFile() method. |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
public function deleteFile($ids) |
144
|
|
|
{ |
145
|
|
|
// TODO: Implement deleteFile() method. |
146
|
|
|
} |
147
|
|
|
} |
148
|
|
|
|