listMachinesWithHttpInfo method

Future<Response> listMachinesWithHttpInfo({
  1. int? limit,
  2. int? offset,
  3. String? query,
  4. String? orderBy,
})

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)

Note: This method returns the HTTP Response.

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 offset results when paginating. Needs to be an integer greater or equal to zero. To be used in conjunction with limit.

  • 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 name or created_at. To specify the direction, use the + or - symbols prepended to the property to order by. For example, to return machines in descending order by created_at, use -created_at. If you don't use + or -, then + is implied. Defaults to -created_at.

Implementation

Future<http.Response> listMachinesWithHttpInfo({
  int? limit,
  int? offset,
  String? query,
  String? orderBy,
}) async {
  // ignore: prefer_const_declarations
  final path = r'/machines';

  // ignore: prefer_final_locals
  Object? postBody;

  final queryParams = <QueryParam>[];
  final headerParams = <String, String>{};
  final formParams = <String, String>{};

  if (limit != null) {
    queryParams.addAll(_queryParams('', 'limit', limit));
  }
  if (offset != null) {
    queryParams.addAll(_queryParams('', 'offset', offset));
  }
  if (query != null) {
    queryParams.addAll(_queryParams('', 'query', query));
  }
  if (orderBy != null) {
    queryParams.addAll(_queryParams('', 'order_by', orderBy));
  }

  const contentTypes = <String>[];

  return apiClient.invokeAPI(
    path,
    'GET',
    queryParams,
    postBody,
    headerParams,
    formParams,
    contentTypes.isEmpty ? null : contentTypes.first,
  );
}