From aa3543ec4416dc6a5e9b2c79f8a4ac24ea27904a Mon Sep 17 00:00:00 2001 From: Dropbox Bot <73138219+DropboxBot@users.noreply.github.com> Date: Wed, 30 Mar 2022 18:41:22 -0400 Subject: [PATCH] Automated Spec Update (#421) eec4b43685b7af842d320efaaa86db27232cb465 Change Notes: file_properties Namespace - Update Comments file_tagging Namespace - Update Comments files Namespace - Update Metadata struct to include preview_url - Update Comments team_log_generated Namespace - Add DropboxPasswordsPolicyChangedDetails, DropboxPasswordsPolicyChangedType structs - Add DropboxPasswordsPolicy unions Co-authored-by: DropboxBot --- dropbox/base.py | 5 +- dropbox/file_properties.py | 4 +- dropbox/files.py | 32 ++++-- dropbox/team_log.py | 227 +++++++++++++++++++++++++++++++++++++ spec | 2 +- 5 files changed, 258 insertions(+), 12 deletions(-) diff --git a/dropbox/base.py b/dropbox/base.py index a1c6089a..af5e3a3f 100644 --- a/dropbox/base.py +++ b/dropbox/base.py @@ -3054,8 +3054,9 @@ def files_tags_add(self, path, tag_text): """ - Add a tag to an item. A tag is a string. No more than 20 tags can be - added to a given item. + Add a tag to an item. A tag is a string. The strings are automatically + converted to lowercase letters. No more than 20 tags can be added to a + given item. Route attributes: scope: files.metadata.write diff --git a/dropbox/file_properties.py b/dropbox/file_properties.py index c6e421cb..6f2ab143 100644 --- a/dropbox/file_properties.py +++ b/dropbox/file_properties.py @@ -532,8 +532,8 @@ class LookupError(bb.Union): :ivar file_properties.LookupError.not_folder: We were expecting a folder, but the given path refers to something that isn't a folder. :ivar file_properties.LookupError.restricted_content: The file cannot be - transferred because the content is restricted. For example, sometimes - there are legal restrictions due to copyright claims. + transferred because the content is restricted. For example, we might + restrict a file due to legal requirements. """ _catch_all = 'other' diff --git a/dropbox/files.py b/dropbox/files.py index bc0e9052..948fa0bb 100644 --- a/dropbox/files.py +++ b/dropbox/files.py @@ -1533,6 +1533,7 @@ class Metadata(bb.Struct): :ivar files.Metadata.parent_shared_folder_id: Please use ``FileSharingInfo.parent_shared_folder_id`` or ``FolderSharingInfo.parent_shared_folder_id`` instead. + :ivar files.Metadata.preview_url: The preview URL of the file. """ __slots__ = [ @@ -1540,6 +1541,7 @@ class Metadata(bb.Struct): '_path_lower_value', '_path_display_value', '_parent_shared_folder_id_value', + '_preview_url_value', ] _has_required_fields = True @@ -1548,11 +1550,13 @@ def __init__(self, name=None, path_lower=None, path_display=None, - parent_shared_folder_id=None): + parent_shared_folder_id=None, + preview_url=None): self._name_value = bb.NOT_SET self._path_lower_value = bb.NOT_SET self._path_display_value = bb.NOT_SET self._parent_shared_folder_id_value = bb.NOT_SET + self._preview_url_value = bb.NOT_SET if name is not None: self.name = name if path_lower is not None: @@ -1561,6 +1565,8 @@ def __init__(self, self.path_display = path_display if parent_shared_folder_id is not None: self.parent_shared_folder_id = parent_shared_folder_id + if preview_url is not None: + self.preview_url = preview_url # Instance attribute type: str (validator is set below) name = bb.Attribute("name") @@ -1574,6 +1580,9 @@ def __init__(self, # Instance attribute type: str (validator is set below) parent_shared_folder_id = bb.Attribute("parent_shared_folder_id", nullable=True) + # Instance attribute type: str (validator is set below) + preview_url = bb.Attribute("preview_url", nullable=True) + def _process_custom_annotations(self, annotation_type, field_path, processor): super(Metadata, self)._process_custom_annotations(annotation_type, field_path, processor) @@ -1594,11 +1603,13 @@ def __init__(self, name=None, path_lower=None, path_display=None, - parent_shared_folder_id=None): + parent_shared_folder_id=None, + preview_url=None): super(DeletedMetadata, self).__init__(name, path_lower, path_display, - parent_shared_folder_id) + parent_shared_folder_id, + preview_url) def _process_custom_annotations(self, annotation_type, field_path, processor): super(DeletedMetadata, self)._process_custom_annotations(annotation_type, field_path, processor) @@ -2489,6 +2500,7 @@ def __init__(self, path_lower=None, path_display=None, parent_shared_folder_id=None, + preview_url=None, media_info=None, symlink_info=None, sharing_info=None, @@ -2501,7 +2513,8 @@ def __init__(self, super(FileMetadata, self).__init__(name, path_lower, path_display, - parent_shared_folder_id) + parent_shared_folder_id, + preview_url) self._id_value = bb.NOT_SET self._client_modified_value = bb.NOT_SET self._server_modified_value = bb.NOT_SET @@ -2732,13 +2745,15 @@ def __init__(self, path_lower=None, path_display=None, parent_shared_folder_id=None, + preview_url=None, shared_folder_id=None, sharing_info=None, property_groups=None): super(FolderMetadata, self).__init__(name, path_lower, path_display, - parent_shared_folder_id) + parent_shared_folder_id, + preview_url) self._id_value = bb.NOT_SET self._shared_folder_id_value = bb.NOT_SET self._sharing_info_value = bb.NOT_SET @@ -4662,8 +4677,8 @@ class LookupError(bb.Union): :ivar files.LookupError.not_folder: We were expecting a folder, but the given path refers to something that isn't a folder. :ivar files.LookupError.restricted_content: The file cannot be transferred - because the content is restricted. For example, sometimes there are - legal restrictions due to copyright claims. + because the content is restricted. For example, we might restrict a file + due to legal requirements. :ivar files.LookupError.unsupported_content_type: This operation is not supported for this content type. :ivar files.LookupError.locked: The given path is locked. @@ -11070,11 +11085,13 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): Metadata.path_lower.validator = bv.Nullable(bv.String()) Metadata.path_display.validator = bv.Nullable(bv.String()) Metadata.parent_shared_folder_id.validator = bv.Nullable(common.SharedFolderId_validator) +Metadata.preview_url.validator = bv.Nullable(bv.String()) Metadata._field_names_ = set([ 'name', 'path_lower', 'path_display', 'parent_shared_folder_id', + 'preview_url', ]) Metadata._all_field_names_ = Metadata._field_names_ Metadata._fields_ = [ @@ -11082,6 +11099,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): ('path_lower', Metadata.path_lower.validator), ('path_display', Metadata.path_display.validator), ('parent_shared_folder_id', Metadata.parent_shared_folder_id.validator), + ('preview_url', Metadata.preview_url.validator), ] Metadata._all_fields_ = Metadata._fields_ diff --git a/dropbox/team_log.py b/dropbox/team_log.py index 08ca6d00..4fe46ec1 100644 --- a/dropbox/team_log.py +++ b/dropbox/team_log.py @@ -7042,6 +7042,120 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): DropboxPasswordsNewDeviceEnrolledType_validator = bv.Struct(DropboxPasswordsNewDeviceEnrolledType) +class DropboxPasswordsPolicy(bb.Union): + """ + Policy for deciding whether team users can use Dropbox Passwords + + This class acts as a tagged union. Only one of the ``is_*`` methods will + return true. To get the associated value of a tag (if one exists), use the + corresponding ``get_*`` method. + """ + + _catch_all = 'other' + # Attribute is overwritten below the class definition + default = None + # Attribute is overwritten below the class definition + disabled = None + # Attribute is overwritten below the class definition + enabled = None + # Attribute is overwritten below the class definition + other = None + + def is_default(self): + """ + Check if the union tag is ``default``. + + :rtype: bool + """ + return self._tag == 'default' + + def is_disabled(self): + """ + Check if the union tag is ``disabled``. + + :rtype: bool + """ + return self._tag == 'disabled' + + def is_enabled(self): + """ + Check if the union tag is ``enabled``. + + :rtype: bool + """ + return self._tag == 'enabled' + + def is_other(self): + """ + Check if the union tag is ``other``. + + :rtype: bool + """ + return self._tag == 'other' + + def _process_custom_annotations(self, annotation_type, field_path, processor): + super(DropboxPasswordsPolicy, self)._process_custom_annotations(annotation_type, field_path, processor) + +DropboxPasswordsPolicy_validator = bv.Union(DropboxPasswordsPolicy) + +class DropboxPasswordsPolicyChangedDetails(bb.Struct): + """ + Changed Dropbox Passwords policy for team. + + :ivar team_log.DropboxPasswordsPolicyChangedDetails.new_value: To. + :ivar team_log.DropboxPasswordsPolicyChangedDetails.previous_value: From. + """ + + __slots__ = [ + '_new_value_value', + '_previous_value_value', + ] + + _has_required_fields = True + + def __init__(self, + new_value=None, + previous_value=None): + self._new_value_value = bb.NOT_SET + self._previous_value_value = bb.NOT_SET + if new_value is not None: + self.new_value = new_value + if previous_value is not None: + self.previous_value = previous_value + + # Instance attribute type: DropboxPasswordsPolicy (validator is set below) + new_value = bb.Attribute("new_value", user_defined=True) + + # Instance attribute type: DropboxPasswordsPolicy (validator is set below) + previous_value = bb.Attribute("previous_value", user_defined=True) + + def _process_custom_annotations(self, annotation_type, field_path, processor): + super(DropboxPasswordsPolicyChangedDetails, self)._process_custom_annotations(annotation_type, field_path, processor) + +DropboxPasswordsPolicyChangedDetails_validator = bv.Struct(DropboxPasswordsPolicyChangedDetails) + +class DropboxPasswordsPolicyChangedType(bb.Struct): + + __slots__ = [ + '_description_value', + ] + + _has_required_fields = True + + def __init__(self, + description=None): + self._description_value = bb.NOT_SET + if description is not None: + self.description = description + + # Instance attribute type: str (validator is set below) + description = bb.Attribute("description") + + def _process_custom_annotations(self, annotation_type, field_path, processor): + super(DropboxPasswordsPolicyChangedType, self)._process_custom_annotations(annotation_type, field_path, processor) + +DropboxPasswordsPolicyChangedType_validator = bv.Struct(DropboxPasswordsPolicyChangedType) + class DurationLogInfo(bb.Struct): """ Represents a time duration: unit and amount @@ -12237,6 +12351,17 @@ def directory_restrictions_remove_members_details(cls, val): """ return cls('directory_restrictions_remove_members_details', val) + @classmethod + def dropbox_passwords_policy_changed_details(cls, val): + """ + Create an instance of this class set to the + ``dropbox_passwords_policy_changed_details`` tag with value ``val``. + + :param DropboxPasswordsPolicyChangedDetails val: + :rtype: EventDetails + """ + return cls('dropbox_passwords_policy_changed_details', val) + @classmethod def email_ingest_policy_changed_details(cls, val): """ @@ -16428,6 +16553,14 @@ def is_directory_restrictions_remove_members_details(self): """ return self._tag == 'directory_restrictions_remove_members_details' + def is_dropbox_passwords_policy_changed_details(self): + """ + Check if the union tag is ``dropbox_passwords_policy_changed_details``. + + :rtype: bool + """ + return self._tag == 'dropbox_passwords_policy_changed_details' + def is_email_ingest_policy_changed_details(self): """ Check if the union tag is ``email_ingest_policy_changed_details``. @@ -21006,6 +21139,16 @@ def get_directory_restrictions_remove_members_details(self): raise AttributeError("tag 'directory_restrictions_remove_members_details' not set") return self._value + def get_dropbox_passwords_policy_changed_details(self): + """ + Only call this if :meth:`is_dropbox_passwords_policy_changed_details` is true. + + :rtype: DropboxPasswordsPolicyChangedDetails + """ + if not self.is_dropbox_passwords_policy_changed_details(): + raise AttributeError("tag 'dropbox_passwords_policy_changed_details' not set") + return self._value + def get_email_ingest_policy_changed_details(self): """ Only call this if :meth:`is_email_ingest_policy_changed_details` is true. @@ -22983,6 +23126,9 @@ class EventType(bb.Union): :ivar DirectoryRestrictionsRemoveMembersType EventType.directory_restrictions_remove_members: (team_policies) Removed members from directory restrictions list + :ivar DropboxPasswordsPolicyChangedType + EventType.dropbox_passwords_policy_changed: (team_policies) Changed + Dropbox Passwords policy for team :ivar EmailIngestPolicyChangedType EventType.email_ingest_policy_changed: (team_policies) Changed email to Dropbox policy for team :ivar EmmAddExceptionType EventType.emm_add_exception: (team_policies) Added @@ -27353,6 +27499,17 @@ def directory_restrictions_remove_members(cls, val): """ return cls('directory_restrictions_remove_members', val) + @classmethod + def dropbox_passwords_policy_changed(cls, val): + """ + Create an instance of this class set to the + ``dropbox_passwords_policy_changed`` tag with value ``val``. + + :param DropboxPasswordsPolicyChangedType val: + :rtype: EventType + """ + return cls('dropbox_passwords_policy_changed', val) + @classmethod def email_ingest_policy_changed(cls, val): """ @@ -31519,6 +31676,14 @@ def is_directory_restrictions_remove_members(self): """ return self._tag == 'directory_restrictions_remove_members' + def is_dropbox_passwords_policy_changed(self): + """ + Check if the union tag is ``dropbox_passwords_policy_changed``. + + :rtype: bool + """ + return self._tag == 'dropbox_passwords_policy_changed' + def is_email_ingest_policy_changed(self): """ Check if the union tag is ``email_ingest_policy_changed``. @@ -36877,6 +37042,18 @@ def get_directory_restrictions_remove_members(self): raise AttributeError("tag 'directory_restrictions_remove_members' not set") return self._value + def get_dropbox_passwords_policy_changed(self): + """ + (team_policies) Changed Dropbox Passwords policy for team + + Only call this if :meth:`is_dropbox_passwords_policy_changed` is true. + + :rtype: DropboxPasswordsPolicyChangedType + """ + if not self.is_dropbox_passwords_policy_changed(): + raise AttributeError("tag 'dropbox_passwords_policy_changed' not set") + return self._value + def get_email_ingest_policy_changed(self): """ (team_policies) Changed email to Dropbox policy for team @@ -38966,6 +39143,8 @@ class EventTypeArg(bb.Union): (team_policies) Added members to directory restrictions list :ivar team_log.EventTypeArg.directory_restrictions_remove_members: (team_policies) Removed members from directory restrictions list + :ivar team_log.EventTypeArg.dropbox_passwords_policy_changed: + (team_policies) Changed Dropbox Passwords policy for team :ivar team_log.EventTypeArg.email_ingest_policy_changed: (team_policies) Changed email to Dropbox policy for team :ivar team_log.EventTypeArg.emm_add_exception: (team_policies) Added members @@ -39963,6 +40142,8 @@ class EventTypeArg(bb.Union): # Attribute is overwritten below the class definition directory_restrictions_remove_members = None # Attribute is overwritten below the class definition + dropbox_passwords_policy_changed = None + # Attribute is overwritten below the class definition email_ingest_policy_changed = None # Attribute is overwritten below the class definition emm_add_exception = None @@ -43135,6 +43316,14 @@ def is_directory_restrictions_remove_members(self): """ return self._tag == 'directory_restrictions_remove_members' + def is_dropbox_passwords_policy_changed(self): + """ + Check if the union tag is ``dropbox_passwords_policy_changed``. + + :rtype: bool + """ + return self._tag == 'dropbox_passwords_policy_changed' + def is_email_ingest_policy_changed(self): """ Check if the union tag is ``email_ingest_policy_changed``. @@ -73884,6 +74073,37 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): DropboxPasswordsNewDeviceEnrolledType._all_field_names_ = set(['description']) DropboxPasswordsNewDeviceEnrolledType._all_fields_ = [('description', DropboxPasswordsNewDeviceEnrolledType.description.validator)] +DropboxPasswordsPolicy._default_validator = bv.Void() +DropboxPasswordsPolicy._disabled_validator = bv.Void() +DropboxPasswordsPolicy._enabled_validator = bv.Void() +DropboxPasswordsPolicy._other_validator = bv.Void() +DropboxPasswordsPolicy._tagmap = { + 'default': DropboxPasswordsPolicy._default_validator, + 'disabled': DropboxPasswordsPolicy._disabled_validator, + 'enabled': DropboxPasswordsPolicy._enabled_validator, + 'other': DropboxPasswordsPolicy._other_validator, +} + +DropboxPasswordsPolicy.default = DropboxPasswordsPolicy('default') +DropboxPasswordsPolicy.disabled = DropboxPasswordsPolicy('disabled') +DropboxPasswordsPolicy.enabled = DropboxPasswordsPolicy('enabled') +DropboxPasswordsPolicy.other = DropboxPasswordsPolicy('other') + +DropboxPasswordsPolicyChangedDetails.new_value.validator = DropboxPasswordsPolicy_validator +DropboxPasswordsPolicyChangedDetails.previous_value.validator = DropboxPasswordsPolicy_validator +DropboxPasswordsPolicyChangedDetails._all_field_names_ = set([ + 'new_value', + 'previous_value', +]) +DropboxPasswordsPolicyChangedDetails._all_fields_ = [ + ('new_value', DropboxPasswordsPolicyChangedDetails.new_value.validator), + ('previous_value', DropboxPasswordsPolicyChangedDetails.previous_value.validator), +] + +DropboxPasswordsPolicyChangedType.description.validator = bv.String() +DropboxPasswordsPolicyChangedType._all_field_names_ = set(['description']) +DropboxPasswordsPolicyChangedType._all_fields_ = [('description', DropboxPasswordsPolicyChangedType.description.validator)] + DurationLogInfo.unit.validator = TimeUnit_validator DurationLogInfo.amount.validator = bv.UInt64() DurationLogInfo._all_field_names_ = set([ @@ -74503,6 +74723,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): EventDetails._device_approvals_remove_exception_details_validator = DeviceApprovalsRemoveExceptionDetails_validator EventDetails._directory_restrictions_add_members_details_validator = DirectoryRestrictionsAddMembersDetails_validator EventDetails._directory_restrictions_remove_members_details_validator = DirectoryRestrictionsRemoveMembersDetails_validator +EventDetails._dropbox_passwords_policy_changed_details_validator = DropboxPasswordsPolicyChangedDetails_validator EventDetails._email_ingest_policy_changed_details_validator = EmailIngestPolicyChangedDetails_validator EventDetails._emm_add_exception_details_validator = EmmAddExceptionDetails_validator EventDetails._emm_change_policy_details_validator = EmmChangePolicyDetails_validator @@ -74984,6 +75205,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): 'device_approvals_remove_exception_details': EventDetails._device_approvals_remove_exception_details_validator, 'directory_restrictions_add_members_details': EventDetails._directory_restrictions_add_members_details_validator, 'directory_restrictions_remove_members_details': EventDetails._directory_restrictions_remove_members_details_validator, + 'dropbox_passwords_policy_changed_details': EventDetails._dropbox_passwords_policy_changed_details_validator, 'email_ingest_policy_changed_details': EventDetails._email_ingest_policy_changed_details_validator, 'emm_add_exception_details': EventDetails._emm_add_exception_details_validator, 'emm_change_policy_details': EventDetails._emm_change_policy_details_validator, @@ -75468,6 +75690,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): EventType._device_approvals_remove_exception_validator = DeviceApprovalsRemoveExceptionType_validator EventType._directory_restrictions_add_members_validator = DirectoryRestrictionsAddMembersType_validator EventType._directory_restrictions_remove_members_validator = DirectoryRestrictionsRemoveMembersType_validator +EventType._dropbox_passwords_policy_changed_validator = DropboxPasswordsPolicyChangedType_validator EventType._email_ingest_policy_changed_validator = EmailIngestPolicyChangedType_validator EventType._emm_add_exception_validator = EmmAddExceptionType_validator EventType._emm_change_policy_validator = EmmChangePolicyType_validator @@ -75948,6 +76171,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): 'device_approvals_remove_exception': EventType._device_approvals_remove_exception_validator, 'directory_restrictions_add_members': EventType._directory_restrictions_add_members_validator, 'directory_restrictions_remove_members': EventType._directory_restrictions_remove_members_validator, + 'dropbox_passwords_policy_changed': EventType._dropbox_passwords_policy_changed_validator, 'email_ingest_policy_changed': EventType._email_ingest_policy_changed_validator, 'emm_add_exception': EventType._emm_add_exception_validator, 'emm_change_policy': EventType._emm_change_policy_validator, @@ -76431,6 +76655,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): EventTypeArg._device_approvals_remove_exception_validator = bv.Void() EventTypeArg._directory_restrictions_add_members_validator = bv.Void() EventTypeArg._directory_restrictions_remove_members_validator = bv.Void() +EventTypeArg._dropbox_passwords_policy_changed_validator = bv.Void() EventTypeArg._email_ingest_policy_changed_validator = bv.Void() EventTypeArg._emm_add_exception_validator = bv.Void() EventTypeArg._emm_change_policy_validator = bv.Void() @@ -76911,6 +77136,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): 'device_approvals_remove_exception': EventTypeArg._device_approvals_remove_exception_validator, 'directory_restrictions_add_members': EventTypeArg._directory_restrictions_add_members_validator, 'directory_restrictions_remove_members': EventTypeArg._directory_restrictions_remove_members_validator, + 'dropbox_passwords_policy_changed': EventTypeArg._dropbox_passwords_policy_changed_validator, 'email_ingest_policy_changed': EventTypeArg._email_ingest_policy_changed_validator, 'emm_add_exception': EventTypeArg._emm_add_exception_validator, 'emm_change_policy': EventTypeArg._emm_change_policy_validator, @@ -77392,6 +77618,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor): EventTypeArg.device_approvals_remove_exception = EventTypeArg('device_approvals_remove_exception') EventTypeArg.directory_restrictions_add_members = EventTypeArg('directory_restrictions_add_members') EventTypeArg.directory_restrictions_remove_members = EventTypeArg('directory_restrictions_remove_members') +EventTypeArg.dropbox_passwords_policy_changed = EventTypeArg('dropbox_passwords_policy_changed') EventTypeArg.email_ingest_policy_changed = EventTypeArg('email_ingest_policy_changed') EventTypeArg.emm_add_exception = EventTypeArg('emm_add_exception') EventTypeArg.emm_change_policy = EventTypeArg('emm_change_policy') diff --git a/spec b/spec index 9daf01c5..eec4b436 160000 --- a/spec +++ b/spec @@ -1 +1 @@ -Subproject commit 9daf01c5b7ac6936956f085792c573c06fb3c905 +Subproject commit eec4b43685b7af842d320efaaa86db27232cb465