listSessions method

Future<ListSessionsResponse> listSessions({
  1. required String portalId,
  2. int? maxResults,
  3. String? nextToken,
  4. String? sessionId,
  5. SessionSortBy? sortBy,
  6. SessionStatus? status,
  7. String? username,
})

Lists information for multiple secure browser sessions from a specific portal.

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

Parameter portalId : The ID of the web portal for the sessions.

Parameter maxResults : The maximum number of results to be included in the next page.

Parameter nextToken : The pagination token used to retrieve the next page of results for this operation.

Parameter sessionId : The ID of the session.

Parameter sortBy : The method in which the returned sessions should be sorted.

Parameter status : The status of the session.

Parameter username : The username of the session.

Implementation

Future<ListSessionsResponse> listSessions({
  required String portalId,
  int? maxResults,
  String? nextToken,
  String? sessionId,
  SessionSortBy? sortBy,
  SessionStatus? status,
  String? username,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1152921504606846976,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
    if (sessionId != null) 'sessionId': [sessionId],
    if (sortBy != null) 'sortBy': [sortBy.value],
    if (status != null) 'status': [status.value],
    if (username != null) 'username': [username],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/portals/${Uri.encodeComponent(portalId)}/sessions',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListSessionsResponse.fromJson(response);
}