list method

Future<Users> list({
  1. String? customFieldMask,
  2. String? customer,
  3. String? domain,
  4. String? event,
  5. int? maxResults,
  6. String? orderBy,
  7. String? pageToken,
  8. String? projection,
  9. String? query,
  10. String? showDeleted,
  11. String? sortOrder,
  12. String? viewType,
  13. String? $fields,
})

Retrieves a paginated list of either deleted users or all users in a domain.

Request parameters:

customFieldMask - A comma-separated list of schema names. All fields from these schemas are fetched. This should only be set when projection=custom.

customer - The unique ID for the customer's Google Workspace account. In case of a multi-domain account, to fetch all groups for a customer, use this field instead of domain. You can also use the my_customer alias to represent your account's customerId. The customerId is also returned as part of the [Users](/admin-sdk/directory/v1/reference/users) resource. You must provide either the customer or the domain parameter.

domain - The domain name. Use this field to get groups from only one domain. To return all domains for a customer account, use the customer query parameter instead. Either the customer or the domain parameter must be provided.

event - Event on which subscription is intended (if subscribing) Possible string values are:

  • "add" : User Created Event
  • "delete" : User Deleted Event
  • "makeAdmin" : User Admin Status Change Event
  • "undelete" : User Undeleted Event
  • "update" : User Updated Event

maxResults - Maximum number of results to return. Value must be between "1" and "500".

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

  • "email" : Primary email of the user.
  • "familyName" : User's family name.
  • "givenName" : User's given name.

pageToken - Token to specify next page in the list

projection - What subset of fields to fetch for this user. Possible string values are:

  • "basic" : Do not include any custom fields for the user.
  • "custom" : Include custom fields from schemas requested in customFieldMask.
  • "full" : Include all fields associated with this user.

query - Query string for searching user fields. For more information on constructing user queries, see [Search for Users](/admin-sdk/directory/v1/guides/search-users).

showDeleted - If set to true, retrieves the list of deleted users. (Default: false)

sortOrder - Whether to return results in ascending or descending order, ignoring case. Possible string values are:

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

viewType - Whether to fetch the administrator-only or domain-wide public view of the user. For more information, see [Retrieve a user as a non-administrator](/admin-sdk/directory/v1/guides/manage-users#retrieve_users_non_admin). Possible string values are:

  • "admin_view" : Results include both administrator-only and domain-public fields for the user.
  • "domain_public" : Results only include fields for the user that are publicly visible to other users in the domain.

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

Completes with a Users.

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<Users> list({
  core.String? customFieldMask,
  core.String? customer,
  core.String? domain,
  core.String? event,
  core.int? maxResults,
  core.String? orderBy,
  core.String? pageToken,
  core.String? projection,
  core.String? query,
  core.String? showDeleted,
  core.String? sortOrder,
  core.String? viewType,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (customFieldMask != null) 'customFieldMask': [customFieldMask],
    if (customer != null) 'customer': [customer],
    if (domain != null) 'domain': [domain],
    if (event != null) 'event': [event],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (orderBy != null) 'orderBy': [orderBy],
    if (pageToken != null) 'pageToken': [pageToken],
    if (projection != null) 'projection': [projection],
    if (query != null) 'query': [query],
    if (showDeleted != null) 'showDeleted': [showDeleted],
    if (sortOrder != null) 'sortOrder': [sortOrder],
    if (viewType != null) 'viewType': [viewType],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'admin/directory/v1/users';

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