diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php index fc145c8858d..a43712a88dc 100644 --- a/lib/Chat/ChatManager.php +++ b/lib/Chat/ChatManager.php @@ -84,6 +84,9 @@ class ChatManager { public const VERB_MESSAGE_DELETED = 'comment_deleted'; public const VERB_REACTION = 'reaction'; public const VERB_REACTION_DELETED = 'reaction_deleted'; + public const VERB_VOICE_MESSAGE = 'voice-message'; + public const VERB_RECORD_AUDIO = 'record-audio'; + public const VERB_RECORD_VIDEO = 'record-video'; protected ICache $cache; protected ICache $unreadCountCache; @@ -113,6 +116,7 @@ public function __construct( /** * Sends a new message to the given chat. * + * @psalm-param Attendee::ACTOR_* $actorType * @param bool $shouldSkipLastMessageUpdate If multiple messages will be posted * (e.g. when adding multiple users to a room) we can skip the last * message and last activity update until the last entry was created diff --git a/lib/Chat/CommentsManager.php b/lib/Chat/CommentsManager.php index 4080632d5b3..c79b4822828 100644 --- a/lib/Chat/CommentsManager.php +++ b/lib/Chat/CommentsManager.php @@ -25,6 +25,7 @@ use OC\Comments\Comment; use OC\Comments\Manager; +use OCA\Talk\Model\Attendee; use OCP\Comments\IComment; use OCP\DB\Exception; use OCP\DB\QueryBuilder\IQueryBuilder; @@ -66,7 +67,7 @@ public function getCommentsById(array $ids): array { } /** - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @param string[] $messageIds * @return array @@ -100,6 +101,7 @@ public function retrieveReactionsByActor(string $actorType, string $actorId, arr * @param string $objectType Limit the search by object type * @param string[] $objectIds Limit the search by object ids * @param string $verb Limit the verb of the comment + * @psalm-param ?Attendee::ACTOR_* $actorType * @return list */ public function searchForObjectsWithFilters(string $search, string $objectType, array $objectIds, string $verb, ?\DateTimeImmutable $since, ?\DateTimeImmutable $until, ?string $actorType, ?string $actorId, int $offset, int $limit = 50): array { diff --git a/lib/Chat/MessageParser.php b/lib/Chat/MessageParser.php index 77e42316a9b..9d539d4adb6 100644 --- a/lib/Chat/MessageParser.php +++ b/lib/Chat/MessageParser.php @@ -112,6 +112,9 @@ protected function setLastEditInfo(Message $message): void { } } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ protected function getActorInformation(Message $message, string $actorType, string $actorId, string $displayName = ''): array { if ($actorType === Attendee::ACTOR_USERS) { $tempDisplayName = $this->userManager->getDisplayName($actorId); diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php index d7f48e61106..869fc406353 100644 --- a/lib/Chat/Parser/SystemMessage.php +++ b/lib/Chat/Parser/SystemMessage.php @@ -490,11 +490,11 @@ protected function parseMessage(Message $chatMessage): void { $metaData = $parameters['metaData'] ?? []; if (isset($metaData['messageType'])) { if ($metaData['messageType'] === 'voice-message') { - $chatMessage->setMessageType('voice-message'); + $chatMessage->setMessageType(ChatManager::VERB_VOICE_MESSAGE); } elseif ($metaData['messageType'] === 'record-audio') { - $chatMessage->setMessageType('record-audio'); + $chatMessage->setMessageType(ChatManager::VERB_RECORD_AUDIO); } elseif ($metaData['messageType'] === 'record-video') { - $chatMessage->setMessageType('record-video'); + $chatMessage->setMessageType(ChatManager::VERB_RECORD_VIDEO); } else { $chatMessage->setMessageType(ChatManager::VERB_MESSAGE); } @@ -843,6 +843,9 @@ protected function getActorFromComment(Room $room, IComment $comment): array { return $this->getActor($room, $comment->getActorType(), $comment->getActorId()); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ protected function getActor(Room $room, string $actorType, string $actorId): array { if ($actorType === Attendee::ACTOR_GUESTS || $actorType === Attendee::ACTOR_EMAILS) { return $this->getGuest($room, $actorType, $actorId); diff --git a/lib/Chat/ReactionManager.php b/lib/Chat/ReactionManager.php index b1f174b6e8e..c439f82e4e3 100644 --- a/lib/Chat/ReactionManager.php +++ b/lib/Chat/ReactionManager.php @@ -28,6 +28,7 @@ use OCA\Talk\Exceptions\ReactionAlreadyExistsException; use OCA\Talk\Exceptions\ReactionNotSupportedException; use OCA\Talk\Exceptions\ReactionOutOfContextException; +use OCA\Talk\Model\Attendee; use OCA\Talk\Participant; use OCA\Talk\ResponseDefinitions; use OCA\Talk\Room; @@ -56,7 +57,7 @@ public function __construct( * Add reaction * * @param Room $chat - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @param integer $messageId * @param string $reaction @@ -99,7 +100,7 @@ public function addReactionMessage(Room $chat, string $actorType, string $actorI * Delete reaction * * @param Room $chat - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @param integer $messageId * @param string $reaction @@ -159,8 +160,10 @@ public function retrieveReactionMessages(Room $chat, Participant $participant, i $message = $this->messageParser->createMessage($chat, $participant, $comment, $this->l); $this->messageParser->parseMessage($message); + /** @var Attendee::ACTOR_* $actorType */ + $actorType = $comment->getActorType(); $reactions[$comment->getMessage()][] = [ - 'actorType' => $comment->getActorType(), + 'actorType' => $actorType, 'actorId' => $comment->getActorId(), 'actorDisplayName' => $message->getActorDisplayName(), 'timestamp' => $comment->getCreationDateTime()->getTimestamp(), diff --git a/lib/Listener/DisplayNameListener.php b/lib/Listener/DisplayNameListener.php index 4ab79cb5359..67fa61fee76 100644 --- a/lib/Listener/DisplayNameListener.php +++ b/lib/Listener/DisplayNameListener.php @@ -51,6 +51,9 @@ public function handle(Event $event): void { } } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ protected function updateCachedName(string $actorType, string $actorId, string $newName): void { $this->participantService->updateDisplayNameForActor( $actorType, diff --git a/lib/Manager.php b/lib/Manager.php index a3ff4435722..8291e41e242 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -318,7 +318,7 @@ public function getRoomsForUser(string $userId, array $sessionIds = [], bool $in } /** - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @param array $sessionIds A list of talk sessions to consider for loading (otherwise no session is loaded) * @param bool $includeLastMessage diff --git a/lib/Model/Attachment.php b/lib/Model/Attachment.php index 91aaf2fa24f..04b2fde9d2a 100644 --- a/lib/Model/Attachment.php +++ b/lib/Model/Attachment.php @@ -34,8 +34,6 @@ * @method int getMessageTime() * @method void setObjectType(string $objectType) * @method string getObjectType() - * @method void setActorType(string $actorType) - * @method string getActorType() * @method void setActorId(string $actorId) * @method string getActorId() */ @@ -62,7 +60,10 @@ class Attachment extends Entity { /** @var string */ protected $objectType; - /** @var string */ + /** + * @var string + * @psalm-var Attendee::ACTOR_* + */ protected $actorType; /** @var string */ @@ -77,6 +78,20 @@ public function __construct() { $this->addType('actorId', 'string'); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ + public function setActorType(string $actorType): void { + $this->actorType = $actorType; + } + + /** + * @psalm-return Attendee::ACTOR_* + */ + public function getActorType(): string { + return $this->actorType; + } + /** * @return array */ diff --git a/lib/Model/Attendee.php b/lib/Model/Attendee.php index 8d7ed05788f..f81de9461f7 100644 --- a/lib/Model/Attendee.php +++ b/lib/Model/Attendee.php @@ -28,8 +28,6 @@ /** * @method void setRoomId(int $roomId) * @method int getRoomId() - * @method void setActorType(string $actorType) - * @method string getActorType() * @method void setActorId(string $actorId) * @method string getActorId() * @method void setDisplayName(string $displayName) @@ -111,7 +109,10 @@ class Attendee extends Entity { /** @var int */ protected $roomId; - /** @var string */ + /** + * @var string + * @psalm-var Attendee::ACTOR_* + */ protected $actorType; /** @var string */ @@ -191,6 +192,20 @@ public function __construct() { $this->addType('callId', 'string'); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ + public function setActorType(string $actorType): void { + $this->actorType = $actorType; + } + + /** + * @psalm-return Attendee::ACTOR_* + */ + public function getActorType(): string { + return $this->actorType; + } + public function getDisplayName(): string { return (string) $this->displayName; } diff --git a/lib/Model/AttendeeMapper.php b/lib/Model/AttendeeMapper.php index 268f5eab9f6..3a30714c383 100644 --- a/lib/Model/AttendeeMapper.php +++ b/lib/Model/AttendeeMapper.php @@ -46,7 +46,7 @@ public function __construct(IDBConnection $db) { /** * @param int $roomId - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @return Attendee * @throws DoesNotExistException diff --git a/lib/Model/Consent.php b/lib/Model/Consent.php index eef91bceac9..29b5bb45a30 100644 --- a/lib/Model/Consent.php +++ b/lib/Model/Consent.php @@ -30,8 +30,6 @@ /** * @method void setToken(string $token) * @method string getToken() - * @method void setActorType(string $actorType) - * @method string getActorType() * @method void setActorId(string $actorId) * @method string getActorId() * @method void setDateTime(\DateTime $dateTime) @@ -39,7 +37,10 @@ */ class Consent extends Entity implements \JsonSerializable { protected string $token = ''; - protected string $actorType = ''; + /** + * @psalm-var Attendee::ACTOR_* + */ + protected string $actorType; protected string $actorId = ''; protected ?\DateTime $dateTime = null; @@ -50,6 +51,20 @@ public function __construct() { $this->addType('dateTime', 'datetime'); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ + public function setActorType(string $actorType): void { + $this->actorType = $actorType; + } + + /** + * @psalm-return Attendee::ACTOR_* + */ + public function getActorType(): string { + return $this->actorType; + } + public function jsonSerialize(): array { return [ 'token' => $this->getToken(), diff --git a/lib/Model/ConsentMapper.php b/lib/Model/ConsentMapper.php index 7f9f134cabd..863a9b3db3c 100644 --- a/lib/Model/ConsentMapper.php +++ b/lib/Model/ConsentMapper.php @@ -63,6 +63,7 @@ public function deleteByToken(string $token): int { } /** + * @psalm-param Attendee::ACTOR_* $actorType * @return Consent[] */ public function findForActor(string $actorType, string $actorId): array { @@ -75,6 +76,9 @@ public function findForActor(string $actorType, string $actorId): array { return $this->findEntities($query); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ public function deleteByActor(string $actorType, string $actorId): int { $query = $this->db->getQueryBuilder(); $query->delete($this->getTableName()) @@ -85,6 +89,7 @@ public function deleteByActor(string $actorType, string $actorId): int { } /** + * @psalm-param Attendee::ACTOR_* $actorType * @return Consent[] */ public function findForTokenByActor(string $token, string $actorType, string $actorId): array { diff --git a/lib/Model/Message.php b/lib/Model/Message.php index fe11403476c..c06ef07d8de 100644 --- a/lib/Model/Message.php +++ b/lib/Model/Message.php @@ -40,8 +40,11 @@ class Message { /** @var bool */ protected $visible = true; - /** @var string */ - protected $type = ''; + /** + * @var string + * @psalm-var ChatManager::VERB_* + */ + protected $type; /** @var string */ protected $message = ''; @@ -52,8 +55,11 @@ class Message { /** @var array */ protected $parameters = []; - /** @var string */ - protected $actorType = ''; + /** + * @var string + * @psalm-var Attendee::ACTOR_* + */ + protected $actorType; /** @var string */ protected $actorId = ''; @@ -131,14 +137,23 @@ public function getMessageRaw(): string { return $this->rawMessage; } + /** + * @psalm-param ChatManager::VERB_* $type + */ public function setMessageType(string $type): void { $this->type = $type; } + /** + * @return ChatManager::VERB_* $type + */ public function getMessageType(): string { return $this->type; } + /** + * @psalm-param Attendee::ACTOR_* $type + */ public function setActor(string $type, string $id, string $displayName): void { $this->actorType = $type; $this->actorId = $id; @@ -152,6 +167,9 @@ public function setLastEdit(string $type, string $id, string $displayName, int $ $this->lastEditTimestamp = $timestamp; } + /** + * @psalm-return Attendee::ACTOR_* + */ public function getActorType(): string { return $this->actorType; } diff --git a/lib/Model/Poll.php b/lib/Model/Poll.php index c4a1689a004..05f47fbffcc 100644 --- a/lib/Model/Poll.php +++ b/lib/Model/Poll.php @@ -40,8 +40,6 @@ * @method string getVotes() * @method void setNumVoters(int $numVoters) * @method int getNumVoters() - * @method void setActorType(string $actorType) - * @method string getActorType() * @method void setActorId(string $actorId) * @method string getActorId() * @method void setDisplayName(string $displayName) @@ -67,7 +65,10 @@ class Poll extends Entity { protected string $options = ''; protected string $votes = ''; protected int $numVoters = 0; - protected string $actorType = ''; + /** + * @psalm-var Attendee::ACTOR_* + */ + protected string $actorType; protected string $actorId = ''; protected ?string $displayName = null; protected int $status = self::STATUS_OPEN; @@ -88,6 +89,20 @@ public function __construct() { $this->addType('maxVotes', 'int'); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ + public function setActorType(string $actorType): void { + $this->actorType = $actorType; + } + + /** + * @psalm-return Attendee::ACTOR_* + */ + public function getActorType(): string { + return $this->actorType; + } + /** * @return TalkPoll */ diff --git a/lib/Model/ProxyCacheMessages.php b/lib/Model/ProxyCacheMessages.php index 9803f3e2b70..47049fa8910 100644 --- a/lib/Model/ProxyCacheMessages.php +++ b/lib/Model/ProxyCacheMessages.php @@ -26,6 +26,7 @@ namespace OCA\Talk\Model; +use OCA\Talk\Chat\ChatManager; use OCA\Talk\ResponseDefinitions; use OCP\AppFramework\Db\Entity; @@ -38,14 +39,10 @@ * @method string getRemoteToken() * @method void setRemoteMessageId(int $remoteMessageId) * @method int getRemoteMessageId() - * @method void setActorType(string $actorType) - * @method string getActorType() * @method void setActorId(string $actorId) * @method string getActorId() * @method void setActorDisplayName(string $actorDisplayName) * @method string getActorDisplayName() - * @method void setMessageType(string $messageType) - * @method string getMessageType() * @method void setSystemMessage(?string $systemMessage) * @method string|null getSystemMessage() * @method void setExpirationDatetime(?\DateTimeImmutable $expirationDatetime) @@ -63,10 +60,17 @@ class ProxyCacheMessages extends Entity implements \JsonSerializable { protected string $remoteServerUrl = ''; protected string $remoteToken = ''; protected int $remoteMessageId = 0; - protected string $actorType = ''; + /** + * @psalm-var Attendee::ACTOR_* + */ + protected string $actorType; protected string $actorId = ''; protected ?string $actorDisplayName = null; - protected ?string $messageType = null; + /** + * @var string + * @psalm-var ChatManager::VERB_* + */ + protected string $messageType; protected ?string $systemMessage = null; protected ?\DateTimeImmutable $expirationDatetime = null; protected ?string $message = null; @@ -87,6 +91,34 @@ public function __construct() { $this->addType('messageParameters', 'string'); } + /** + * @psalm-param ChatManager::VERB_* $type + */ + public function setMessageType(string $type): void { + $this->messageType = $type; + } + + /** + * @return ChatManager::VERB_* $type + */ + public function getMessageType(): string { + return $this->messageType; + } + + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ + public function setActorType(string $actorType): void { + $this->actorType = $actorType; + } + + /** + * @psalm-return Attendee::ACTOR_* + */ + public function getActorType(): string { + return $this->actorType; + } + /** * @return TalkRoomProxyMessage */ diff --git a/lib/Model/Vote.php b/lib/Model/Vote.php index d2c48480a76..da3e9f5979a 100644 --- a/lib/Model/Vote.php +++ b/lib/Model/Vote.php @@ -35,8 +35,6 @@ * @method int getPollId() * @method void setRoomId(int $roomId) * @method int getRoomId() - * @method void setActorType(string $actorType) - * @method string getActorType() * @method void setActorId(string $actorId) * @method string getActorId() * @method void setDisplayName(string $displayName) @@ -49,7 +47,10 @@ class Vote extends Entity { protected int $pollId = 0; protected int $roomId = 0; - protected string $actorType = ''; + /** + * @psalm-var Attendee::ACTOR_* + */ + protected string $actorType; protected string $actorId = ''; protected ?string $displayName = null; protected ?int $optionId = null; @@ -63,6 +64,20 @@ public function __construct() { $this->addType('optionId', 'int'); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ + public function setActorType(string $actorType): void { + $this->actorType = $actorType; + } + + /** + * @psalm-return Attendee::ACTOR_* + */ + public function getActorType(): string { + return $this->actorType; + } + /** * @return TalkPollVote */ diff --git a/lib/Model/VoteMapper.php b/lib/Model/VoteMapper.php index cc76c381db7..7eb3396ef91 100644 --- a/lib/Model/VoteMapper.php +++ b/lib/Model/VoteMapper.php @@ -56,7 +56,7 @@ public function findByPollId(int $pollId): array { /** * @param int $pollId - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @return Vote[] */ @@ -89,6 +89,9 @@ public function deleteByPollId(int $pollId): void { $query->executeStatement(); } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ public function deleteVotesByActor(int $pollId, string $actorType, string $actorId): void { $query = $this->db->getQueryBuilder(); diff --git a/lib/ResponseDefinitions.php b/lib/ResponseDefinitions.php index 1f257d8224b..dda5dd85b3b 100644 --- a/lib/ResponseDefinitions.php +++ b/lib/ResponseDefinitions.php @@ -47,9 +47,11 @@ * secret: string, * } * + * @psalm-type TalkActorType = 'bot-'|'bots'|'bridged'|'changelog'|'circles'|'cli'|'emails'|'federated_users'|'groups'|'guests'|'phones'|'system'|'users' + * * @psalm-type TalkCallPeer = array{ * actorId: string, - * actorType: string, + * actorType: TalkActorType, * displayName: string, * lastPing: int, * sessionId: string, @@ -67,10 +69,12 @@ * statusMessage: ?string, * } * + * @psalm-type TalkMessageType = 'command'|'comment'|'comment_deleted'|'object_shared'|'reaction'|'reaction_deleted'|'record-audio'|'record-video'|'system'|'voice-message' + * * @psalm-type TalkChatMessage = array{ * actorDisplayName: string, * actorId: string, - * actorType: string, + * actorType: TalkActorType, * deleted?: true, * expirationTimestamp: int, * id: int, @@ -78,7 +82,7 @@ * markdown: bool, * message: string, * messageParameters: array>, - * messageType: string, + * messageType: TalkMessageType, * reactions: array|\stdClass, * referenceId: string, * systemMessage: string, @@ -94,11 +98,11 @@ * @psalm-type TalkRoomProxyMessage = array{ * actorDisplayName: string, * actorId: string, - * actorType: string, + * actorType: TalkActorType, * expirationTimestamp: int, * message: string, * messageParameters: array>, - * messageType: string, + * messageType: TalkMessageType, * systemMessage: string, * } * @@ -145,7 +149,7 @@ * * @psalm-type TalkParticipant = array{ * actorId: string, - * actorType: string, + * actorType: TalkActorType, * attendeeId: int, * attendeePermissions: int, * attendeePin: string, @@ -167,14 +171,14 @@ * @psalm-type TalkPollVote = array{ * actorDisplayName: string, * actorId: string, - * actorType: string, + * actorType: TalkActorType, * optionId: int, * } * * @psalm-type TalkPoll = array{ * actorDisplayName: string, * actorId: string, - * actorType: string, + * actorType: TalkActorType, * details?: TalkPollVote[], * id: int, * maxVotes: int, @@ -190,13 +194,13 @@ * @psalm-type TalkReaction = array{ * actorDisplayName: string, * actorId: string, - * actorType: string, + * actorType: TalkActorType, * timestamp: int, * } * * @psalm-type TalkRoom = array{ * actorId: string, - * actorType: string, + * actorType: TalkActorType|'', * attendeeId: int, * attendeePermissions: int, * attendeePin: ?string, diff --git a/lib/Service/AttachmentService.php b/lib/Service/AttachmentService.php index 0a935d7914b..68c4390805c 100644 --- a/lib/Service/AttachmentService.php +++ b/lib/Service/AttachmentService.php @@ -26,6 +26,7 @@ namespace OCA\Talk\Service; +use OCA\Talk\Chat\ChatManager; use OCA\Talk\Model\Attachment; use OCA\Talk\Model\AttachmentMapper; use OCA\Talk\Room; @@ -38,6 +39,9 @@ public function __construct( ) { } + /** + * @param ChatManager::VERB_* $messageType + */ public function createAttachmentEntry(Room $room, IComment $comment, string $messageType, array $parameters): void { $attachment = new Attachment(); $attachment->setRoomId($room->getId()); diff --git a/lib/Service/BreakoutRoomService.php b/lib/Service/BreakoutRoomService.php index 238b6120313..5cb2d363ebb 100644 --- a/lib/Service/BreakoutRoomService.php +++ b/lib/Service/BreakoutRoomService.php @@ -556,7 +556,7 @@ public function getBreakoutRooms(Room $parent, Participant $participant): array /** * @param Room $parent - * @param string $actorType + * @psalm-param Attendee::ACTOR_* $actorType * @param string $actorId * @param bool $throwOnModerator * @return void diff --git a/lib/Service/ConsentService.php b/lib/Service/ConsentService.php index 4d4f8a50ba6..61309ee5bc2 100644 --- a/lib/Service/ConsentService.php +++ b/lib/Service/ConsentService.php @@ -39,6 +39,9 @@ public function __construct( ) { } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ public function storeConsent(Room $room, string $actorType, string $actorId): Consent { $consent = new Consent(); $consent->setToken($room->getToken()); diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 7ea81e69c7e..d6bac38f61a 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -364,6 +364,7 @@ public function joinRoom(RoomService $roomService, Room $room, IUser $user, stri } /** + * @psalm-param Attendee::ACTOR_* $actorType * @throws UnauthorizedException */ public function joinRoomAsFederatedUser(Room $room, string $actorType, string $actorId): Participant { diff --git a/lib/Service/PollService.php b/lib/Service/PollService.php index b4eaab223ad..8031c460467 100644 --- a/lib/Service/PollService.php +++ b/lib/Service/PollService.php @@ -26,6 +26,7 @@ namespace OCA\Talk\Service; use OCA\Talk\Exceptions\WrongPermissionsException; +use OCA\Talk\Model\Attendee; use OCA\Talk\Model\Poll; use OCA\Talk\Model\PollMapper; use OCA\Talk\Model\Vote; @@ -46,6 +47,9 @@ public function __construct( ) { } + /** + * @psalm-param Attendee::ACTOR_* $actorType + */ public function createPoll(int $roomId, string $actorType, string $actorId, string $displayName, string $question, array $options, int $resultMode, int $maxVotes): Poll { $question = trim($question); diff --git a/openapi-backend-sipbridge.json b/openapi-backend-sipbridge.json index 04f1ce51023..1f613f4c442 100644 --- a/openapi-backend-sipbridge.json +++ b/openapi-backend-sipbridge.json @@ -20,6 +20,24 @@ } }, "schemas": { + "ActorType": { + "type": "string", + "enum": [ + "bot-", + "bots", + "bridged", + "changelog", + "circles", + "cli", + "emails", + "federated_users", + "groups", + "guests", + "phones", + "system", + "users" + ] + }, "Capabilities": { "type": "object", "required": [ @@ -211,7 +229,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "deleted": { "type": "boolean", @@ -246,7 +264,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "reactions": { "type": "object", @@ -286,6 +304,21 @@ } } }, + "MessageType": { + "type": "string", + "enum": [ + "command", + "comment", + "comment_deleted", + "object_shared", + "reaction", + "reaction_deleted", + "record-audio", + "record-video", + "system", + "voice-message" + ] + }, "OCSMeta": { "type": "object", "required": [ @@ -388,7 +421,14 @@ "type": "string" }, "actorType": { - "type": "string" + "oneOf": [ + { + "$ref": "#/components/schemas/ActorType" + }, + { + "type": "string" + } + ] }, "attendeeId": { "type": "integer", @@ -619,7 +659,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "expirationTimestamp": { "type": "integer", @@ -638,7 +678,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "systemMessage": { "type": "string" diff --git a/openapi-federation.json b/openapi-federation.json index 94f1cc13e13..18eaaa65f82 100644 --- a/openapi-federation.json +++ b/openapi-federation.json @@ -20,6 +20,24 @@ } }, "schemas": { + "ActorType": { + "type": "string", + "enum": [ + "bot-", + "bots", + "bridged", + "changelog", + "circles", + "cli", + "emails", + "federated_users", + "groups", + "guests", + "phones", + "system", + "users" + ] + }, "Capabilities": { "type": "object", "required": [ @@ -211,7 +229,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "deleted": { "type": "boolean", @@ -246,7 +264,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "reactions": { "type": "object", @@ -345,6 +363,21 @@ } } }, + "MessageType": { + "type": "string", + "enum": [ + "command", + "comment", + "comment_deleted", + "object_shared", + "reaction", + "reaction_deleted", + "record-audio", + "record-video", + "system", + "voice-message" + ] + }, "OCSMeta": { "type": "object", "required": [ @@ -447,7 +480,14 @@ "type": "string" }, "actorType": { - "type": "string" + "oneOf": [ + { + "$ref": "#/components/schemas/ActorType" + }, + { + "type": "string" + } + ] }, "attendeeId": { "type": "integer", @@ -678,7 +718,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "expirationTimestamp": { "type": "integer", @@ -697,7 +737,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "systemMessage": { "type": "string" diff --git a/openapi-full.json b/openapi-full.json index 79512b6a4e8..3834a923a69 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -20,6 +20,24 @@ } }, "schemas": { + "ActorType": { + "type": "string", + "enum": [ + "bot-", + "bots", + "bridged", + "changelog", + "circles", + "cli", + "emails", + "federated_users", + "groups", + "guests", + "phones", + "system", + "users" + ] + }, "Bot": { "type": "object", "required": [ @@ -120,7 +138,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "displayName": { "type": "string" @@ -372,7 +390,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "deleted": { "type": "boolean", @@ -407,7 +425,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "reactions": { "type": "object", @@ -600,6 +618,21 @@ } ] }, + "MessageType": { + "type": "string", + "enum": [ + "command", + "comment", + "comment_deleted", + "object_shared", + "reaction", + "reaction_deleted", + "record-audio", + "record-video", + "system", + "voice-message" + ] + }, "OCSMeta": { "type": "object", "required": [ @@ -645,7 +678,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "attendeeId": { "type": "integer", @@ -733,7 +766,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "details": { "type": "array", @@ -802,7 +835,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "optionId": { "type": "integer", @@ -845,7 +878,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "timestamp": { "type": "integer", @@ -912,7 +945,14 @@ "type": "string" }, "actorType": { - "type": "string" + "oneOf": [ + { + "$ref": "#/components/schemas/ActorType" + }, + { + "type": "string" + } + ] }, "attendeeId": { "type": "integer", @@ -1143,7 +1183,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "expirationTimestamp": { "type": "integer", @@ -1162,7 +1202,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "systemMessage": { "type": "string" diff --git a/openapi.json b/openapi.json index 93b882007eb..cf5831f7055 100644 --- a/openapi.json +++ b/openapi.json @@ -20,6 +20,24 @@ } }, "schemas": { + "ActorType": { + "type": "string", + "enum": [ + "bot-", + "bots", + "bridged", + "changelog", + "circles", + "cli", + "emails", + "federated_users", + "groups", + "guests", + "phones", + "system", + "users" + ] + }, "Bot": { "type": "object", "required": [ @@ -61,7 +79,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "displayName": { "type": "string" @@ -313,7 +331,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "deleted": { "type": "boolean", @@ -348,7 +366,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "reactions": { "type": "object", @@ -482,6 +500,21 @@ } ] }, + "MessageType": { + "type": "string", + "enum": [ + "command", + "comment", + "comment_deleted", + "object_shared", + "reaction", + "reaction_deleted", + "record-audio", + "record-video", + "system", + "voice-message" + ] + }, "OCSMeta": { "type": "object", "required": [ @@ -527,7 +560,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "attendeeId": { "type": "integer", @@ -615,7 +648,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "details": { "type": "array", @@ -684,7 +717,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "optionId": { "type": "integer", @@ -727,7 +760,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "timestamp": { "type": "integer", @@ -794,7 +827,14 @@ "type": "string" }, "actorType": { - "type": "string" + "oneOf": [ + { + "$ref": "#/components/schemas/ActorType" + }, + { + "type": "string" + } + ] }, "attendeeId": { "type": "integer", @@ -1025,7 +1065,7 @@ "type": "string" }, "actorType": { - "type": "string" + "$ref": "#/components/schemas/ActorType" }, "expirationTimestamp": { "type": "integer", @@ -1044,7 +1084,7 @@ } }, "messageType": { - "type": "string" + "$ref": "#/components/schemas/MessageType" }, "systemMessage": { "type": "string" diff --git a/src/types/openapi/openapi-backend-sipbridge.ts b/src/types/openapi/openapi-backend-sipbridge.ts index bbdf239a724..f6490280395 100644 --- a/src/types/openapi/openapi-backend-sipbridge.ts +++ b/src/types/openapi/openapi-backend-sipbridge.ts @@ -40,6 +40,8 @@ export type webhooks = Record; export type components = { schemas: { + /** @enum {string} */ + ActorType: "bot-" | "bots" | "bridged" | "changelog" | "circles" | "cli" | "emails" | "federated_users" | "groups" | "guests" | "phones" | "system" | "users"; Capabilities: { features: string[]; config: { @@ -87,7 +89,7 @@ export type components = { ChatMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** @enum {boolean} */ deleted?: true; /** Format: int64 */ @@ -102,7 +104,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; reactions: { [key: string]: number; }; @@ -118,6 +120,8 @@ export type components = { lastEditTimestamp?: number; silent?: boolean; }; + /** @enum {string} */ + MessageType: "command" | "comment" | "comment_deleted" | "object_shared" | "reaction" | "reaction_deleted" | "record-audio" | "record-video" | "system" | "voice-message"; OCSMeta: { status: string; statuscode: number; @@ -130,7 +134,7 @@ export type components = { }, unknown[]]>; Room: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"] | string; /** Format: int64 */ attendeeId: number; /** Format: int64 */ @@ -217,7 +221,7 @@ export type components = { RoomProxyMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ expirationTimestamp: number; message: string; @@ -226,7 +230,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; systemMessage: string; }; }; diff --git a/src/types/openapi/openapi-federation.ts b/src/types/openapi/openapi-federation.ts index c34cbe8f98b..2f227d10392 100644 --- a/src/types/openapi/openapi-federation.ts +++ b/src/types/openapi/openapi-federation.ts @@ -35,6 +35,8 @@ export type webhooks = Record; export type components = { schemas: { + /** @enum {string} */ + ActorType: "bot-" | "bots" | "bridged" | "changelog" | "circles" | "cli" | "emails" | "federated_users" | "groups" | "guests" | "phones" | "system" | "users"; Capabilities: { features: string[]; config: { @@ -82,7 +84,7 @@ export type components = { ChatMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** @enum {boolean} */ deleted?: true; /** Format: int64 */ @@ -97,7 +99,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; reactions: { [key: string]: number; }; @@ -131,6 +133,8 @@ export type components = { inviterCloudId: string; inviterDisplayName: string; }; + /** @enum {string} */ + MessageType: "command" | "comment" | "comment_deleted" | "object_shared" | "reaction" | "reaction_deleted" | "record-audio" | "record-video" | "system" | "voice-message"; OCSMeta: { status: string; statuscode: number; @@ -143,7 +147,7 @@ export type components = { }, unknown[]]>; Room: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"] | string; /** Format: int64 */ attendeeId: number; /** Format: int64 */ @@ -230,7 +234,7 @@ export type components = { RoomProxyMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ expirationTimestamp: number; message: string; @@ -239,7 +243,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; systemMessage: string; }; }; diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 711bce6fba2..2dc51a755db 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -509,6 +509,8 @@ export type webhooks = Record; export type components = { schemas: { + /** @enum {string} */ + ActorType: "bot-" | "bots" | "bridged" | "changelog" | "circles" | "cli" | "emails" | "federated_users" | "groups" | "guests" | "phones" | "system" | "users"; Bot: { description: string | null; /** Format: int64 */ @@ -533,7 +535,7 @@ export type components = { }; CallPeer: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; displayName: string; /** Format: int64 */ lastPing: number; @@ -598,7 +600,7 @@ export type components = { ChatMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** @enum {boolean} */ deleted?: true; /** Format: int64 */ @@ -613,7 +615,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; reactions: { [key: string]: number; }; @@ -672,6 +674,8 @@ export type components = { running: boolean; }; MatterbridgeWithProcessState: components["schemas"]["Matterbridge"] & components["schemas"]["MatterbridgeProcessState"]; + /** @enum {string} */ + MessageType: "command" | "comment" | "comment_deleted" | "object_shared" | "reaction" | "reaction_deleted" | "record-audio" | "record-video" | "system" | "voice-message"; OCSMeta: { status: string; statuscode: number; @@ -681,7 +685,7 @@ export type components = { }; Participant: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ attendeeId: number; /** Format: int64 */ @@ -709,7 +713,7 @@ export type components = { Poll: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; details?: components["schemas"]["PollVote"][]; /** Format: int64 */ id: number; @@ -731,7 +735,7 @@ export type components = { PollVote: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ optionId: number; }; @@ -741,13 +745,13 @@ export type components = { Reaction: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ timestamp: number; }; Room: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"] | string; /** Format: int64 */ attendeeId: number; /** Format: int64 */ @@ -834,7 +838,7 @@ export type components = { RoomProxyMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ expirationTimestamp: number; message: string; @@ -843,7 +847,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; systemMessage: string; }; SignalingSession: { diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 98e6ce34317..dafa86b5525 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -382,6 +382,8 @@ export type webhooks = Record; export type components = { schemas: { + /** @enum {string} */ + ActorType: "bot-" | "bots" | "bridged" | "changelog" | "circles" | "cli" | "emails" | "federated_users" | "groups" | "guests" | "phones" | "system" | "users"; Bot: { description: string | null; /** Format: int64 */ @@ -392,7 +394,7 @@ export type components = { }; CallPeer: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; displayName: string; /** Format: int64 */ lastPing: number; @@ -457,7 +459,7 @@ export type components = { ChatMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** @enum {boolean} */ deleted?: true; /** Format: int64 */ @@ -472,7 +474,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; reactions: { [key: string]: number; }; @@ -513,6 +515,8 @@ export type components = { running: boolean; }; MatterbridgeWithProcessState: components["schemas"]["Matterbridge"] & components["schemas"]["MatterbridgeProcessState"]; + /** @enum {string} */ + MessageType: "command" | "comment" | "comment_deleted" | "object_shared" | "reaction" | "reaction_deleted" | "record-audio" | "record-video" | "system" | "voice-message"; OCSMeta: { status: string; statuscode: number; @@ -522,7 +526,7 @@ export type components = { }; Participant: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ attendeeId: number; /** Format: int64 */ @@ -550,7 +554,7 @@ export type components = { Poll: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; details?: components["schemas"]["PollVote"][]; /** Format: int64 */ id: number; @@ -572,7 +576,7 @@ export type components = { PollVote: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ optionId: number; }; @@ -582,13 +586,13 @@ export type components = { Reaction: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ timestamp: number; }; Room: { actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"] | string; /** Format: int64 */ attendeeId: number; /** Format: int64 */ @@ -675,7 +679,7 @@ export type components = { RoomProxyMessage: { actorDisplayName: string; actorId: string; - actorType: string; + actorType: components["schemas"]["ActorType"]; /** Format: int64 */ expirationTimestamp: number; message: string; @@ -684,7 +688,7 @@ export type components = { [key: string]: Record; }; }; - messageType: string; + messageType: components["schemas"]["MessageType"]; systemMessage: string; }; SignalingSession: {