createSession method
Creates a new session context within a workflow run to manage conversation state and acts.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ServiceQuotaExceededException.
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 create the session in.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
Implementation
Future<CreateSessionResponse> createSession({
required String workflowDefinitionName,
required String workflowRunId,
String? clientToken,
}) async {
final $payload = <String, dynamic>{
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri:
'/workflow-definitions/${Uri.encodeComponent(workflowDefinitionName)}/workflow-runs/${Uri.encodeComponent(workflowRunId)}/sessions',
exceptionFnMap: _exceptionFns,
);
return CreateSessionResponse.fromJson(response);
}