list method

Future<ChromeOsDevices> list(
  1. String customerId, {
  2. bool? includeChildOrgunits,
  3. int? maxResults,
  4. String? orderBy,
  5. String? orgUnitPath,
  6. String? pageToken,
  7. String? projection,
  8. String? query,
  9. String? sortOrder,
  10. String? $fields,
})

Retrieves a paginated list of Chrome OS devices within an account.

Request parameters:

customerId - The unique ID for the customer's Google Workspace account. As an account administrator, you can also use the my_customer alias to represent your account's customerId. The customerId is also returned as part of the [Users resource](/admin-sdk/directory/v1/reference/users).

includeChildOrgunits - Return devices from all child orgunits, as well as the specified org unit. If this is set to true, 'orgUnitPath' must be provided.

maxResults - Maximum number of results to return. Value should not exceed 300.

orderBy - Device property to use for sorting results. Possible string values are:

  • "annotatedLocation" : Chrome device location as annotated by the administrator.
  • "annotatedUser" : Chromebook user as annotated by administrator.
  • "lastSync" : The date and time the Chrome device was last synchronized with the policy settings in the Admin console.
  • "notes" : Chrome device notes as annotated by the administrator.
  • "serialNumber" : The Chrome device serial number entered when the device was enabled.
  • "status" : Chrome device status. For more information, see the <a [chromeosdevices](/admin-sdk/directory/v1/reference/chromeosdevices.html).

orgUnitPath - The full path of the organizational unit (minus the leading /) or its unique ID.

pageToken - The pageToken query parameter is used to request the next page of query results. The follow-on request's pageToken query parameter is the nextPageToken from your previous response.

projection - Determines whether the response contains the full list of properties or only a subset. Possible string values are:

  • "BASIC" : Includes only the basic metadata fields (e.g., deviceId, serialNumber, status, and user)
  • "FULL" : Includes all metadata fields

query - Search string in the format given at https://developers.google.com/admin-sdk/directory/v1/list-query-operators

sortOrder - Whether to return results in ascending or descending order. Must be used with the orderBy parameter. Possible string values are:

  • "ASCENDING" : Ascending order.
  • "DESCENDING" : Descending order.

$fields - Selector specifying which fields to include in a partial response.

Completes with a ChromeOsDevices.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<ChromeOsDevices> list(
  core.String customerId, {
  core.bool? includeChildOrgunits,
  core.int? maxResults,
  core.String? orderBy,
  core.String? orgUnitPath,
  core.String? pageToken,
  core.String? projection,
  core.String? query,
  core.String? sortOrder,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (includeChildOrgunits != null)
      'includeChildOrgunits': ['${includeChildOrgunits}'],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (orgUnitPath != null) 'orgUnitPath': [orgUnitPath],
    if (pageToken != null) 'pageToken': [pageToken],
    if (projection != null) 'projection': [projection],
    if (query != null) 'query': [query],
    if (sortOrder != null) 'sortOrder': [sortOrder],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'admin/directory/v1/customer/' +
      commons.escapeVariable('$customerId') +
      '/devices/chromeos';

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return ChromeOsDevices.fromJson(
      response_ as core.Map<core.String, core.dynamic>);
}