createUser method
Create a user
Creates a new user resource. Users may be created with only an email address — no name or password is necessarily required. This can act as a way to associate an email address with a license, which can later be claimed and turned into a full user profile, if needed, using the password reset flow. This is particularly great for custom license recovery flows, where you may need to email a user their lost license keys.
Parameters:
-
String account (required): The identifier (UUID) or slug of your Keygen account.
-
CreateUserRequest createUserRequest (required):
Implementation
Future<CreateUserResponse?> createUser(String account, CreateUserRequest createUserRequest,) async {
final response = await createUserWithHttpInfo(account, createUserRequest,);
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), 'CreateUserResponse',) as CreateUserResponse;
}
return null;
}