listMachines method
Get a list of machines for an instance
This request returns the list of machines for an instance. The machines are ordered by descending creation date (i.e. most recent machines will be returned first)
Parameters:
-
int limit: Applies a limit to the number of results returned. Can be used for paginating the results together with
offset. -
int offset: Skip the first
offsetresults when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction withlimit. -
String query: Returns machines with ID or name that match the given query. Uses exact match for machine ID and partial match for name.
-
String orderBy: Allows to return machines in a particular order. You can order the returned machines by their
nameorcreated_at. To specify the direction, use the+or-symbols prepended to the property to order by. For example, to return machines in descending order bycreated_at, use-created_at. If you don't use+or-, then+is implied. Defaults to-created_at.
Implementation
Future<ListMachines200Response?> listMachines({
int? limit,
int? offset,
String? query,
String? orderBy,
}) async {
final response = await listMachinesWithHttpInfo(
limit: limit,
offset: offset,
query: query,
orderBy: orderBy,
);
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),
'ListMachines200Response',
) as ListMachines200Response;
}
return null;
}