listSessions method
Lists sessions for the specified application. You can filter sessions by state and creation time.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ValidationException.
Parameter applicationId :
The ID of the application to list sessions for.
Parameter createdAtAfter :
The lower bound of the option to filter by creation date and time.
Parameter createdAtBefore :
The upper bound of the option to filter by creation date and time.
Parameter maxResults :
The maximum number of sessions to return in each page of results.
Parameter nextToken :
The token for the next set of session results.
Parameter states :
An optional filter for session states. Note that if this filter contains
multiple states, the resulting list will be grouped by the state.
Implementation
Future<ListSessionsResponse> listSessions({
required String applicationId,
DateTime? createdAtAfter,
DateTime? createdAtBefore,
int? maxResults,
String? nextToken,
List<SessionState>? states,
}) async {
final $query = <String, List<String>>{
if (createdAtAfter != null)
'createdAtAfter': [_s.iso8601ToJson(createdAtAfter).toString()],
if (createdAtBefore != null)
'createdAtBefore': [_s.iso8601ToJson(createdAtBefore).toString()],
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (nextToken != null) 'nextToken': [nextToken],
if (states != null) 'states': states.map((e) => e.value).toList(),
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri:
'/applications/${Uri.encodeComponent(applicationId)}/sessions',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListSessionsResponse.fromJson(response);
}