getSession method

Future<GetSessionResponse> getSession({
  1. required String botAlias,
  2. required String botName,
  3. required String userId,
  4. String? checkpointLabelFilter,
})

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

May throw NotFoundException. May throw BadRequestException. May throw LimitExceededException. May throw InternalFailureException.

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

Parameter botName : The name of the bot that contains the session data.

Parameter userId : The ID of the client application user. Amazon Lex uses this to identify a user's conversation with your bot.

Parameter checkpointLabelFilter : A string used to filter the intents returned in the recentIntentSummaryView structure.

When you specify a filter, only intents with their checkpointLabel field set to that string are returned.

Implementation

Future<GetSessionResponse> getSession({
  required String botAlias,
  required String botName,
  required String userId,
  String? checkpointLabelFilter,
}) async {
  ArgumentError.checkNotNull(botAlias, 'botAlias');
  ArgumentError.checkNotNull(botName, 'botName');
  ArgumentError.checkNotNull(userId, 'userId');
  _s.validateStringLength(
    'userId',
    userId,
    2,
    100,
    isRequired: true,
  );
  _s.validateStringLength(
    'checkpointLabelFilter',
    checkpointLabelFilter,
    1,
    255,
  );
  final $query = <String, List<String>>{
    if (checkpointLabelFilter != null)
      'checkpointLabelFilter': [checkpointLabelFilter],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri:
        '/bot/${Uri.encodeComponent(botName)}/alias/${Uri.encodeComponent(botAlias)}/user/${Uri.encodeComponent(userId)}/session/',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return GetSessionResponse.fromJson(response);
}