mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Add KDoc to the single-interface library and service API modules
Cover the last remaining interfaces across libraries/audio, libraries/cachestore, libraries/indicator, libraries/slashcommands, libraries/voiceplayer and services/apperror, with their members and parameters. This completes the effort: all 222 in-scope interfaces and their 820 members in the 60 api modules that hold any now carry documentation. Notable points: CacheStore applies no expiry of its own and only records when each entry was written, leaving staleness to the caller; SlashCommandService.parse never throws, returning NotACommand for ordinary text and an error case for a malformed command. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+23
-1
@@ -9,7 +9,19 @@ package io.element.android.libraries.slashcommands.api
|
||||
|
||||
import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
|
||||
/**
|
||||
* Recognises and runs the slash commands the user can type in the composer, such as `/me` or `/join`.
|
||||
*
|
||||
* The composer first [parse]s what was typed, then hands the result to whichever proceed method matches its kind; navigation
|
||||
* commands and the error cases are handled by the composer itself.
|
||||
*/
|
||||
interface SlashCommandService {
|
||||
/**
|
||||
* Returns the commands whose name starts with what has been typed, so the composer can offer an autocomplete list.
|
||||
*
|
||||
* @param text the current composer content.
|
||||
* @param isInThread whether the composer is in a thread, since not every command is available there.
|
||||
*/
|
||||
suspend fun getSuggestions(
|
||||
text: String,
|
||||
isInThread: Boolean,
|
||||
@@ -17,6 +29,11 @@ interface SlashCommandService {
|
||||
|
||||
/**
|
||||
* Parse the message and return a SlashCommand.
|
||||
* Ordinary text comes back as `NotACommand`, and a malformed or unsupported command as one of the error cases, so this never throws.
|
||||
*
|
||||
* @param textMessage the composer content as plain text.
|
||||
* @param formattedMessage the composer content as HTML, or `null` when unformatted.
|
||||
* @param isInThreadTimeline whether the composer is in a thread.
|
||||
*/
|
||||
suspend fun parse(
|
||||
textMessage: CharSequence,
|
||||
@@ -26,6 +43,9 @@ interface SlashCommandService {
|
||||
|
||||
/**
|
||||
* Proceed a SlashCommandSendMessage.
|
||||
*
|
||||
* @param slashCommand the parsed command, carrying the content to send.
|
||||
* @param timeline the timeline to send it to.
|
||||
*/
|
||||
suspend fun proceedSendMessage(
|
||||
slashCommand: SlashCommand.SlashCommandSendMessage,
|
||||
@@ -33,7 +53,9 @@ interface SlashCommandService {
|
||||
): Result<Unit>
|
||||
|
||||
/**
|
||||
* Proceed a SlashCommandAdmin.
|
||||
* Proceed a SlashCommandAdmin, i.e. one that acts on the room or its members rather than sending a message.
|
||||
*
|
||||
* @param slashCommand the parsed command to run.
|
||||
*/
|
||||
suspend fun proceedAdmin(
|
||||
slashCommand: SlashCommand.SlashCommandAdmin,
|
||||
|
||||
Reference in New Issue
Block a user