checkOutLicense method

Future<CheckOutLicenseResponse?> checkOutLicense(
  1. String account,
  2. String license, {
  3. int? ttl,
  4. List<String>? include,
})

Check-out license

Action to check-out a license. This will generate a snapshot of the license at time of checkout, encoded into a license file certificate that can be decoded and used for licensing offline and air-gapped environments. The algorithm will depend on the policy's scheme. License files can be distributed using email or USB drives to air-gapped devices. For instructions on verifying a license file, please see license file verification.

Parameters:

  • String account (required): The identifier (UUID) or slug of your Keygen account.

  • String license (required): The identifier (UUID) or URL-safe key of the license to check-out.

  • int ttl: The time-to-live (TTL) of the checked out license file, in seconds.

  • List<String> include: Include relationship data in the license file.

Implementation

Future<CheckOutLicenseResponse?> checkOutLicense(String account, String license, { int? ttl, List<String>? include, }) async {
  final response = await checkOutLicenseWithHttpInfo(account, license,  ttl: ttl, include: include, );
  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), 'CheckOutLicenseResponse',) as CheckOutLicenseResponse;

  }
  return null;
}