listSessions method

Future<ListSessionsResponse> listSessions({
  1. required String workflowDefinitionName,
  2. required String workflowRunId,
  3. int? maxResults,
  4. String? nextToken,
  5. SortOrder? sortOrder,
})

Lists all sessions within a specific workflow run.

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

Parameter workflowDefinitionName : The name of the workflow definition containing the workflow run.

Parameter workflowRunId : The unique identifier of the workflow run to list sessions for.

Parameter maxResults : The maximum number of sessions to return in a single response.

Parameter nextToken : The token for retrieving the next page of results.

Parameter sortOrder : The sort order for the returned sessions (ascending or descending).

Implementation

Future<ListSessionsResponse> listSessions({
  required String workflowDefinitionName,
  required String workflowRunId,
  int? maxResults,
  String? nextToken,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final $payload = <String, dynamic>{
    if (sortOrder != null) 'sortOrder': sortOrder.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/workflow-definitions/${Uri.encodeComponent(workflowDefinitionName)}/workflow-runs/${Uri.encodeComponent(workflowRunId)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListSessionsResponse.fromJson(response);
}