listUsers method
List all users
Returns a list of users. The users are returned sorted by creation date, with the most recent users appearing first. Resources are automatically scoped to the authenticated bearer e.g. when authenticated as a product, only users associated with the specific product, through a license, will be listed in the results.
Parameters:
-
String account (required): The identifier (UUID) or slug of your Keygen account.
-
Object page: Object containing page
size
and pagenumber
. -
int limit:
-
String status: The status of the user to filter by.
-
bool assigned: Only show users assigned a license.
-
String product: The identifier (UUID) of the product to filter by.
-
String group: The identifier (UUID) of the group to filter by.
-
List<String> roles: Array containing role names to filter by.
-
Object metadata: The metadata object to filter by.
Implementation
Future<ListUsersResponse?> listUsers(String account, { Object? page, int? limit, String? status, bool? assigned, String? product, String? group, List<String>? roles, Object? metadata, }) async {
final response = await listUsersWithHttpInfo(account, page: page, limit: limit, status: status, assigned: assigned, product: product, group: group, roles: roles, 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), 'ListUsersResponse',) as ListUsersResponse;
}
return null;
}