'Application', 'id' => Attendee::ACTOR_BOTS . '/' . Attendee::ACTOR_BOT_PREFIX . $bot->getUrlHash(), 'name' => $bot->getName(), ]; } /** * @return array{type: 'Collection', id: non-empty-string, name: string} */ public function generateCollectionFromRoom(Room $room): array { /** @var non-empty-string $token */ $token = $room->getToken(); return [ 'type' => 'Collection', 'id' => $token, 'name' => $room->getName(), ]; } /** * @psalm-param ?ChatMessageParentData $inReplyTo * @psalm-return NoteType&array{inReplyTo?: ChatMessageParentData} */ public function generateNote(IComment $comment, array $messageData, string $messageType, ?array $inReplyTo = null): array { /** @var string $content */ $content = json_encode($messageData, JSON_THROW_ON_ERROR); /** @var numeric-string $messageId */ $messageId = $comment->getId(); /** @var 'text/markdown'|'text/plain' $mediaType */ $mediaType = 'text/markdown';// FIXME or text/plain when markdown is disabled $note = [ 'type' => 'Note', 'id' => $messageId, 'name' => $messageType, 'content' => $content, 'mediaType' => $mediaType, ]; if ($inReplyTo !== null) { $note['inReplyTo'] = $inReplyTo; } return $note; } /** * @return array{type: 'Person', id: non-falsy-string, name: string, talkParticipantType: numeric-string} */ public function generatePersonFromAttendee(Attendee $attendee): array { return [ 'type' => 'Person', 'id' => $attendee->getActorType() . '/' . $attendee->getActorId(), 'name' => $attendee->getDisplayName(), 'talkParticipantType' => (string)$attendee->getParticipantType(), ]; } /** * @return array{type: 'Person', id: non-falsy-string, name: string} */ public function generatePersonFromMessageActor(Message $message): array { return [ 'type' => 'Person', 'id' => $message->getActorType() . '/' . $message->getActorId(), 'name' => $message->getActorDisplayName(), ]; } }