validateLicenseKey method
- String account, {
- ValidateLicenseKeyRequest? validateLicenseKeyRequest,
Validate by license key
Action to validate a license key. This will look up the license by its key and check the following: if the license is suspended, if the license is expired, if the license is overdue for check-in, and if the license meets its machine requirements (if strict). Additional scopes can also be applied, and may be required by the license's policy, e.g. a policy may set requireFingerprintScope=true
, which will require that you specify a scope.fingerprint
within the validation request in order to pass validation. The scoping feature allows you to easily set up a node-locked or floating licensing model without additional logic on your end.
Parameters:
-
String account (required): The identifier (UUID) or slug of your Keygen account.
-
ValidateLicenseKeyRequest validateLicenseKeyRequest:
Implementation
Future<ValidateLicenseKeyResponse?> validateLicenseKey(String account, { ValidateLicenseKeyRequest? validateLicenseKeyRequest, }) async {
final response = await validateLicenseKeyWithHttpInfo(account, validateLicenseKeyRequest: validateLicenseKeyRequest, );
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), 'ValidateLicenseKeyResponse',) as ValidateLicenseKeyResponse;
}
return null;
}