ChatResponse class
Encapsulates the response from ChatAPI.getMessages.
Contains the messages received, along with status information about the request and any platform-specific metadata.
Constructors
-
ChatResponse({required List<
ChatMessage> messages, bool success = true, ChatResponseStatus status = ChatResponseStatus.ok, String? error, Duration waitDuration = Duration.zero, bool hasMore = false, Map<String, dynamic> ? metadata}) -
const
- ChatResponse.empty()
-
Create an empty successful response.
const
- ChatResponse.error(String message, {ChatResponseStatus? status})
-
Create an error response.
factory
- ChatResponse.timeout(Duration waitDuration)
-
Create a timeout response.
factory
Properties
- count → int
-
Number of messages received.
no setter
- error → String?
-
Error message if the operation failed.
final
- first → ChatMessage?
-
Get the first message, or null if empty.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasMessages → bool
-
Whether any messages were received.
no setter
- hasMore → bool
-
Whether there are potentially more messages available.
final
- last → ChatMessage?
-
Get the last message, or null if empty.
no setter
-
messages
→ List<
ChatMessage> -
The messages received.
final
-
metadata
→ Map<
String, dynamic> ? -
Platform-specific metadata.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- status → ChatResponseStatus
-
Status of the response.
final
- success → bool
-
Whether the operation was successful.
final
-
textContent
→ List<
String> -
Get only text content from all messages.
no setter
- waitDuration → Duration
-
How long the request actually waited.
final
Methods
-
fromSender(
String senderId) → List< ChatMessage> - Filter messages by sender.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
ofType(
ChatMessageType type) → List< ChatMessage> - Filter messages by type.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited