createChat method
Creates a new chat execution in the specified agent space
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter userId :
The user identifier for the chat. This field is deprecated and will be
ignored — the service resolves user identity from the authenticated
session.
Parameter userType :
The authentication type of the user
Implementation
Future<CreateChatResponse> createChat({
required String agentSpaceId,
String? userId,
UserType? userType,
}) async {
final $query = <String, List<String>>{
if (userId != null) 'userId': [userId],
if (userType != null) 'userType': [userType.value],
};
final response = await _protocol.send(
payload: null,
method: 'POST',
requestUri:
'/agents/agent-space/${Uri.encodeComponent(agentSpaceId)}/chat/create',
queryParams: $query,
hostPrefix: 'dp.',
exceptionFnMap: _exceptionFns,
);
return CreateChatResponse.fromJson(response);
}