createSessionTokenFromTemplate method

Future<CreateSessionToken200Response?> createSessionTokenFromTemplate(
  1. String sessionId,
  2. String templateName, {
  3. CreateSessionTokenFromTemplateRequest? createSessionTokenFromTemplateRequest,
})

Create a session token from a jwt template

Creates a JSON Web Token(JWT) based on a session and a JWT Template name defined for your instance

Parameters:

Implementation

Future<CreateSessionToken200Response?> createSessionTokenFromTemplate(
  String sessionId,
  String templateName, {
  CreateSessionTokenFromTemplateRequest?
      createSessionTokenFromTemplateRequest,
}) async {
  final response = await createSessionTokenFromTemplateWithHttpInfo(
    sessionId,
    templateName,
    createSessionTokenFromTemplateRequest:
        createSessionTokenFromTemplateRequest,
  );
  if (response.statusCode >= HttpStatus.badRequest) {
    throw ApiException(response.statusCode, await _decodeBodyBytes(response));
  }
  // When a remote server returns no body with a status of 204, we shall not decode it.
  // At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
  // FormatException when trying to decode an empty string.
  if (response.body.isNotEmpty &&
      response.statusCode != HttpStatus.noContent) {
    return await apiClient.deserializeAsync(
      await _decodeBodyBytes(response),
      'CreateSessionToken200Response',
    ) as CreateSessionToken200Response;
  }
  return null;
}