deleteSession method

Future<DeleteSessionResponse> deleteSession({
  1. required String botAliasId,
  2. required String botId,
  3. required String localeId,
  4. required String sessionId,
})

Removes session information for a specified bot, alias, and user ID.

You can use this operation to restart a conversation with a bot. When you remove a session, the entire history of the session is removed so that you can start again.

You don't need to delete a session. Sessions have a time limit and will expire. Set the session time limit when you create the bot. The default is 5 minutes, but you can specify anything between 1 minute and 24 hours.

If you specify a bot or alias ID that doesn't exist, you receive a BadRequestException.

If the locale doesn't exist in the bot, or if the locale hasn't been enables for the alias, you receive a BadRequestException.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter botAliasId : The alias identifier in use for the bot that contains the session data.

Parameter botId : The identifier of the bot that contains the session data.

Parameter localeId : The locale where the session is in use.

Parameter sessionId : The identifier of the session to delete.

Implementation

Future<DeleteSessionResponse> deleteSession({
  required String botAliasId,
  required String botId,
  required String localeId,
  required String sessionId,
}) async {
  final response = await _protocol.send(
    payload: null,
    method: 'DELETE',
    requestUri:
        '/bots/${Uri.encodeComponent(botId)}/botAliases/${Uri.encodeComponent(botAliasId)}/botLocales/${Uri.encodeComponent(localeId)}/sessions/${Uri.encodeComponent(sessionId)}',
    exceptionFnMap: _exceptionFns,
  );
  return DeleteSessionResponse.fromJson(response);
}