IPWorks Cloud 2020 Python Edition

Questions / Feedback?

list_file_versions Method

Lists the file versions in a bucket.

Syntax

def list_file_versions(bucket_id: str) -> None: ...

Remarks

This method lists the file versions in the bucket specified by BucketId.

Before calling this method, the prefix property may be set in order to restrict the results to only the file versions whose names begin with the a given string. The delimiter property can also be used to further tune the results returned. The MaxResults configuration setting may also be used to limit the number of results returned.

If the currently-authenticated application key is restricted to a specific file name prefix (indicated by the account_allowed_prefix property being non-empty), then the prefix property will automatically be set to that prefix if it is empty when this method is called.

Calling this method will fire the on_file_list event once for each file version, and will also populate the File* properties. If the ListWithMetadata configuration setting is enabled, the on_metadata_list event will also be fired, once for each metadata item associated with each file version.

If there are still more files versions available to list when this method returns, the version_marker property will be populated. Continue to call this method until version_marker is empty to accumulate all pages of results in the File* properties.

The currently-authenticated application key must have the listFiles capability to call this method successfully, otherwise the server will return an error. Refer to the account_capabilities property for more information.

File Hierarchy Traversal

By using the delimiter and prefix properties in tandem, applications can effectively "traverse" a virtual hierarchy of files (or file versions) as if it were a filesystem. For example, assume that files with the following names exist within a bucket:

  • MyCompany
  • MyCompany/Department1
  • MyCompany/Department2
  • MyCompany/Department2/EmployeeA
  • MyCompany/Department2/EmployeeB

With delimiter set to /, we can set prefix to successively "deeper" values before calling list_files or list_file_versions for the following effect:

prefix Value Files Returned Folders Returned
(empty) MyCompany MyCompany/
MyCompany/ MyCompany/Department1
MyCompany/Department2
MyCompany/Department2/
MyCompany/Department2/ MyCompany/Department2/EmployeeA
MyCompany/Department2/EmployeeB
(none)

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