IPWorks Cloud 2020 Python Edition

Questions / Feedback?

list_changes Method

Lists changes to resources and shared drives.

Syntax

def list_changes() -> None: ...

Remarks

This method lists changes to resources and shared drives.

General Usage

When this method is called, it will use the change marker stored in either change_marker or next_change_marker (only one can be populated at a time) to request the next page of changes. This method causes the on_change_list event to fire once for each change, and will also populate the Change* properties.

If there are still more changes available to list when this method returns, the change_marker property will be populated. Continue to call this method until change_marker is empty to accumulate all pages of results in the Change* properties. (Once there aren't any more changes available to list, the next_change_marker property will be populated instead.)

Calling get_current_change_marker will immediately populate next_change_marker. Regardless of whether it is populated because of a call to get_current_change_marker or to list_changes, next_change_marker is always populated with a value that (at the time of population) points to the most current state. (Since "the most current state" implies that there are no further changes to list, calling list_changes immediately after next_change_marker is populated will not return any further changes.)

Setting change_marker to "1" will cause list_changes to list changes beginning with the very first change available.

Example of Listing Changes

// Start listing changes from the beginning, and list a maximum of 10 changes at a time.
googledrive.ChangeMarker = "1";
googledrive.Config("MaxResults=10");

// List changes once.
googledrive.ListChanges();
do {
  for (int i = 0; i < googledrive.Changes.Count; i++) {
    Console.WriteLine(googledrive.Changes[i].ResourceId);
    Console.WriteLine(googledrive.Changes[i].Time);
    Console.WriteLine(googledrive.Changes[i].Removed);
  }
  // Continue to call ListChanges() until ChangeMarker is the empty string (indicating there
  // are no more changes to list).
  googledrive.ListChanges();
} while (googledrive.ChangeMarker.Length > 0);

// Now NextChangeMarker will be populated. If we were to call ListChanges() again right now,
// nothing would be listed and NextChangeMarker would still be populated.

// Wait 2 minutes and then try to list changes again.
Thread.Sleep(120000);
googledrive.ListChanges();
do {
  for (int i = 0; i < googledrive.Changes.Count; i++) {
    Console.WriteLine(googledrive.Changes[i].ResourceId);
    Console.WriteLine(googledrive.Changes[i].Time);
    Console.WriteLine(googledrive.Changes[i].Removed);
  }
  googledrive.ListChanges();
} while (googledrive.ChangeMarker.Length > 0);

Shared Drive Functionality

When working in the context of shared drives, there are additional properties that can be configured to specify what kinds of changes should returned.

If shared_drive is empty string, then changes for items in shared drives that the user has accessed will be included (in addition to the usual changes for the user's items). Changes to the shared drives themselves which the user is a member of will also be included.

If shared_drive is populated with a shared drive resource Id, then only changes to items within that shared drive, as well as changes to that shared drive itself, will be returned.

A change's change_type will reflect whether it is associated with a file or folder (0), or a shared drive itself (1).

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Python Edition - Version 20.0 [Build 8265]