$amount Number of breakout rooms - Constants {@see BreakoutRoom::MINIMUM_ROOM_AMOUNT} and {@see BreakoutRoom::MAXIMUM_ROOM_AMOUNT} * @param string $attendeeMap Mapping of the attendees to breakout rooms * @return DataResponse, array{}>|DataResponse * * 200: Breakout rooms configured successfully * 400: Configuring breakout rooms errored */ #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function configureBreakoutRooms(int $mode, int $amount, string $attendeeMap = '[]'): DataResponse { try { $rooms = $this->breakoutRoomService->setupBreakoutRooms($this->room, $mode, $amount, $attendeeMap); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } $rooms[] = $this->room; return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } /** * Remove the breakout rooms * * @return DataResponse * * 200: Breakout rooms removed successfully */ #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function removeBreakoutRooms(): DataResponse { $this->breakoutRoomService->removeBreakoutRooms($this->room); return new DataResponse($this->roomFormatter->formatRoom( $this->getResponseFormat(), [], $this->room, $this->participant, )); } /** * Broadcast a chat message to all breakout rooms * * @param string $message Message to broadcast * @return DataResponse, array{}>|DataResponse * * 201: Chat message broadcasted successfully * 400: Broadcasting chat message is not possible * 413: Chat message too long */ #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function broadcastChatMessage(string $message): DataResponse { try { $rooms = $this->breakoutRoomService->broadcastChatMessage($this->room, $this->participant, $message); } catch (MessageTooLongException $e) { return new DataResponse(['error' => 'message'], Http::STATUS_REQUEST_ENTITY_TOO_LARGE); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } $rooms[] = $this->room; return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_CREATED); } /** * Apply an attendee map to the breakout rooms * * @param string $attendeeMap JSON encoded mapping of the attendees to breakout rooms `array` * @return DataResponse, array{}>|DataResponse * * 200: Attendee map applied successfully * 400: Applying attendee map is not possible */ #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function applyAttendeeMap(string $attendeeMap): DataResponse { try { $rooms = $this->breakoutRoomService->applyAttendeeMap($this->room, $attendeeMap); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } $rooms[] = $this->room; return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } /** * Request assistance * * @return DataResponse|DataResponse * * 200: Assistance requested successfully * 400: Requesting assistance is not possible */ #[NoAdminRequired] #[RequireLoggedInParticipant] public function requestAssistance(): DataResponse { try { $this->breakoutRoomService->requestAssistance($this->room); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } return new DataResponse($this->roomFormatter->formatRoom( $this->getResponseFormat(), [], $this->room, $this->participant, )); } /** * Reset the request for assistance * * @return DataResponse|DataResponse * * 200: Request for assistance reset successfully * 400: Resetting the request for assistance is not possible */ #[NoAdminRequired] #[RequireLoggedInParticipant] public function resetRequestForAssistance(): DataResponse { try { $this->breakoutRoomService->resetRequestForAssistance($this->room); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } return new DataResponse($this->roomFormatter->formatRoom( $this->getResponseFormat(), [], $this->room, $this->participant, )); } /** * Start the breakout rooms * * @return DataResponse, array{}>|DataResponse * * 200: Breakout rooms started successfully * 400: Starting breakout rooms is not possible */ #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function startBreakoutRooms(): DataResponse { try { $rooms = $this->breakoutRoomService->startBreakoutRooms($this->room); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } $rooms[] = $this->room; return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } /** * Stop the breakout rooms * * @return DataResponse, array{}>|DataResponse * * 200: Breakout rooms stopped successfully * 400: Stopping breakout rooms is not possible */ #[NoAdminRequired] #[RequireLoggedInModeratorParticipant] public function stopBreakoutRooms(): DataResponse { try { $rooms = $this->breakoutRoomService->stopBreakoutRooms($this->room); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } $rooms[] = $this->room; return new DataResponse($this->formatMultipleRooms($rooms), Http::STATUS_OK); } /** * Switch to another breakout room * * @param string $target Target breakout room * @return DataResponse|DataResponse * * 200: Switched to breakout room successfully * 400: Switching to breakout room is not possible */ #[NoAdminRequired] #[RequireLoggedInParticipant] public function switchBreakoutRoom(string $target): DataResponse { try { $room = $this->breakoutRoomService->switchBreakoutRoom($this->room, $this->participant, $target); } catch (InvalidArgumentException $e) { return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST); } return new DataResponse($this->roomFormatter->formatRoom( $this->getResponseFormat(), [], $room, $this->participant, )); } /** * @return list */ protected function formatMultipleRooms(array $rooms): array { $return = []; foreach ($rooms as $room) { try { $return[] = $this->roomFormatter->formatRoom( $this->getResponseFormat(), [], $room, $this->participantService->getParticipant($room, $this->userId), [], false, true ); } catch (ParticipantNotFoundException $e) { } } return $return; } }