| @@ 159-168 (lines=10) @@ | ||
| 156 | * @return DataResponse |
|
| 157 | * @throws OCSException |
|
| 158 | */ |
|
| 159 | public function destroy(string $circleId): DataResponse { |
|
| 160 | try { |
|
| 161 | $this->setCurrentFederatedUser(); |
|
| 162 | $circle = $this->circleService->destroy($circleId); |
|
| 163 | ||
| 164 | return new DataResponse($this->serializeArray($circle)); |
|
| 165 | } catch (Exception $e) { |
|
| 166 | throw new OcsException($e->getMessage(), $e->getCode()); |
|
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | ||
| 171 | /** |
|
| @@ 179-187 (lines=9) @@ | ||
| 176 | * @return DataResponse |
|
| 177 | * @throws OCSException |
|
| 178 | */ |
|
| 179 | public function search(string $term): DataResponse { |
|
| 180 | try { |
|
| 181 | $this->setCurrentFederatedUser(); |
|
| 182 | ||
| 183 | return new DataResponse($this->serializeArray($this->searchService->search($term))); |
|
| 184 | } catch (Exception $e) { |
|
| 185 | throw new OcsException($e->getMessage(), $e->getCode()); |
|
| 186 | } |
|
| 187 | } |
|
| 188 | ||
| 189 | ||
| 190 | /** |
|
| @@ 198-206 (lines=9) @@ | ||
| 195 | * @return DataResponse |
|
| 196 | * @throws OCSException |
|
| 197 | */ |
|
| 198 | public function circleDetails(string $circleId): DataResponse { |
|
| 199 | try { |
|
| 200 | $this->setCurrentFederatedUser(); |
|
| 201 | ||
| 202 | return new DataResponse($this->serialize($this->circleService->getCircle($circleId))); |
|
| 203 | } catch (Exception $e) { |
|
| 204 | throw new OcsException($e->getMessage(), $e->getCode()); |
|
| 205 | } |
|
| 206 | } |
|
| 207 | ||
| 208 | ||
| 209 | /** |
|
| @@ 283-292 (lines=10) @@ | ||
| 280 | * @return DataResponse |
|
| 281 | * @throws OCSException |
|
| 282 | */ |
|
| 283 | public function circleJoin(string $circleId): DataResponse { |
|
| 284 | try { |
|
| 285 | $this->setCurrentFederatedUser(); |
|
| 286 | $result = $this->circleService->circleJoin($circleId); |
|
| 287 | ||
| 288 | return new DataResponse($this->serializeArray($result)); |
|
| 289 | } catch (Exception $e) { |
|
| 290 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 291 | } |
|
| 292 | } |
|
| 293 | ||
| 294 | ||
| 295 | /** |
|
| @@ 303-312 (lines=10) @@ | ||
| 300 | * @return DataResponse |
|
| 301 | * @throws OCSException |
|
| 302 | */ |
|
| 303 | public function circleLeave(string $circleId): DataResponse { |
|
| 304 | try { |
|
| 305 | $this->setCurrentFederatedUser(); |
|
| 306 | $result = $this->circleService->circleLeave($circleId); |
|
| 307 | ||
| 308 | return new DataResponse($this->serializeArray($result)); |
|
| 309 | } catch (Exception $e) { |
|
| 310 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 311 | } |
|
| 312 | } |
|
| 313 | ||
| 314 | ||
| 315 | /** |
|
| @@ 379-390 (lines=12) @@ | ||
| 376 | * @return DataResponse |
|
| 377 | * @throws OCSException |
|
| 378 | */ |
|
| 379 | public function memberRemove(string $circleId, string $memberId): DataResponse { |
|
| 380 | try { |
|
| 381 | $this->setCurrentFederatedUser(); |
|
| 382 | $this->memberService->getMemberById($memberId, $circleId); |
|
| 383 | ||
| 384 | $result = $this->memberService->removeMember($memberId); |
|
| 385 | ||
| 386 | return new DataResponse($this->serializeArray($result)); |
|
| 387 | } catch (Exception $e) { |
|
| 388 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 389 | } |
|
| 390 | } |
|
| 391 | ||
| 392 | ||
| 393 | /** |
|
| @@ 418-426 (lines=9) @@ | ||
| 415 | * @return DataResponse |
|
| 416 | * @throws OCSException |
|
| 417 | */ |
|
| 418 | public function members(string $circleId): DataResponse { |
|
| 419 | try { |
|
| 420 | $this->setCurrentFederatedUser(); |
|
| 421 | ||
| 422 | return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId))); |
|
| 423 | } catch (Exception $e) { |
|
| 424 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 425 | } |
|
| 426 | } |
|
| 427 | ||
| 428 | ||
| 429 | /** |
|
| @@ 460-470 (lines=11) @@ | ||
| 457 | * @return DataResponse |
|
| 458 | * @throws OCSException |
|
| 459 | */ |
|
| 460 | public function editDescription(string $circleId, string $value): DataResponse { |
|
| 461 | try { |
|
| 462 | $this->setCurrentFederatedUser(); |
|
| 463 | ||
| 464 | $outcome = $this->circleService->updateDescription($circleId, $value); |
|
| 465 | ||
| 466 | return new DataResponse($this->serializeArray($outcome)); |
|
| 467 | } catch (Exception $e) { |
|
| 468 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 469 | } |
|
| 470 | } |
|
| 471 | ||
| 472 | ||
| 473 | /** |
|
| @@ 482-492 (lines=11) @@ | ||
| 479 | * @return DataResponse |
|
| 480 | * @throws OCSException |
|
| 481 | */ |
|
| 482 | public function editSettings(string $circleId, array $value): DataResponse { |
|
| 483 | try { |
|
| 484 | $this->setCurrentFederatedUser(); |
|
| 485 | ||
| 486 | $outcome = $this->circleService->updateSettings($circleId, $value); |
|
| 487 | ||
| 488 | return new DataResponse($this->serializeArray($outcome)); |
|
| 489 | } catch (Exception $e) { |
|
| 490 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 491 | } |
|
| 492 | } |
|
| 493 | ||
| 494 | ||
| 495 | /** |
|
| @@ 504-514 (lines=11) @@ | ||
| 501 | * @return DataResponse |
|
| 502 | * @throws OCSException |
|
| 503 | */ |
|
| 504 | public function editConfig(string $circleId, int $value): DataResponse { |
|
| 505 | try { |
|
| 506 | $this->setCurrentFederatedUser(); |
|
| 507 | ||
| 508 | $outcome = $this->circleService->updateConfig($circleId, $value); |
|
| 509 | ||
| 510 | return new DataResponse($this->serializeArray($outcome)); |
|
| 511 | } catch (Exception $e) { |
|
| 512 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 513 | } |
|
| 514 | } |
|
| 515 | ||
| 516 | ||
| 517 | /** |
|
| @@ 165-174 (lines=10) @@ | ||
| 162 | * @return DataResponse |
|
| 163 | * @throws OCSException |
|
| 164 | */ |
|
| 165 | public function destroy(string $emulated, string $circleId): DataResponse { |
|
| 166 | try { |
|
| 167 | $this->setLocalFederatedUser($emulated); |
|
| 168 | $circle = $this->circleService->destroy($circleId); |
|
| 169 | ||
| 170 | return new DataResponse($this->serializeArray($circle)); |
|
| 171 | } catch (Exception $e) { |
|
| 172 | throw new OcsException($e->getMessage(), $e->getCode()); |
|
| 173 | } |
|
| 174 | } |
|
| 175 | ||
| 176 | ||
| 177 | /** |
|
| @@ 244-252 (lines=9) @@ | ||
| 241 | * @return DataResponse |
|
| 242 | * @throws OCSException |
|
| 243 | */ |
|
| 244 | public function circles(string $emulated): DataResponse { |
|
| 245 | try { |
|
| 246 | $this->setLocalFederatedUser($emulated); |
|
| 247 | ||
| 248 | return new DataResponse($this->serializeArray($this->circleService->getCircles())); |
|
| 249 | } catch (Exception $e) { |
|
| 250 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 251 | } |
|
| 252 | } |
|
| 253 | ||
| 254 | ||
| 255 | /** |
|
| @@ 262-270 (lines=9) @@ | ||
| 259 | * @return DataResponse |
|
| 260 | * @throws OCSException |
|
| 261 | */ |
|
| 262 | public function circleDetails(string $emulated, string $circleId): DataResponse { |
|
| 263 | try { |
|
| 264 | $this->setLocalFederatedUser($emulated); |
|
| 265 | ||
| 266 | return new DataResponse($this->serialize($this->circleService->getCircle($circleId))); |
|
| 267 | } catch (Exception $e) { |
|
| 268 | throw new OcsException($e->getMessage(), $e->getCode()); |
|
| 269 | } |
|
| 270 | } |
|
| 271 | ||
| 272 | ||
| 273 | /** |
|
| @@ 280-289 (lines=10) @@ | ||
| 277 | * @return DataResponse |
|
| 278 | * @throws OCSException |
|
| 279 | */ |
|
| 280 | public function circleJoin(string $emulated, string $circleId): DataResponse { |
|
| 281 | try { |
|
| 282 | $this->setLocalFederatedUser($emulated); |
|
| 283 | $result = $this->circleService->circleJoin($circleId); |
|
| 284 | ||
| 285 | return new DataResponse($this->serializeArray($result)); |
|
| 286 | } catch (Exception $e) { |
|
| 287 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 288 | } |
|
| 289 | } |
|
| 290 | ||
| 291 | ||
| 292 | /** |
|
| @@ 299-308 (lines=10) @@ | ||
| 296 | * @return DataResponse |
|
| 297 | * @throws OCSException |
|
| 298 | */ |
|
| 299 | public function circleLeave(string $emulated, string $circleId): DataResponse { |
|
| 300 | try { |
|
| 301 | $this->setLocalFederatedUser($emulated); |
|
| 302 | $result = $this->circleService->circleLeave($circleId); |
|
| 303 | ||
| 304 | return new DataResponse($this->serializeArray($result)); |
|
| 305 | } catch (Exception $e) { |
|
| 306 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 307 | } |
|
| 308 | } |
|
| 309 | ||
| 310 | ||
| 311 | /** |
|
| @@ 344-355 (lines=12) @@ | ||
| 341 | * @return DataResponse |
|
| 342 | * @throws OCSException |
|
| 343 | */ |
|
| 344 | public function memberRemove(string $emulated, string $circleId, string $memberId): DataResponse { |
|
| 345 | try { |
|
| 346 | $this->setLocalFederatedUser($emulated); |
|
| 347 | $this->memberService->getMemberById($memberId, $circleId); |
|
| 348 | ||
| 349 | $result = $this->memberService->removeMember($memberId); |
|
| 350 | ||
| 351 | return new DataResponse($this->serializeArray($result)); |
|
| 352 | } catch (Exception $e) { |
|
| 353 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 354 | } |
|
| 355 | } |
|
| 356 | ||
| 357 | ||
| 358 | /** |
|
| @@ 365-373 (lines=9) @@ | ||
| 362 | * @return DataResponse |
|
| 363 | * @throws OCSException |
|
| 364 | */ |
|
| 365 | public function members(string $emulated, string $circleId): DataResponse { |
|
| 366 | try { |
|
| 367 | $this->setLocalFederatedUser($emulated); |
|
| 368 | ||
| 369 | return new DataResponse($this->serializeArray($this->memberService->getMembers($circleId))); |
|
| 370 | } catch (Exception $e) { |
|
| 371 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 372 | } |
|
| 373 | } |
|
| 374 | ||
| 375 | ||
| 376 | /** |
|
| @@ 384-394 (lines=11) @@ | ||
| 381 | * @return DataResponse |
|
| 382 | * @throws OCSException |
|
| 383 | */ |
|
| 384 | public function editName(string $emulated, string $circleId, string $value): DataResponse { |
|
| 385 | try { |
|
| 386 | $this->setLocalFederatedUser($emulated); |
|
| 387 | ||
| 388 | $outcome = $this->circleService->updateName($circleId, $value); |
|
| 389 | ||
| 390 | return new DataResponse($this->serializeArray($outcome)); |
|
| 391 | } catch (Exception $e) { |
|
| 392 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 393 | } |
|
| 394 | } |
|
| 395 | ||
| 396 | ||
| 397 | /** |
|
| @@ 405-415 (lines=11) @@ | ||
| 402 | * @return DataResponse |
|
| 403 | * @throws OCSException |
|
| 404 | */ |
|
| 405 | public function editDescription(string $emulated, string $circleId, string $value): DataResponse { |
|
| 406 | try { |
|
| 407 | $this->setLocalFederatedUser($emulated); |
|
| 408 | ||
| 409 | $outcome = $this->circleService->updateDescription($circleId, $value); |
|
| 410 | ||
| 411 | return new DataResponse($this->serializeArray($outcome)); |
|
| 412 | } catch (Exception $e) { |
|
| 413 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 414 | } |
|
| 415 | } |
|
| 416 | ||
| 417 | ||
| 418 | /** |
|
| @@ 426-436 (lines=11) @@ | ||
| 423 | * @return DataResponse |
|
| 424 | * @throws OCSException |
|
| 425 | */ |
|
| 426 | public function editSettings(string $emulated, string $circleId, array $value): DataResponse { |
|
| 427 | try { |
|
| 428 | $this->setLocalFederatedUser($emulated); |
|
| 429 | ||
| 430 | $outcome = $this->circleService->updateSettings($circleId, $value); |
|
| 431 | ||
| 432 | return new DataResponse($this->serializeArray($outcome)); |
|
| 433 | } catch (Exception $e) { |
|
| 434 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 435 | } |
|
| 436 | } |
|
| 437 | ||
| 438 | ||
| 439 | /** |
|
| @@ 447-457 (lines=11) @@ | ||
| 444 | * @return DataResponse |
|
| 445 | * @throws OCSException |
|
| 446 | */ |
|
| 447 | public function editConfig(string $emulated, string $circleId, int $value): DataResponse { |
|
| 448 | try { |
|
| 449 | $this->setLocalFederatedUser($emulated); |
|
| 450 | ||
| 451 | $outcome = $this->circleService->updateConfig($circleId, $value); |
|
| 452 | ||
| 453 | return new DataResponse($this->serializeArray($outcome)); |
|
| 454 | } catch (Exception $e) { |
|
| 455 | throw new OCSException($e->getMessage(), $e->getCode()); |
|
| 456 | } |
|
| 457 | } |
|
| 458 | ||
| 459 | ||
| 460 | /** |
|