1 | <?php |
||
47 | class Circles { |
||
48 | |||
49 | const API_VERSION = [0, 10, 0]; |
||
50 | |||
51 | protected static function getContainer() { |
||
56 | |||
57 | |||
58 | /** |
||
59 | * Circles::version(); |
||
60 | * |
||
61 | * returns the current version of the API |
||
62 | * |
||
63 | * @return int[] |
||
64 | */ |
||
65 | public static function version() { |
||
68 | |||
69 | |||
70 | public static function addJavascriptAPI() { |
||
76 | |||
77 | |||
78 | /** |
||
79 | * Circles::compareVersion(); |
||
80 | * |
||
81 | * Compare and return true if version is compatible. |
||
82 | * Exception otherwise. |
||
83 | * |
||
84 | * @param array $apiVersion |
||
85 | * |
||
86 | * @return bool |
||
87 | * @throws ApiVersionIncompatibleException |
||
88 | */ |
||
89 | public static function compareVersion($apiVersion) { |
||
97 | |||
98 | |||
99 | /** |
||
100 | * Circles::createCircle(); |
||
101 | * |
||
102 | * Create a new circle and make the current user its owner. |
||
103 | * You must specify type and name. type is one of this value: |
||
104 | * |
||
105 | * CIRCLES_PERSONAL is 1 or 'personal' |
||
106 | * CIRCLES_SECRET is 2 or 'secret' |
||
107 | * CIRCLES_CLOSED is 4 or 'closed' |
||
108 | * CIRCLES_PUBLIC is 8 or 'public' |
||
109 | * |
||
110 | * @param mixed $type |
||
111 | * @param string $name |
||
112 | * |
||
113 | * @return Circle |
||
114 | * @throws QueryException |
||
115 | */ |
||
116 | public static function createCircle($type, $name) { |
||
122 | |||
123 | |||
124 | /** |
||
125 | * Circles::joinCircle(); |
||
126 | * |
||
127 | * This function will make the current user joining a circle identified by its Id. |
||
128 | * |
||
129 | * @param string $circleUniqueId |
||
130 | * |
||
131 | * @return Member |
||
132 | * @throws QueryException |
||
133 | */ |
||
134 | public static function joinCircle($circleUniqueId) { |
||
140 | |||
141 | |||
142 | /** |
||
143 | * Circles::leaveCircle(); |
||
144 | * |
||
145 | * This function will make the current user leaving the circle identified by its Id. Will fail |
||
146 | * if user is the owner of the circle. |
||
147 | * |
||
148 | * @param string $circleUniqueId |
||
149 | * |
||
150 | * @return Member |
||
151 | * @throws QueryException |
||
152 | */ |
||
153 | public static function leaveCircle($circleUniqueId) { |
||
159 | |||
160 | |||
161 | /** |
||
162 | * Circles::listCircles(); |
||
163 | * |
||
164 | * This function list all circles fitting a search regarding its name and the level and the |
||
165 | * rights from the current user. In case of Secret circle, name needs to be complete so the |
||
166 | * circle is included in the list (or if the current user is the owner) |
||
167 | * |
||
168 | * example: Circles::listCircles(Circle::CIRCLES_ALL, '', 8, callback); will returns all |
||
169 | * circles when the current user is at least an Admin. |
||
170 | * |
||
171 | * @param mixed $type |
||
172 | * @param string $name |
||
173 | * @param int $level |
||
174 | * @param string $userId |
||
175 | * |
||
176 | * @return Circle[] |
||
177 | * @throws QueryException |
||
178 | */ |
||
179 | public static function listCircles($type, $name = '', $level = 0, $userId = '') { |
||
191 | |||
192 | |||
193 | /** |
||
194 | * Circles::joinedCircles(); |
||
195 | * |
||
196 | * Return all the circle the current user is a member. |
||
197 | * |
||
198 | * @param string $userId |
||
199 | * |
||
200 | * @return Circle[] |
||
201 | * @throws QueryException |
||
202 | */ |
||
203 | public static function joinedCircles($userId = '') { |
||
206 | |||
207 | |||
208 | /** |
||
209 | * Circles::joinedCircleIds(); |
||
210 | * |
||
211 | * Return all the circleIds the user is a member, if empty user, using current user. |
||
212 | * |
||
213 | * @param $userId |
||
214 | * |
||
215 | * @return array |
||
216 | * @throws QueryException |
||
217 | */ |
||
218 | public static function joinedCircleIds($userId = '') { |
||
227 | |||
228 | |||
229 | /** |
||
230 | * Circles::detailsCircle(); |
||
231 | * |
||
232 | * WARNING - This function is called by the core - WARNING |
||
233 | * Do not change it |
||
234 | * |
||
235 | * Returns details on the circle. If the current user is a member, the members list will be |
||
236 | * return as well. |
||
237 | * |
||
238 | * @param string $circleUniqueId |
||
239 | * |
||
240 | * @return Circle |
||
241 | * @throws QueryException |
||
242 | */ |
||
243 | public static function detailsCircle($circleUniqueId) { |
||
249 | |||
250 | |||
251 | /** |
||
252 | * Circles::settingsCircle(); |
||
253 | * |
||
254 | * Save the settings. Settings is an array and current user need to be an admin |
||
255 | * |
||
256 | * @param string $circleUniqueId |
||
257 | * @param array $settings |
||
258 | * |
||
259 | * @return Circle |
||
260 | * @throws QueryException |
||
261 | */ |
||
262 | public static function settingsCircle($circleUniqueId, array $settings) { |
||
268 | |||
269 | |||
270 | /** |
||
271 | * Circles::destroyCircle(); |
||
272 | * |
||
273 | * This function will destroy the circle if the current user is the Owner. |
||
274 | * |
||
275 | * @param string $circleUniqueId |
||
276 | * |
||
277 | * @return mixed |
||
278 | * @throws QueryException |
||
279 | */ |
||
280 | public static function destroyCircle($circleUniqueId) { |
||
286 | |||
287 | |||
288 | /** |
||
289 | * Circles::addMember(); |
||
290 | * |
||
291 | * This function will add a user as member of the circle. Current user need at least to be |
||
292 | * Moderator. |
||
293 | * |
||
294 | * @param string $circleUniqueId |
||
295 | * @param string $ident |
||
296 | * @param int $type |
||
297 | * |
||
298 | * @return Member[] |
||
299 | * @throws QueryException |
||
300 | */ |
||
301 | public static function addMember($circleUniqueId, $ident, $type) { |
||
307 | |||
308 | |||
309 | /** |
||
310 | * Circles::getMember(); |
||
311 | * |
||
312 | * This function will return information on a member of the circle. Current user need at least |
||
313 | * to be Member. |
||
314 | * |
||
315 | * @param string $circleUniqueId |
||
316 | * @param string $ident |
||
317 | * @param int $type |
||
318 | * |
||
319 | * @return Member |
||
320 | * @throws QueryException |
||
321 | */ |
||
322 | public static function getMember($circleUniqueId, $ident, $type) { |
||
328 | |||
329 | |||
330 | /** |
||
331 | * Circles::removeMember(); |
||
332 | * |
||
333 | * This function will remove a member from the circle. Current user needs to be at least |
||
334 | * Moderator and have a higher level that the targeted member. |
||
335 | * |
||
336 | * @param string $circleUniqueId |
||
337 | * @param string $ident |
||
338 | * @param int $type |
||
339 | * |
||
340 | * @return Member[] |
||
341 | * @throws QueryException |
||
342 | */ |
||
343 | public static function removeMember($circleUniqueId, $ident, $type) { |
||
349 | |||
350 | |||
351 | /** |
||
352 | * Circles::levelMember(); |
||
353 | * |
||
354 | * Edit the level of a member of the circle. The current level of the target needs to be lower |
||
355 | * than the user that initiate the process (ie. the current user). The new level of the target |
||
356 | * cannot be the same than the current level of the user that initiate the process (ie. the |
||
357 | * current user). |
||
358 | * |
||
359 | * @param string $circleUniqueId |
||
360 | * @param string $ident |
||
361 | * @param int $type |
||
362 | * @param int $level |
||
363 | * |
||
364 | * @return Member[] |
||
365 | * @throws QueryException |
||
366 | */ |
||
367 | public static function levelMember($circleUniqueId, $ident, $type, $level) { |
||
373 | |||
374 | |||
375 | /** |
||
376 | * Circles::shareToCircle(); |
||
377 | * |
||
378 | * This function will share an item (array) to the circle identified by its Id. |
||
379 | * Source is the app that is sharing the item and type can be used by the app to identified the |
||
380 | * payload. |
||
381 | * |
||
382 | * @param string $circleUniqueId |
||
383 | * @param string $source |
||
384 | * @param string $type |
||
385 | * @param array $payload |
||
386 | * @param string $broadcaster |
||
387 | * |
||
388 | * @return mixed |
||
389 | * @throws QueryException |
||
390 | */ |
||
391 | public static function shareToCircle( |
||
402 | |||
403 | |||
404 | /** |
||
405 | * Circles::getSharesFromCircle(); |
||
406 | * |
||
407 | * This function will returns all item (array) shared to a specific circle identified by its Id, |
||
408 | * source and type. Limited to current user session. |
||
409 | * |
||
410 | * @param string $circleUniqueId |
||
411 | * |
||
412 | * @return mixed |
||
413 | * @throws QueryException |
||
414 | */ |
||
415 | public static function getSharesFromCircle($circleUniqueId) { |
||
421 | |||
422 | |||
423 | /** |
||
424 | * Circles::linkCircle(); |
||
425 | * |
||
426 | * Initiate a link procedure. Current user must be at least Admin of the circle. |
||
427 | * circleId is the local circle and remote is the target for the link. |
||
428 | * Remote format is: <circle_name>@<remote_host> when remote_host must be a valid HTTPS address. |
||
429 | * Remote format is: <circle_name>@<remote_host> when remote_host must be a valid HTTPS address. |
||
430 | * |
||
431 | * @param string $circleUniqueId |
||
432 | * @param string $remote |
||
433 | * |
||
434 | * @return FederatedLink |
||
435 | * @throws QueryException |
||
436 | */ |
||
437 | public static function linkCircle($circleUniqueId, $remote) { |
||
443 | |||
444 | |||
445 | /** |
||
446 | * Circles::generateLink(); |
||
447 | * |
||
448 | * Returns the link to get access to a local circle. |
||
449 | * |
||
450 | * @param string $circleUniqueId |
||
451 | * |
||
452 | * @return string |
||
453 | */ |
||
454 | public static function generateLink($circleUniqueId) { |
||
458 | |||
459 | |||
460 | /** |
||
461 | * Circles::generateAbsoluteLink(); |
||
462 | * |
||
463 | * Returns the absolute link to get access to a local circle. |
||
464 | * |
||
465 | * @param string $circleUniqueId |
||
466 | * |
||
467 | * @return string |
||
468 | */ |
||
469 | public static function generateAbsoluteLink($circleUniqueId) { |
||
473 | |||
474 | |||
475 | /** |
||
476 | * Circles::generateRemoteLink(); |
||
477 | * |
||
478 | * Returns the link to get access to a remote circle. |
||
479 | * |
||
480 | * @param FederatedLink $link |
||
481 | * |
||
482 | * @return string |
||
483 | */ |
||
484 | public static function generateRemoteLink(FederatedLink $link) { |
||
489 | |||
490 | |||
491 | /** |
||
492 | * @param SharingFrame $frame |
||
493 | * |
||
494 | * @return array |
||
|
|||
495 | */ |
||
496 | public static function generateUserParameter(SharingFrame $frame) { |
||
510 | |||
511 | |||
512 | /** |
||
513 | * @param SharingFrame $frame |
||
514 | * |
||
515 | * @return array |
||
516 | */ |
||
517 | public static function generateCircleParameter(SharingFrame $frame) { |
||
530 | |||
531 | /** |
||
532 | * Get a list of objects which are shred with $circleUniqueId. |
||
533 | * |
||
534 | * @since 0.14.0 |
||
535 | * |
||
536 | * @param array $circleUniqueIds |
||
537 | * |
||
538 | * @return string[] array of object ids or empty array if none found |
||
539 | * @throws QueryException |
||
540 | */ |
||
541 | public static function getFilesForCircles($circleUniqueIds) { |
||
547 | } |
||
548 |
This check looks for the generic type
array
as a return type and suggests a more specific type. This type is inferred from the actual code.