listChats method

Future<ListChatsResponse> listChats({
  1. required String agentSpaceId,
  2. int? maxResults,
  3. String? nextToken,
  4. String? userId,
})

Retrieves a paginated list of the user's recent chat executions

May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter maxResults : Maximum number of results to return

Parameter nextToken : Token for pagination

Parameter userId : The user identifier to list chats for. This field is deprecated and will be ignored — the service resolves user identity from the authenticated session.

Implementation

Future<ListChatsResponse> listChats({
  required String agentSpaceId,
  int? maxResults,
  String? nextToken,
  String? userId,
}) async {
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (userId != null) 'userId': [userId],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/agents/agent-space/${Uri.encodeComponent(agentSpaceId)}/chat/list',
    queryParams: $query,
    hostPrefix: 'dp.',
    exceptionFnMap: _exceptionFns,
  );
  return ListChatsResponse.fromJson(response);
}