listLicenses method
List all licenses
Returns a list of licenses. The licenses are returned sorted by creation date, with the most recent licenses appearing first. Resources are automatically scoped to the authenticated bearer e.g. when authenticated as a user, only licenses of that specific user will be listed.
Parameters:
-
String account (required): The identifier (UUID) or slug of your Keygen account.
-
Object page: Object containing page
size
and pagenumber
. -
int limit:
-
ListLicensesExpiresParameter expires: Object containing
in
,before
, orafter
filters. -
String status: The status of the license to filter by.
-
bool unassigned: The user-relationship status of the license to filter by.
-
String product: The identifier (UUID) of the product to filter by.
-
String policy: The identifier (UUID) of the policy to filter by.
-
String user: The identifier (UUID) or email of the user to filter by.
-
String group: The identifier (UUID) of the group to filter by.
-
String machine: The identifier (UUID) of the machine to filter by.
-
Object metadata: The metadata object to filter by.
Implementation
Future<ListLicensesResponse?> listLicenses(String account, { Object? page, int? limit, ListLicensesExpiresParameter? expires, String? status, bool? unassigned, String? product, String? policy, String? user, String? group, String? machine, Object? metadata, }) async {
final response = await listLicensesWithHttpInfo(account, page: page, limit: limit, expires: expires, status: status, unassigned: unassigned, product: product, policy: policy, user: user, group: group, machine: machine, metadata: metadata, );
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), 'ListLicensesResponse',) as ListLicensesResponse;
}
return null;
}