ReceiveMessagePatterns extension
Adds pattern-matching-related methods to ReceiveMessage.
Methods
-
map<
TResult extends Object?> ({required TResult assistantEnd(AssistantEnd value), required TResult assistantMessage(AssistantMessage value), required TResult assistantProsody(AssistantProsody value), required TResult audioOutput(AudioOutput value), required TResult chatMetadata(ChatMetadata value), required TResult error(ReceiveMessageError value), required TResult userInterruption(UserInterruption value), required TResult userMessage(UserMessage value), required TResult toolCall(ToolCallMessage value), required TResult toolResponse(ToolResponseMessage value), required TResult toolError(ToolErrorMessage value)}) → TResult -
Available on ReceiveMessage, provided by the ReceiveMessagePatterns extension
Aswitch-like method, using callbacks. -
mapOrNull<
TResult extends Object?> ({TResult? assistantEnd(AssistantEnd value)?, TResult? assistantMessage(AssistantMessage value)?, TResult? assistantProsody(AssistantProsody value)?, TResult? audioOutput(AudioOutput value)?, TResult? chatMetadata(ChatMetadata value)?, TResult? error(ReceiveMessageError value)?, TResult? userInterruption(UserInterruption value)?, TResult? userMessage(UserMessage value)?, TResult? toolCall(ToolCallMessage value)?, TResult? toolResponse(ToolResponseMessage value)?, TResult? toolError(ToolErrorMessage value)?}) → TResult? -
Available on ReceiveMessage, provided by the ReceiveMessagePatterns extension
A variant ofmapthat fallback to returningnull. -
maybeMap<
TResult extends Object?> ({TResult assistantEnd(AssistantEnd value)?, TResult assistantMessage(AssistantMessage value)?, TResult assistantProsody(AssistantProsody value)?, TResult audioOutput(AudioOutput value)?, TResult chatMetadata(ChatMetadata value)?, TResult error(ReceiveMessageError value)?, TResult userInterruption(UserInterruption value)?, TResult userMessage(UserMessage value)?, TResult toolCall(ToolCallMessage value)?, TResult toolResponse(ToolResponseMessage value)?, TResult toolError(ToolErrorMessage value)?, required TResult orElse()}) → TResult -
Available on ReceiveMessage, provided by the ReceiveMessagePatterns extension
A variant ofmapthat fallback to returningorElse. -
maybeWhen<
TResult extends Object?> ({TResult assistantEnd(String? customSessionId)?, TResult assistantMessage(bool fromText, Message message, Models models, String? customSessionId, String? id)?, TResult assistantProsody(Models models, String? customSessionId, String? id)?, TResult audioOutput(String data, String id, int index, String? customSessionId)?, TResult chatMetadata(String chatGroupId, String chatId, String? requestId, String? customSessionId)?, TResult error(String code, String message, String slug, String? customSessionId, String? requestId)?, TResult userInterruption(int time, String? customSessionId)?, TResult userMessage(bool fromText, bool interim, Message message, Models models, TimeRange time, String? customSessionId)?, TResult toolCall(String name, String parameters, bool responseRequired, String toolCallId, String? customSessionId, String? toolType)?, TResult toolResponse(String content, String toolCallId, String? customSessionId, String? toolName, String? toolType)?, TResult toolError(String error, String toolCallId, String? code, String? content, String? customSessionId, String? level, String? toolType)?, required TResult orElse()}) → TResult -
Available on ReceiveMessage, provided by the ReceiveMessagePatterns extension
A variant ofwhenthat fallback to anorElsecallback. -
when<
TResult extends Object?> ({required TResult assistantEnd(String? customSessionId), required TResult assistantMessage(bool fromText, Message message, Models models, String? customSessionId, String? id), required TResult assistantProsody(Models models, String? customSessionId, String? id), required TResult audioOutput(String data, String id, int index, String? customSessionId), required TResult chatMetadata(String chatGroupId, String chatId, String? requestId, String? customSessionId), required TResult error(String code, String message, String slug, String? customSessionId, String? requestId), required TResult userInterruption(int time, String? customSessionId), required TResult userMessage(bool fromText, bool interim, Message message, Models models, TimeRange time, String? customSessionId), required TResult toolCall(String name, String parameters, bool responseRequired, String toolCallId, String? customSessionId, String? toolType), required TResult toolResponse(String content, String toolCallId, String? customSessionId, String? toolName, String? toolType), required TResult toolError(String error, String toolCallId, String? code, String? content, String? customSessionId, String? level, String? toolType)}) → TResult -
Available on ReceiveMessage, provided by the ReceiveMessagePatterns extension
Aswitch-like method, using callbacks. -
whenOrNull<
TResult extends Object?> ({TResult? assistantEnd(String? customSessionId)?, TResult? assistantMessage(bool fromText, Message message, Models models, String? customSessionId, String? id)?, TResult? assistantProsody(Models models, String? customSessionId, String? id)?, TResult? audioOutput(String data, String id, int index, String? customSessionId)?, TResult? chatMetadata(String chatGroupId, String chatId, String? requestId, String? customSessionId)?, TResult? error(String code, String message, String slug, String? customSessionId, String? requestId)?, TResult? userInterruption(int time, String? customSessionId)?, TResult? userMessage(bool fromText, bool interim, Message message, Models models, TimeRange time, String? customSessionId)?, TResult? toolCall(String name, String parameters, bool responseRequired, String toolCallId, String? customSessionId, String? toolType)?, TResult? toolResponse(String content, String toolCallId, String? customSessionId, String? toolName, String? toolType)?, TResult? toolError(String error, String toolCallId, String? code, String? content, String? customSessionId, String? level, String? toolType)?}) → TResult? -
Available on ReceiveMessage, provided by the ReceiveMessagePatterns extension
A variant ofwhenthat fallback to returningnull