@@ -35,73 +35,73 @@ |
||
| 35 | 35 | |
| 36 | 36 | class StatusesController extends OCSController { |
| 37 | 37 | |
| 38 | - /** @var StatusService */ |
|
| 39 | - private $service; |
|
| 38 | + /** @var StatusService */ |
|
| 39 | + private $service; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * StatusesController constructor. |
|
| 43 | - * |
|
| 44 | - * @param string $appName |
|
| 45 | - * @param IRequest $request |
|
| 46 | - * @param StatusService $service |
|
| 47 | - */ |
|
| 48 | - public function __construct(string $appName, |
|
| 49 | - IRequest $request, |
|
| 50 | - StatusService $service) { |
|
| 51 | - parent::__construct($appName, $request); |
|
| 52 | - $this->service = $service; |
|
| 53 | - } |
|
| 41 | + /** |
|
| 42 | + * StatusesController constructor. |
|
| 43 | + * |
|
| 44 | + * @param string $appName |
|
| 45 | + * @param IRequest $request |
|
| 46 | + * @param StatusService $service |
|
| 47 | + */ |
|
| 48 | + public function __construct(string $appName, |
|
| 49 | + IRequest $request, |
|
| 50 | + StatusService $service) { |
|
| 51 | + parent::__construct($appName, $request); |
|
| 52 | + $this->service = $service; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @NoAdminRequired |
|
| 57 | - * |
|
| 58 | - * @param int|null $limit |
|
| 59 | - * @param int|null $offset |
|
| 60 | - * @return DataResponse |
|
| 61 | - */ |
|
| 62 | - public function findAll(?int $limit=null, ?int $offset=null): DataResponse { |
|
| 63 | - $allStatuses = $this->service->findAll($limit, $offset); |
|
| 55 | + /** |
|
| 56 | + * @NoAdminRequired |
|
| 57 | + * |
|
| 58 | + * @param int|null $limit |
|
| 59 | + * @param int|null $offset |
|
| 60 | + * @return DataResponse |
|
| 61 | + */ |
|
| 62 | + public function findAll(?int $limit=null, ?int $offset=null): DataResponse { |
|
| 63 | + $allStatuses = $this->service->findAll($limit, $offset); |
|
| 64 | 64 | |
| 65 | - return new DataResponse(array_map(function ($userStatus) { |
|
| 66 | - return $this->formatStatus($userStatus); |
|
| 67 | - }, $allStatuses)); |
|
| 68 | - } |
|
| 65 | + return new DataResponse(array_map(function ($userStatus) { |
|
| 66 | + return $this->formatStatus($userStatus); |
|
| 67 | + }, $allStatuses)); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @NoAdminRequired |
|
| 72 | - * |
|
| 73 | - * @param string $userId |
|
| 74 | - * @return DataResponse |
|
| 75 | - * @throws OCSNotFoundException |
|
| 76 | - */ |
|
| 77 | - public function find(string $userId): DataResponse { |
|
| 78 | - try { |
|
| 79 | - $userStatus = $this->service->findByUserId($userId); |
|
| 80 | - } catch (DoesNotExistException $ex) { |
|
| 81 | - throw new OCSNotFoundException('No status for the requested userId'); |
|
| 82 | - } |
|
| 70 | + /** |
|
| 71 | + * @NoAdminRequired |
|
| 72 | + * |
|
| 73 | + * @param string $userId |
|
| 74 | + * @return DataResponse |
|
| 75 | + * @throws OCSNotFoundException |
|
| 76 | + */ |
|
| 77 | + public function find(string $userId): DataResponse { |
|
| 78 | + try { |
|
| 79 | + $userStatus = $this->service->findByUserId($userId); |
|
| 80 | + } catch (DoesNotExistException $ex) { |
|
| 81 | + throw new OCSNotFoundException('No status for the requested userId'); |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - return new DataResponse($this->formatStatus($userStatus)); |
|
| 85 | - } |
|
| 84 | + return new DataResponse($this->formatStatus($userStatus)); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - /** |
|
| 88 | - * @NoAdminRequired |
|
| 89 | - * |
|
| 90 | - * @param UserStatus $status |
|
| 91 | - * @return array |
|
| 92 | - */ |
|
| 93 | - private function formatStatus(UserStatus $status): array { |
|
| 94 | - $visibleStatus = $status->getStatus(); |
|
| 95 | - if ($visibleStatus === 'invisible') { |
|
| 96 | - $visibleStatus = 'offline'; |
|
| 97 | - } |
|
| 87 | + /** |
|
| 88 | + * @NoAdminRequired |
|
| 89 | + * |
|
| 90 | + * @param UserStatus $status |
|
| 91 | + * @return array |
|
| 92 | + */ |
|
| 93 | + private function formatStatus(UserStatus $status): array { |
|
| 94 | + $visibleStatus = $status->getStatus(); |
|
| 95 | + if ($visibleStatus === 'invisible') { |
|
| 96 | + $visibleStatus = 'offline'; |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - return [ |
|
| 100 | - 'userId' => $status->getUserId(), |
|
| 101 | - 'message' => $status->getCustomMessage(), |
|
| 102 | - 'icon' => $status->getCustomIcon(), |
|
| 103 | - 'clearAt' => $status->getClearAt(), |
|
| 104 | - 'status' => $visibleStatus, |
|
| 105 | - ]; |
|
| 106 | - } |
|
| 99 | + return [ |
|
| 100 | + 'userId' => $status->getUserId(), |
|
| 101 | + 'message' => $status->getCustomMessage(), |
|
| 102 | + 'icon' => $status->getCustomIcon(), |
|
| 103 | + 'clearAt' => $status->getClearAt(), |
|
| 104 | + 'status' => $visibleStatus, |
|
| 105 | + ]; |
|
| 106 | + } |
|
| 107 | 107 | } |
@@ -59,10 +59,10 @@ |
||
| 59 | 59 | * @param int|null $offset |
| 60 | 60 | * @return DataResponse |
| 61 | 61 | */ |
| 62 | - public function findAll(?int $limit=null, ?int $offset=null): DataResponse { |
|
| 62 | + public function findAll(?int $limit = null, ?int $offset = null): DataResponse { |
|
| 63 | 63 | $allStatuses = $this->service->findAll($limit, $offset); |
| 64 | 64 | |
| 65 | - return new DataResponse(array_map(function ($userStatus) { |
|
| 65 | + return new DataResponse(array_map(function($userStatus) { |
|
| 66 | 66 | return $this->formatStatus($userStatus); |
| 67 | 67 | }, $allStatuses)); |
| 68 | 68 | } |
@@ -37,29 +37,29 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | class PredefinedStatusController extends OCSController { |
| 39 | 39 | |
| 40 | - /** @var PredefinedStatusService */ |
|
| 41 | - private $predefinedStatusService; |
|
| 40 | + /** @var PredefinedStatusService */ |
|
| 41 | + private $predefinedStatusService; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * AStatusController constructor. |
|
| 45 | - * |
|
| 46 | - * @param string $appName |
|
| 47 | - * @param IRequest $request |
|
| 48 | - * @param PredefinedStatusService $predefinedStatusService |
|
| 49 | - */ |
|
| 50 | - public function __construct(string $appName, |
|
| 51 | - IRequest $request, |
|
| 52 | - PredefinedStatusService $predefinedStatusService) { |
|
| 53 | - parent::__construct($appName, $request); |
|
| 54 | - $this->predefinedStatusService = $predefinedStatusService; |
|
| 55 | - } |
|
| 43 | + /** |
|
| 44 | + * AStatusController constructor. |
|
| 45 | + * |
|
| 46 | + * @param string $appName |
|
| 47 | + * @param IRequest $request |
|
| 48 | + * @param PredefinedStatusService $predefinedStatusService |
|
| 49 | + */ |
|
| 50 | + public function __construct(string $appName, |
|
| 51 | + IRequest $request, |
|
| 52 | + PredefinedStatusService $predefinedStatusService) { |
|
| 53 | + parent::__construct($appName, $request); |
|
| 54 | + $this->predefinedStatusService = $predefinedStatusService; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @NoAdminRequired |
|
| 59 | - * |
|
| 60 | - * @return DataResponse |
|
| 61 | - */ |
|
| 62 | - public function findAll():DataResponse { |
|
| 63 | - return new DataResponse($this->predefinedStatusService->getDefaultStatuses()); |
|
| 64 | - } |
|
| 57 | + /** |
|
| 58 | + * @NoAdminRequired |
|
| 59 | + * |
|
| 60 | + * @return DataResponse |
|
| 61 | + */ |
|
| 62 | + public function findAll():DataResponse { |
|
| 63 | + return new DataResponse($this->predefinedStatusService->getDefaultStatuses()); |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -36,57 +36,57 @@ |
||
| 36 | 36 | |
| 37 | 37 | class HeartbeatController extends Controller { |
| 38 | 38 | |
| 39 | - /** @var IEventDispatcher */ |
|
| 40 | - private $eventDispatcher; |
|
| 39 | + /** @var IEventDispatcher */ |
|
| 40 | + private $eventDispatcher; |
|
| 41 | 41 | |
| 42 | - /** @var IUserSession */ |
|
| 43 | - private $userSession; |
|
| 42 | + /** @var IUserSession */ |
|
| 43 | + private $userSession; |
|
| 44 | 44 | |
| 45 | - /** @var ITimeFactory */ |
|
| 46 | - private $timeFactory; |
|
| 45 | + /** @var ITimeFactory */ |
|
| 46 | + private $timeFactory; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * HeartbeatController constructor. |
|
| 50 | - * |
|
| 51 | - * @param string $appName |
|
| 52 | - * @param IRequest $request |
|
| 53 | - * @param IEventDispatcher $eventDispatcher |
|
| 54 | - */ |
|
| 55 | - public function __construct(string $appName, |
|
| 56 | - IRequest $request, |
|
| 57 | - IEventDispatcher $eventDispatcher, |
|
| 58 | - IUserSession $userSession, |
|
| 59 | - ITimeFactory $timeFactory) { |
|
| 60 | - parent::__construct($appName, $request); |
|
| 61 | - $this->eventDispatcher = $eventDispatcher; |
|
| 62 | - $this->userSession = $userSession; |
|
| 63 | - $this->timeFactory = $timeFactory; |
|
| 64 | - } |
|
| 48 | + /** |
|
| 49 | + * HeartbeatController constructor. |
|
| 50 | + * |
|
| 51 | + * @param string $appName |
|
| 52 | + * @param IRequest $request |
|
| 53 | + * @param IEventDispatcher $eventDispatcher |
|
| 54 | + */ |
|
| 55 | + public function __construct(string $appName, |
|
| 56 | + IRequest $request, |
|
| 57 | + IEventDispatcher $eventDispatcher, |
|
| 58 | + IUserSession $userSession, |
|
| 59 | + ITimeFactory $timeFactory) { |
|
| 60 | + parent::__construct($appName, $request); |
|
| 61 | + $this->eventDispatcher = $eventDispatcher; |
|
| 62 | + $this->userSession = $userSession; |
|
| 63 | + $this->timeFactory = $timeFactory; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * @NoAdminRequired |
|
| 68 | - * |
|
| 69 | - * @param string $status |
|
| 70 | - * @return JSONResponse |
|
| 71 | - */ |
|
| 72 | - public function heartbeat(string $status): JSONResponse { |
|
| 73 | - if (!\in_array($status, ['online', 'away'])) { |
|
| 74 | - return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
| 75 | - } |
|
| 66 | + /** |
|
| 67 | + * @NoAdminRequired |
|
| 68 | + * |
|
| 69 | + * @param string $status |
|
| 70 | + * @return JSONResponse |
|
| 71 | + */ |
|
| 72 | + public function heartbeat(string $status): JSONResponse { |
|
| 73 | + if (!\in_array($status, ['online', 'away'])) { |
|
| 74 | + return new JSONResponse([], Http::STATUS_BAD_REQUEST); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $user = $this->userSession->getUser(); |
|
| 78 | - if ($user === null) { |
|
| 79 | - return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 80 | - } |
|
| 77 | + $user = $this->userSession->getUser(); |
|
| 78 | + if ($user === null) { |
|
| 79 | + return new JSONResponse([], Http::STATUS_INTERNAL_SERVER_ERROR); |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - $this->eventDispatcher->dispatchTyped( |
|
| 83 | - new UserLiveStatusEvent( |
|
| 84 | - $user, |
|
| 85 | - $status, |
|
| 86 | - $this->timeFactory->getTime() |
|
| 87 | - ) |
|
| 88 | - ); |
|
| 82 | + $this->eventDispatcher->dispatchTyped( |
|
| 83 | + new UserLiveStatusEvent( |
|
| 84 | + $user, |
|
| 85 | + $status, |
|
| 86 | + $this->timeFactory->getTime() |
|
| 87 | + ) |
|
| 88 | + ); |
|
| 89 | 89 | |
| 90 | - return new JSONResponse([], Http::STATUS_NO_CONTENT); |
|
| 91 | - } |
|
| 90 | + return new JSONResponse([], Http::STATUS_NO_CONTENT); |
|
| 91 | + } |
|
| 92 | 92 | } |
@@ -41,151 +41,151 @@ |
||
| 41 | 41 | |
| 42 | 42 | class UserStatusController extends OCSController { |
| 43 | 43 | |
| 44 | - /** @var string */ |
|
| 45 | - private $userId; |
|
| 46 | - |
|
| 47 | - /** @var ILogger */ |
|
| 48 | - private $logger; |
|
| 49 | - |
|
| 50 | - /** @var StatusService */ |
|
| 51 | - private $service; |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * StatusesController constructor. |
|
| 55 | - * |
|
| 56 | - * @param string $appName |
|
| 57 | - * @param IRequest $request |
|
| 58 | - * @param string $userId |
|
| 59 | - * @param ILogger $logger; |
|
| 60 | - * @param StatusService $service |
|
| 61 | - */ |
|
| 62 | - public function __construct(string $appName, |
|
| 63 | - IRequest $request, |
|
| 64 | - string $userId, |
|
| 65 | - ILogger $logger, |
|
| 66 | - StatusService $service) { |
|
| 67 | - parent::__construct($appName, $request); |
|
| 68 | - $this->userId = $userId; |
|
| 69 | - $this->logger = $logger; |
|
| 70 | - $this->service = $service; |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - /** |
|
| 74 | - * @NoAdminRequired |
|
| 75 | - * |
|
| 76 | - * @return DataResponse |
|
| 77 | - * @throws OCSNotFoundException |
|
| 78 | - */ |
|
| 79 | - public function getStatus(): DataResponse { |
|
| 80 | - try { |
|
| 81 | - $userStatus = $this->service->findByUserId($this->userId); |
|
| 82 | - } catch (DoesNotExistException $ex) { |
|
| 83 | - throw new OCSNotFoundException('No status for the current user'); |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - return new DataResponse($this->formatStatus($userStatus)); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @NoAdminRequired |
|
| 91 | - * |
|
| 92 | - * @param string $statusType |
|
| 93 | - * @return DataResponse |
|
| 94 | - * @throws OCSBadRequestException |
|
| 95 | - */ |
|
| 96 | - public function setStatus(string $statusType): DataResponse { |
|
| 97 | - try { |
|
| 98 | - $status = $this->service->setStatus($this->userId, $statusType, null, true); |
|
| 99 | - return new DataResponse($this->formatStatus($status)); |
|
| 100 | - } catch (InvalidStatusTypeException $ex) { |
|
| 101 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid status type "' . $statusType . '"'); |
|
| 102 | - throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @NoAdminRequired |
|
| 108 | - * |
|
| 109 | - * @param string $messageId |
|
| 110 | - * @param int|null $clearAt |
|
| 111 | - * @return DataResponse |
|
| 112 | - * @throws OCSBadRequestException |
|
| 113 | - */ |
|
| 114 | - public function setPredefinedMessage(string $messageId, |
|
| 115 | - ?int $clearAt): DataResponse { |
|
| 116 | - try { |
|
| 117 | - $status = $this->service->setPredefinedMessage($this->userId, $messageId, $clearAt); |
|
| 118 | - return new DataResponse($this->formatStatus($status)); |
|
| 119 | - } catch (InvalidClearAtException $ex) { |
|
| 120 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); |
|
| 121 | - throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 122 | - } catch (InvalidMessageIdException $ex) { |
|
| 123 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid message-id "' . $messageId . '"'); |
|
| 124 | - throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 125 | - } |
|
| 126 | - } |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * @NoAdminRequired |
|
| 130 | - * |
|
| 131 | - * @param string|null $statusIcon |
|
| 132 | - * @param string $message |
|
| 133 | - * @param int|null $clearAt |
|
| 134 | - * @return DataResponse |
|
| 135 | - * @throws OCSBadRequestException |
|
| 136 | - */ |
|
| 137 | - public function setCustomMessage(?string $statusIcon, |
|
| 138 | - string $message, |
|
| 139 | - ?int $clearAt): DataResponse { |
|
| 140 | - try { |
|
| 141 | - $status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt); |
|
| 142 | - return new DataResponse($this->formatStatus($status)); |
|
| 143 | - } catch (InvalidClearAtException $ex) { |
|
| 144 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); |
|
| 145 | - throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 146 | - } catch (InvalidStatusIconException $ex) { |
|
| 147 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid icon value "' . $statusIcon . '"'); |
|
| 148 | - throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 149 | - } catch (StatusMessageTooLongException $ex) { |
|
| 150 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to a too long status message.'); |
|
| 151 | - throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 152 | - } |
|
| 153 | - } |
|
| 154 | - |
|
| 155 | - /** |
|
| 156 | - * @NoAdminRequired |
|
| 157 | - * |
|
| 158 | - * @return DataResponse |
|
| 159 | - */ |
|
| 160 | - public function clearStatus(): DataResponse { |
|
| 161 | - $this->service->clearStatus($this->userId); |
|
| 162 | - return new DataResponse([]); |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * @NoAdminRequired |
|
| 167 | - * |
|
| 168 | - * @return DataResponse |
|
| 169 | - */ |
|
| 170 | - public function clearMessage(): DataResponse { |
|
| 171 | - $this->service->clearMessage($this->userId); |
|
| 172 | - return new DataResponse([]); |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - /** |
|
| 176 | - * @param UserStatus $status |
|
| 177 | - * @return array |
|
| 178 | - */ |
|
| 179 | - private function formatStatus(UserStatus $status): array { |
|
| 180 | - return [ |
|
| 181 | - 'userId' => $status->getUserId(), |
|
| 182 | - 'message' => $status->getCustomMessage(), |
|
| 183 | - 'messageId' => $status->getMessageId(), |
|
| 184 | - 'messageIsPredefined' => $status->getMessageId() !== null, |
|
| 185 | - 'icon' => $status->getCustomIcon(), |
|
| 186 | - 'clearAt' => $status->getClearAt(), |
|
| 187 | - 'status' => $status->getStatus(), |
|
| 188 | - 'statusIsUserDefined' => $status->getIsUserDefined(), |
|
| 189 | - ]; |
|
| 190 | - } |
|
| 44 | + /** @var string */ |
|
| 45 | + private $userId; |
|
| 46 | + |
|
| 47 | + /** @var ILogger */ |
|
| 48 | + private $logger; |
|
| 49 | + |
|
| 50 | + /** @var StatusService */ |
|
| 51 | + private $service; |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * StatusesController constructor. |
|
| 55 | + * |
|
| 56 | + * @param string $appName |
|
| 57 | + * @param IRequest $request |
|
| 58 | + * @param string $userId |
|
| 59 | + * @param ILogger $logger; |
|
| 60 | + * @param StatusService $service |
|
| 61 | + */ |
|
| 62 | + public function __construct(string $appName, |
|
| 63 | + IRequest $request, |
|
| 64 | + string $userId, |
|
| 65 | + ILogger $logger, |
|
| 66 | + StatusService $service) { |
|
| 67 | + parent::__construct($appName, $request); |
|
| 68 | + $this->userId = $userId; |
|
| 69 | + $this->logger = $logger; |
|
| 70 | + $this->service = $service; |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + /** |
|
| 74 | + * @NoAdminRequired |
|
| 75 | + * |
|
| 76 | + * @return DataResponse |
|
| 77 | + * @throws OCSNotFoundException |
|
| 78 | + */ |
|
| 79 | + public function getStatus(): DataResponse { |
|
| 80 | + try { |
|
| 81 | + $userStatus = $this->service->findByUserId($this->userId); |
|
| 82 | + } catch (DoesNotExistException $ex) { |
|
| 83 | + throw new OCSNotFoundException('No status for the current user'); |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + return new DataResponse($this->formatStatus($userStatus)); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @NoAdminRequired |
|
| 91 | + * |
|
| 92 | + * @param string $statusType |
|
| 93 | + * @return DataResponse |
|
| 94 | + * @throws OCSBadRequestException |
|
| 95 | + */ |
|
| 96 | + public function setStatus(string $statusType): DataResponse { |
|
| 97 | + try { |
|
| 98 | + $status = $this->service->setStatus($this->userId, $statusType, null, true); |
|
| 99 | + return new DataResponse($this->formatStatus($status)); |
|
| 100 | + } catch (InvalidStatusTypeException $ex) { |
|
| 101 | + $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid status type "' . $statusType . '"'); |
|
| 102 | + throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @NoAdminRequired |
|
| 108 | + * |
|
| 109 | + * @param string $messageId |
|
| 110 | + * @param int|null $clearAt |
|
| 111 | + * @return DataResponse |
|
| 112 | + * @throws OCSBadRequestException |
|
| 113 | + */ |
|
| 114 | + public function setPredefinedMessage(string $messageId, |
|
| 115 | + ?int $clearAt): DataResponse { |
|
| 116 | + try { |
|
| 117 | + $status = $this->service->setPredefinedMessage($this->userId, $messageId, $clearAt); |
|
| 118 | + return new DataResponse($this->formatStatus($status)); |
|
| 119 | + } catch (InvalidClearAtException $ex) { |
|
| 120 | + $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); |
|
| 121 | + throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 122 | + } catch (InvalidMessageIdException $ex) { |
|
| 123 | + $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid message-id "' . $messageId . '"'); |
|
| 124 | + throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * @NoAdminRequired |
|
| 130 | + * |
|
| 131 | + * @param string|null $statusIcon |
|
| 132 | + * @param string $message |
|
| 133 | + * @param int|null $clearAt |
|
| 134 | + * @return DataResponse |
|
| 135 | + * @throws OCSBadRequestException |
|
| 136 | + */ |
|
| 137 | + public function setCustomMessage(?string $statusIcon, |
|
| 138 | + string $message, |
|
| 139 | + ?int $clearAt): DataResponse { |
|
| 140 | + try { |
|
| 141 | + $status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt); |
|
| 142 | + return new DataResponse($this->formatStatus($status)); |
|
| 143 | + } catch (InvalidClearAtException $ex) { |
|
| 144 | + $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); |
|
| 145 | + throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 146 | + } catch (InvalidStatusIconException $ex) { |
|
| 147 | + $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid icon value "' . $statusIcon . '"'); |
|
| 148 | + throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 149 | + } catch (StatusMessageTooLongException $ex) { |
|
| 150 | + $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to a too long status message.'); |
|
| 151 | + throw new OCSBadRequestException($ex->getMessage(), $ex); |
|
| 152 | + } |
|
| 153 | + } |
|
| 154 | + |
|
| 155 | + /** |
|
| 156 | + * @NoAdminRequired |
|
| 157 | + * |
|
| 158 | + * @return DataResponse |
|
| 159 | + */ |
|
| 160 | + public function clearStatus(): DataResponse { |
|
| 161 | + $this->service->clearStatus($this->userId); |
|
| 162 | + return new DataResponse([]); |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * @NoAdminRequired |
|
| 167 | + * |
|
| 168 | + * @return DataResponse |
|
| 169 | + */ |
|
| 170 | + public function clearMessage(): DataResponse { |
|
| 171 | + $this->service->clearMessage($this->userId); |
|
| 172 | + return new DataResponse([]); |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + /** |
|
| 176 | + * @param UserStatus $status |
|
| 177 | + * @return array |
|
| 178 | + */ |
|
| 179 | + private function formatStatus(UserStatus $status): array { |
|
| 180 | + return [ |
|
| 181 | + 'userId' => $status->getUserId(), |
|
| 182 | + 'message' => $status->getCustomMessage(), |
|
| 183 | + 'messageId' => $status->getMessageId(), |
|
| 184 | + 'messageIsPredefined' => $status->getMessageId() !== null, |
|
| 185 | + 'icon' => $status->getCustomIcon(), |
|
| 186 | + 'clearAt' => $status->getClearAt(), |
|
| 187 | + 'status' => $status->getStatus(), |
|
| 188 | + 'statusIsUserDefined' => $status->getIsUserDefined(), |
|
| 189 | + ]; |
|
| 190 | + } |
|
| 191 | 191 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $status = $this->service->setStatus($this->userId, $statusType, null, true); |
| 99 | 99 | return new DataResponse($this->formatStatus($status)); |
| 100 | 100 | } catch (InvalidStatusTypeException $ex) { |
| 101 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid status type "' . $statusType . '"'); |
|
| 101 | + $this->logger->debug('New user-status for "'.$this->userId.'" was rejected due to an invalid status type "'.$statusType.'"'); |
|
| 102 | 102 | throw new OCSBadRequestException($ex->getMessage(), $ex); |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -117,10 +117,10 @@ discard block |
||
| 117 | 117 | $status = $this->service->setPredefinedMessage($this->userId, $messageId, $clearAt); |
| 118 | 118 | return new DataResponse($this->formatStatus($status)); |
| 119 | 119 | } catch (InvalidClearAtException $ex) { |
| 120 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); |
|
| 120 | + $this->logger->debug('New user-status for "'.$this->userId.'" was rejected due to an invalid clearAt value "'.$clearAt.'"'); |
|
| 121 | 121 | throw new OCSBadRequestException($ex->getMessage(), $ex); |
| 122 | 122 | } catch (InvalidMessageIdException $ex) { |
| 123 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid message-id "' . $messageId . '"'); |
|
| 123 | + $this->logger->debug('New user-status for "'.$this->userId.'" was rejected due to an invalid message-id "'.$messageId.'"'); |
|
| 124 | 124 | throw new OCSBadRequestException($ex->getMessage(), $ex); |
| 125 | 125 | } |
| 126 | 126 | } |
@@ -141,13 +141,13 @@ discard block |
||
| 141 | 141 | $status = $this->service->setCustomMessage($this->userId, $statusIcon, $message, $clearAt); |
| 142 | 142 | return new DataResponse($this->formatStatus($status)); |
| 143 | 143 | } catch (InvalidClearAtException $ex) { |
| 144 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid clearAt value "' . $clearAt . '"'); |
|
| 144 | + $this->logger->debug('New user-status for "'.$this->userId.'" was rejected due to an invalid clearAt value "'.$clearAt.'"'); |
|
| 145 | 145 | throw new OCSBadRequestException($ex->getMessage(), $ex); |
| 146 | 146 | } catch (InvalidStatusIconException $ex) { |
| 147 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to an invalid icon value "' . $statusIcon . '"'); |
|
| 147 | + $this->logger->debug('New user-status for "'.$this->userId.'" was rejected due to an invalid icon value "'.$statusIcon.'"'); |
|
| 148 | 148 | throw new OCSBadRequestException($ex->getMessage(), $ex); |
| 149 | 149 | } catch (StatusMessageTooLongException $ex) { |
| 150 | - $this->logger->debug('New user-status for "' . $this->userId . '" was rejected due to a too long status message.'); |
|
| 150 | + $this->logger->debug('New user-status for "'.$this->userId.'" was rejected due to a too long status message.'); |
|
| 151 | 151 | throw new OCSBadRequestException($ex->getMessage(), $ex); |
| 152 | 152 | } |
| 153 | 153 | } |
@@ -34,42 +34,42 @@ |
||
| 34 | 34 | |
| 35 | 35 | class BeforeTemplateRenderedListener implements IEventListener { |
| 36 | 36 | |
| 37 | - /** @var IInitialStateService */ |
|
| 38 | - private $initialState; |
|
| 37 | + /** @var IInitialStateService */ |
|
| 38 | + private $initialState; |
|
| 39 | 39 | |
| 40 | - /** @var JSDataService */ |
|
| 41 | - private $jsDataService; |
|
| 40 | + /** @var JSDataService */ |
|
| 41 | + private $jsDataService; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * BeforeTemplateRenderedListener constructor. |
|
| 45 | - * |
|
| 46 | - * @param IInitialStateService $initialState |
|
| 47 | - * @param JSDataService $jsDataService |
|
| 48 | - */ |
|
| 49 | - public function __construct(IInitialStateService $initialState, |
|
| 50 | - JSDataService $jsDataService) { |
|
| 51 | - $this->initialState = $initialState; |
|
| 52 | - $this->jsDataService = $jsDataService; |
|
| 53 | - } |
|
| 43 | + /** |
|
| 44 | + * BeforeTemplateRenderedListener constructor. |
|
| 45 | + * |
|
| 46 | + * @param IInitialStateService $initialState |
|
| 47 | + * @param JSDataService $jsDataService |
|
| 48 | + */ |
|
| 49 | + public function __construct(IInitialStateService $initialState, |
|
| 50 | + JSDataService $jsDataService) { |
|
| 51 | + $this->initialState = $initialState; |
|
| 52 | + $this->jsDataService = $jsDataService; |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @inheritDoc |
|
| 57 | - */ |
|
| 58 | - public function handle(Event $event): void { |
|
| 59 | - if (!($event instanceof BeforeTemplateRenderedEvent)) { |
|
| 60 | - // Unrelated |
|
| 61 | - return; |
|
| 62 | - } |
|
| 55 | + /** |
|
| 56 | + * @inheritDoc |
|
| 57 | + */ |
|
| 58 | + public function handle(Event $event): void { |
|
| 59 | + if (!($event instanceof BeforeTemplateRenderedEvent)) { |
|
| 60 | + // Unrelated |
|
| 61 | + return; |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - if (!$event->isLoggedIn()) { |
|
| 65 | - return; |
|
| 66 | - } |
|
| 64 | + if (!$event->isLoggedIn()) { |
|
| 65 | + return; |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $this->initialState->provideLazyInitialState(Application::APP_ID, 'status', function () { |
|
| 69 | - return $this->jsDataService; |
|
| 70 | - }); |
|
| 68 | + $this->initialState->provideLazyInitialState(Application::APP_ID, 'status', function () { |
|
| 69 | + return $this->jsDataService; |
|
| 70 | + }); |
|
| 71 | 71 | |
| 72 | - \OCP\Util::addScript('user_status', 'user-status-menu'); |
|
| 73 | - \OCP\Util::addStyle('user_status', 'user-status-menu'); |
|
| 74 | - } |
|
| 72 | + \OCP\Util::addScript('user_status', 'user-status-menu'); |
|
| 73 | + \OCP\Util::addStyle('user_status', 'user-status-menu'); |
|
| 74 | + } |
|
| 75 | 75 | } |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | return; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $this->initialState->provideLazyInitialState(Application::APP_ID, 'status', function () { |
|
| 68 | + $this->initialState->provideLazyInitialState(Application::APP_ID, 'status', function() { |
|
| 69 | 69 | return $this->jsDataService; |
| 70 | 70 | }); |
| 71 | 71 | |
@@ -40,94 +40,94 @@ |
||
| 40 | 40 | */ |
| 41 | 41 | class UserLiveStatusListener implements IEventListener { |
| 42 | 42 | |
| 43 | - /** @var UserStatusMapper */ |
|
| 44 | - private $mapper; |
|
| 45 | - |
|
| 46 | - /** @var ITimeFactory */ |
|
| 47 | - private $timeFactory; |
|
| 48 | - |
|
| 49 | - /** @var string[] */ |
|
| 50 | - private $priorityOrderedStatuses = [ |
|
| 51 | - 'online', |
|
| 52 | - 'away', |
|
| 53 | - 'dnd', |
|
| 54 | - 'invisible', |
|
| 55 | - 'offline' |
|
| 56 | - ]; |
|
| 57 | - |
|
| 58 | - /** @var string[] */ |
|
| 59 | - private $persistentUserStatuses = [ |
|
| 60 | - 'away', |
|
| 61 | - 'dnd', |
|
| 62 | - 'invisible', |
|
| 63 | - ]; |
|
| 64 | - |
|
| 65 | - /** @var int */ |
|
| 66 | - private $offlineThreshold = 300; |
|
| 67 | - |
|
| 68 | - /** |
|
| 69 | - * UserLiveStatusListener constructor. |
|
| 70 | - * |
|
| 71 | - * @param UserStatusMapper $mapper |
|
| 72 | - * @param ITimeFactory $timeFactory |
|
| 73 | - */ |
|
| 74 | - public function __construct(UserStatusMapper $mapper, |
|
| 75 | - ITimeFactory $timeFactory) { |
|
| 76 | - $this->mapper = $mapper; |
|
| 77 | - $this->timeFactory = $timeFactory; |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * @inheritDoc |
|
| 82 | - */ |
|
| 83 | - public function handle(Event $event): void { |
|
| 84 | - if (!($event instanceof UserLiveStatusEvent)) { |
|
| 85 | - // Unrelated |
|
| 86 | - return; |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $user = $event->getUser(); |
|
| 90 | - try { |
|
| 91 | - $userStatus = $this->mapper->findByUserId($user->getUID()); |
|
| 92 | - } catch (DoesNotExistException $ex) { |
|
| 93 | - $userStatus = new UserStatus(); |
|
| 94 | - $userStatus->setUserId($user->getUID()); |
|
| 95 | - $userStatus->setStatus('offline'); |
|
| 96 | - $userStatus->setStatusTimestamp(0); |
|
| 97 | - $userStatus->setIsUserDefined(false); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // If the status is user-defined and one of the persistent statuses, we |
|
| 101 | - // will not override it. |
|
| 102 | - if ($userStatus->getIsUserDefined() && |
|
| 103 | - \in_array($userStatus->getStatus(), $this->persistentUserStatuses, true)) { |
|
| 104 | - return; |
|
| 105 | - } |
|
| 106 | - |
|
| 107 | - $needsUpdate = false; |
|
| 108 | - |
|
| 109 | - // If the current status is older than 5 minutes, |
|
| 110 | - // treat it as outdated and update |
|
| 111 | - if ($userStatus->getStatusTimestamp() < ($this->timeFactory->getTime() - $this->offlineThreshold)) { |
|
| 112 | - $needsUpdate = true; |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // If the emitted status is more important than the current status |
|
| 116 | - // treat it as outdated and update |
|
| 117 | - if (array_search($event->getStatus(), $this->priorityOrderedStatuses) < array_search($userStatus->getStatus(), $this->priorityOrderedStatuses)) { |
|
| 118 | - $needsUpdate = true; |
|
| 119 | - } |
|
| 120 | - |
|
| 121 | - if ($needsUpdate) { |
|
| 122 | - $userStatus->setStatus($event->getStatus()); |
|
| 123 | - $userStatus->setStatusTimestamp($event->getTimestamp()); |
|
| 124 | - $userStatus->setIsUserDefined(false); |
|
| 125 | - |
|
| 126 | - if ($userStatus->getId() === null) { |
|
| 127 | - $this->mapper->insert($userStatus); |
|
| 128 | - } else { |
|
| 129 | - $this->mapper->update($userStatus); |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - } |
|
| 43 | + /** @var UserStatusMapper */ |
|
| 44 | + private $mapper; |
|
| 45 | + |
|
| 46 | + /** @var ITimeFactory */ |
|
| 47 | + private $timeFactory; |
|
| 48 | + |
|
| 49 | + /** @var string[] */ |
|
| 50 | + private $priorityOrderedStatuses = [ |
|
| 51 | + 'online', |
|
| 52 | + 'away', |
|
| 53 | + 'dnd', |
|
| 54 | + 'invisible', |
|
| 55 | + 'offline' |
|
| 56 | + ]; |
|
| 57 | + |
|
| 58 | + /** @var string[] */ |
|
| 59 | + private $persistentUserStatuses = [ |
|
| 60 | + 'away', |
|
| 61 | + 'dnd', |
|
| 62 | + 'invisible', |
|
| 63 | + ]; |
|
| 64 | + |
|
| 65 | + /** @var int */ |
|
| 66 | + private $offlineThreshold = 300; |
|
| 67 | + |
|
| 68 | + /** |
|
| 69 | + * UserLiveStatusListener constructor. |
|
| 70 | + * |
|
| 71 | + * @param UserStatusMapper $mapper |
|
| 72 | + * @param ITimeFactory $timeFactory |
|
| 73 | + */ |
|
| 74 | + public function __construct(UserStatusMapper $mapper, |
|
| 75 | + ITimeFactory $timeFactory) { |
|
| 76 | + $this->mapper = $mapper; |
|
| 77 | + $this->timeFactory = $timeFactory; |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * @inheritDoc |
|
| 82 | + */ |
|
| 83 | + public function handle(Event $event): void { |
|
| 84 | + if (!($event instanceof UserLiveStatusEvent)) { |
|
| 85 | + // Unrelated |
|
| 86 | + return; |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $user = $event->getUser(); |
|
| 90 | + try { |
|
| 91 | + $userStatus = $this->mapper->findByUserId($user->getUID()); |
|
| 92 | + } catch (DoesNotExistException $ex) { |
|
| 93 | + $userStatus = new UserStatus(); |
|
| 94 | + $userStatus->setUserId($user->getUID()); |
|
| 95 | + $userStatus->setStatus('offline'); |
|
| 96 | + $userStatus->setStatusTimestamp(0); |
|
| 97 | + $userStatus->setIsUserDefined(false); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // If the status is user-defined and one of the persistent statuses, we |
|
| 101 | + // will not override it. |
|
| 102 | + if ($userStatus->getIsUserDefined() && |
|
| 103 | + \in_array($userStatus->getStatus(), $this->persistentUserStatuses, true)) { |
|
| 104 | + return; |
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + $needsUpdate = false; |
|
| 108 | + |
|
| 109 | + // If the current status is older than 5 minutes, |
|
| 110 | + // treat it as outdated and update |
|
| 111 | + if ($userStatus->getStatusTimestamp() < ($this->timeFactory->getTime() - $this->offlineThreshold)) { |
|
| 112 | + $needsUpdate = true; |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // If the emitted status is more important than the current status |
|
| 116 | + // treat it as outdated and update |
|
| 117 | + if (array_search($event->getStatus(), $this->priorityOrderedStatuses) < array_search($userStatus->getStatus(), $this->priorityOrderedStatuses)) { |
|
| 118 | + $needsUpdate = true; |
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + if ($needsUpdate) { |
|
| 122 | + $userStatus->setStatus($event->getStatus()); |
|
| 123 | + $userStatus->setStatusTimestamp($event->getTimestamp()); |
|
| 124 | + $userStatus->setIsUserDefined(false); |
|
| 125 | + |
|
| 126 | + if ($userStatus->getId() === null) { |
|
| 127 | + $this->mapper->insert($userStatus); |
|
| 128 | + } else { |
|
| 129 | + $this->mapper->update($userStatus); |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + } |
|
| 133 | 133 | } |
@@ -37,29 +37,29 @@ |
||
| 37 | 37 | */ |
| 38 | 38 | class UserDeletedListener implements IEventListener { |
| 39 | 39 | |
| 40 | - /** @var StatusService */ |
|
| 41 | - private $service; |
|
| 40 | + /** @var StatusService */ |
|
| 41 | + private $service; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * UserDeletedListener constructor. |
|
| 45 | - * |
|
| 46 | - * @param StatusService $service |
|
| 47 | - */ |
|
| 48 | - public function __construct(StatusService $service) { |
|
| 49 | - $this->service = $service; |
|
| 50 | - } |
|
| 43 | + /** |
|
| 44 | + * UserDeletedListener constructor. |
|
| 45 | + * |
|
| 46 | + * @param StatusService $service |
|
| 47 | + */ |
|
| 48 | + public function __construct(StatusService $service) { |
|
| 49 | + $this->service = $service; |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * @inheritDoc |
|
| 55 | - */ |
|
| 56 | - public function handle(Event $event): void { |
|
| 57 | - if (!($event instanceof UserDeletedEvent)) { |
|
| 58 | - // Unrelated |
|
| 59 | - return; |
|
| 60 | - } |
|
| 53 | + /** |
|
| 54 | + * @inheritDoc |
|
| 55 | + */ |
|
| 56 | + public function handle(Event $event): void { |
|
| 57 | + if (!($event instanceof UserDeletedEvent)) { |
|
| 58 | + // Unrelated |
|
| 59 | + return; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - $user = $event->getUser(); |
|
| 63 | - $this->service->removeUserStatus($user->getUID()); |
|
| 64 | - } |
|
| 62 | + $user = $event->getUser(); |
|
| 63 | + $this->service->removeUserStatus($user->getUID()); |
|
| 64 | + } |
|
| 65 | 65 | } |
@@ -24,20 +24,20 @@ |
||
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | 26 | return [ |
| 27 | - 'ocs' => [ |
|
| 28 | - // Routes for querying statuses |
|
| 29 | - ['name' => 'Statuses#findAll', 'url' => '/api/v1/statuses', 'verb' => 'GET'], |
|
| 30 | - ['name' => 'Statuses#find', 'url' => '/api/v1/statuses/{userId}', 'verb' => 'GET'], |
|
| 31 | - // Routes for manipulating your own status |
|
| 32 | - ['name' => 'UserStatus#getStatus', 'url' => '/api/v1/user_status', 'verb' => 'GET'], |
|
| 33 | - ['name' => 'UserStatus#setStatus', 'url' => '/api/v1/user_status/status', 'verb' => 'PUT'], |
|
| 34 | - ['name' => 'UserStatus#setPredefinedMessage', 'url' => '/api/v1/user_status/message/predefined', 'verb' => 'PUT'], |
|
| 35 | - ['name' => 'UserStatus#setCustomMessage', 'url' => '/api/v1/user_status/message/custom', 'verb' => 'PUT'], |
|
| 36 | - ['name' => 'UserStatus#clearMessage', 'url' => '/api/v1/user_status/message', 'verb' => 'DELETE'], |
|
| 37 | - // Routes for listing default routes |
|
| 38 | - ['name' => 'PredefinedStatus#findAll', 'url' => '/api/v1/predefined_statuses/', 'verb' => 'GET'] |
|
| 39 | - ], |
|
| 40 | - 'routes' => [ |
|
| 41 | - ['name' => 'Heartbeat#heartbeat', 'url' => '/heartbeat', 'verb' => 'PUT'], |
|
| 42 | - ], |
|
| 27 | + 'ocs' => [ |
|
| 28 | + // Routes for querying statuses |
|
| 29 | + ['name' => 'Statuses#findAll', 'url' => '/api/v1/statuses', 'verb' => 'GET'], |
|
| 30 | + ['name' => 'Statuses#find', 'url' => '/api/v1/statuses/{userId}', 'verb' => 'GET'], |
|
| 31 | + // Routes for manipulating your own status |
|
| 32 | + ['name' => 'UserStatus#getStatus', 'url' => '/api/v1/user_status', 'verb' => 'GET'], |
|
| 33 | + ['name' => 'UserStatus#setStatus', 'url' => '/api/v1/user_status/status', 'verb' => 'PUT'], |
|
| 34 | + ['name' => 'UserStatus#setPredefinedMessage', 'url' => '/api/v1/user_status/message/predefined', 'verb' => 'PUT'], |
|
| 35 | + ['name' => 'UserStatus#setCustomMessage', 'url' => '/api/v1/user_status/message/custom', 'verb' => 'PUT'], |
|
| 36 | + ['name' => 'UserStatus#clearMessage', 'url' => '/api/v1/user_status/message', 'verb' => 'DELETE'], |
|
| 37 | + // Routes for listing default routes |
|
| 38 | + ['name' => 'PredefinedStatus#findAll', 'url' => '/api/v1/predefined_statuses/', 'verb' => 'GET'] |
|
| 39 | + ], |
|
| 40 | + 'routes' => [ |
|
| 41 | + ['name' => 'Heartbeat#heartbeat', 'url' => '/heartbeat', 'verb' => 'PUT'], |
|
| 42 | + ], |
|
| 43 | 43 | ]; |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | // autoload.php @generated by Composer |
| 4 | 4 | |
| 5 | -require_once __DIR__ . '/composer/autoload_real.php'; |
|
| 5 | +require_once __DIR__.'/composer/autoload_real.php'; |
|
| 6 | 6 | |
| 7 | 7 | return ComposerAutoloaderInitUserStatus::getLoader(); |