watch method

Future<Channel> watch(
  1. Channel request, {
  2. String? driveId,
  3. bool? includeCorpusRemovals,
  4. bool? includeDeleted,
  5. bool? includeItemsFromAllDrives,
  6. String? includeLabels,
  7. String? includePermissionsForView,
  8. bool? includeSubscribed,
  9. bool? includeTeamDriveItems,
  10. int? maxResults,
  11. String? pageToken,
  12. String? spaces,
  13. String? startChangeId,
  14. bool? supportsAllDrives,
  15. bool? supportsTeamDrives,
  16. String? teamDriveId,
  17. String? $fields,
})

Subscribe to changes for a user.

request - The metadata request object.

Request parameters:

driveId - The shared drive from which changes will be returned. If specified the change IDs will be reflective of the shared drive; use the combined drive ID and change ID as an identifier.

includeCorpusRemovals - Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.

includeDeleted - Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.

includeItemsFromAllDrives - Whether both My Drive and shared drive items should be included in results.

includeLabels - A comma-separated list of IDs of labels to include in the labelInfo part of the response.

includePermissionsForView - Specifies which additional view's permissions to include in the response. Only published is supported.

includeSubscribed - Whether to include changes outside the My Drive hierarchy in the result. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the result.

includeTeamDriveItems - Deprecated: Use includeItemsFromAllDrives instead.

maxResults - Maximum number of changes to return.

pageToken - The token for continuing a previous list request on the next page. This should be set to the value of nextPageToken from the previous response or to the response from the getStartPageToken method.

spaces - A comma-separated list of spaces to query. Supported values are drive, appDataFolder and photos.

startChangeId - Deprecated: Use pageToken instead.

supportsAllDrives - Whether the requesting application supports both My Drives and shared drives.

supportsTeamDrives - Deprecated: Use supportsAllDrives instead.

teamDriveId - Deprecated: Use driveId instead.

$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? driveId,
  core.bool? includeCorpusRemovals,
  core.bool? includeDeleted,
  core.bool? includeItemsFromAllDrives,
  core.String? includeLabels,
  core.String? includePermissionsForView,
  core.bool? includeSubscribed,
  core.bool? includeTeamDriveItems,
  core.int? maxResults,
  core.String? pageToken,
  core.String? spaces,
  core.String? startChangeId,
  core.bool? supportsAllDrives,
  core.bool? supportsTeamDrives,
  core.String? teamDriveId,
  core.String? $fields,
}) async {
  final body_ = convert_1.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (driveId != null) 'driveId': [driveId],
    if (includeCorpusRemovals != null)
      'includeCorpusRemovals': ['${includeCorpusRemovals}'],
    if (includeDeleted != null) 'includeDeleted': ['${includeDeleted}'],
    if (includeItemsFromAllDrives != null)
      'includeItemsFromAllDrives': ['${includeItemsFromAllDrives}'],
    if (includeLabels != null) 'includeLabels': [includeLabels],
    if (includePermissionsForView != null)
      'includePermissionsForView': [includePermissionsForView],
    if (includeSubscribed != null)
      'includeSubscribed': ['${includeSubscribed}'],
    if (includeTeamDriveItems != null)
      'includeTeamDriveItems': ['${includeTeamDriveItems}'],
    if (maxResults != null) 'maxResults': ['${maxResults}'],
    if (pageToken != null) 'pageToken': [pageToken],
    if (spaces != null) 'spaces': [spaces],
    if (startChangeId != null) 'startChangeId': [startChangeId],
    if (supportsAllDrives != null)
      'supportsAllDrives': ['${supportsAllDrives}'],
    if (supportsTeamDrives != null)
      'supportsTeamDrives': ['${supportsTeamDrives}'],
    if (teamDriveId != null) 'teamDriveId': [teamDriveId],
    if ($fields != null) 'fields': [$fields],
  };

  const url_ = 'changes/watch';

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