watch method

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

Watches for changes in users list.

request - The metadata request object.

Request parameters:

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

customer - Immutable ID of the Google Workspace account. In case of multi-domain, to fetch all users for a customer, fill this field instead of domain.

domain - Name of the domain. Fill this field to get users from only this domain. To return all users in a multi-domain fill customer field instead."

event - Events to watch for. 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 - Column 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 mentioned in customFieldMask.
  • "full" : Include all fields associated with this user.

query - Query string search. Contains one or more search clauses, each with a field, operator, and value. For complete documentation, go to Search for users.

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

sortOrder - Whether to return results in ascending or descending order. 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](https://developers.google.com/workspace/admin/directory/v1/guides/manage-users#retrieve_users_non_admin). Possible string values are:

  • "admin_view" : Results include both administrator-only and domain-public fields.
  • "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 Channel.

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<Channel> watch(
  Channel request, {
  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 body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'customFieldMask': ?customFieldMask == null ? null : [customFieldMask],
    'customer': ?customer == null ? null : [customer],
    'domain': ?domain == null ? null : [domain],
    'event': ?event == null ? null : [event],
    'maxResults': ?maxResults == null ? null : ['${maxResults}'],
    'orderBy': ?orderBy == null ? null : [orderBy],
    'pageToken': ?pageToken == null ? null : [pageToken],
    'projection': ?projection == null ? null : [projection],
    'query': ?query == null ? null : [query],
    'showDeleted': ?showDeleted == null ? null : [showDeleted],
    'sortOrder': ?sortOrder == null ? null : [sortOrder],
    'viewType': ?viewType == null ? null : [viewType],
    'fields': ?$fields == null ? null : [$fields],
  };

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

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