Skip to content

Commit

Permalink
Manual Spec Update (#498)
Browse files Browse the repository at this point in the history
Manual Spec Update
c8364404953d875801d496a81f786c5545f78223
  • Loading branch information
maxbelanger committed May 13, 2024
1 parent 41e4b00 commit 5c6809d
Show file tree
Hide file tree
Showing 10 changed files with 2,710 additions and 17 deletions.
2 changes: 1 addition & 1 deletion dropbox/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
token_from_oauth1 = bb.Route(
'token/from_oauth1',
1,
False,
True,
TokenFromOAuth1Arg_validator,
TokenFromOAuth1Result_validator,
TokenFromOAuth1Error_validator,
Expand Down
6 changes: 5 additions & 1 deletion dropbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def auth_token_from_oauth1(self,
If this raises, ApiError will contain:
:class:`dropbox.auth.TokenFromOAuth1Error`
"""
warnings.warn(
'token/from_oauth1 is deprecated.',
DeprecationWarning,
)
arg = auth.TokenFromOAuth1Arg(oauth1_token,
oauth1_token_secret)
r = self.request(
Expand Down Expand Up @@ -2880,7 +2884,7 @@ def files_save_url(self,
url):
"""
Save the data from a specified URL into a file in user's Dropbox. Note
that the transfer from the URL must complete within 5 minutes, or the
that the transfer from the URL must complete within 15 minutes, or the
operation will time out and the job will fail. If the given path already
exists, the file will be renamed to avoid the conflict (e.g. myfile
(1).txt).
Expand Down
16 changes: 12 additions & 4 deletions dropbox/base_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -1257,8 +1257,10 @@ def team_member_space_limits_excluded_users_remove(self,
def team_member_space_limits_get_custom_quota(self,
users):
"""
Get users custom quota. Returns none as the custom quota if none was
set. A maximum of 1000 members can be specified in a single call.
Get users custom quota. A maximum of 1000 members can be specified in a
single call. Note: to apply a custom space limit, a team admin needs to
set a member space limit for the team first. (the team admin can check
the settings here: https://www.dropbox.com/team/admin/settings/space).
Route attributes:
scope: members.read
Expand All @@ -1283,7 +1285,10 @@ def team_member_space_limits_remove_custom_quota(self,
users):
"""
Remove users custom quota. A maximum of 1000 members can be specified in
a single call.
a single call. Note: to apply a custom space limit, a team admin needs
to set a member space limit for the team first. (the team admin can
check the settings here:
https://www.dropbox.com/team/admin/settings/space).
Route attributes:
scope: members.write
Expand All @@ -1308,7 +1313,10 @@ def team_member_space_limits_set_custom_quota(self,
users_and_quotas):
"""
Set users custom quota. Custom quota has to be at least 15GB. A maximum
of 1000 members can be specified in a single call.
of 1000 members can be specified in a single call. Note: to apply a
custom space limit, a team admin needs to set a member space limit for
the team first. (the team admin can check the settings here:
https://www.dropbox.com/team/admin/settings/space).
Route attributes:
scope: members.read
Expand Down
2 changes: 1 addition & 1 deletion dropbox/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class EchoArg(bb.Struct):
"""
EchoArg contains the arguments to be sent to the Dropbox servers.
Contains the arguments to be sent to the Dropbox servers.
:ivar check.EchoArg.query: The string that you'd like to be echoed back to
you.
Expand Down
6 changes: 3 additions & 3 deletions dropbox/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -10868,7 +10868,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
SearchV2Cursor_validator = bv.String(min_length=1)
Sha256HexHash_validator = bv.String(min_length=64, max_length=64)
SharedLinkUrl_validator = bv.String()
TagText_validator = bv.String(min_length=1, max_length=32, pattern='[A-Za-z0-9_]+')
TagText_validator = bv.String(min_length=1, max_length=32, pattern='[\\w]+')
WritePath_validator = bv.String(pattern='(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)')
WritePathOrId_validator = bv.String(pattern='(/(.|[\\r\\n])*)|(ns:[0-9]+(/.*)?)|(id:.*)')
AddTagArg.path.validator = Path_validator
Expand Down Expand Up @@ -11086,7 +11086,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
('parent_rev', DeleteArg.parent_rev.validator),
]

DeleteBatchArg.entries.validator = bv.List(DeleteArg_validator)
DeleteBatchArg.entries.validator = bv.List(DeleteArg_validator, max_items=1000)
DeleteBatchArg._all_field_names_ = set(['entries'])
DeleteBatchArg._all_fields_ = [('entries', DeleteBatchArg.entries.validator)]

Expand Down Expand Up @@ -11979,7 +11979,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
('rev', MinimalFileLinkMetadata.rev.validator),
]

RelocationBatchArgBase.entries.validator = bv.List(RelocationPath_validator, min_items=1)
RelocationBatchArgBase.entries.validator = bv.List(RelocationPath_validator, min_items=1, max_items=1000)
RelocationBatchArgBase.autorename.validator = bv.Boolean()
RelocationBatchArgBase._all_field_names_ = set([
'entries',
Expand Down
54 changes: 51 additions & 3 deletions dropbox/sharing.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ class AccessLevel(bb.Union):
the shared folder and does not have any access to comments.
:ivar sharing.AccessLevel.traverse: The collaborator can only view the
shared folder that they have access to.
:ivar sharing.AccessLevel.no_access: If there is a Righteous Link on the
folder which grants access and the user has visited such link, they are
allowed to perform certain action (i.e. add themselves to the folder)
via the link access even though the user themselves are not a member on
the shared folder yet.
"""

_catch_all = 'other'
Expand All @@ -104,6 +109,8 @@ class AccessLevel(bb.Union):
# Attribute is overwritten below the class definition
traverse = None
# Attribute is overwritten below the class definition
no_access = None
# Attribute is overwritten below the class definition
other = None

def is_owner(self):
Expand Down Expand Up @@ -146,6 +153,14 @@ def is_traverse(self):
"""
return self._tag == 'traverse'

def is_no_access(self):
"""
Check if the union tag is ``no_access``.
:rtype: bool
"""
return self._tag == 'no_access'

def is_other(self):
"""
Check if the union tag is ``other``.
Expand Down Expand Up @@ -7909,8 +7924,8 @@ class ShareFolderArgBase(bb.Struct):
happen asynchronously.
:ivar sharing.ShareFolderArgBase.member_policy: Who can be a member of this
shared folder. Only applicable if the current user is on a team.
:ivar sharing.ShareFolderArgBase.path: The path to the folder to share. If
it does not exist, then a new one is created.
:ivar sharing.ShareFolderArgBase.path: The path or the file id to the folder
to share. If it does not exist, then a new one is created.
:ivar sharing.ShareFolderArgBase.shared_link_policy: The policy to apply to
shared links created for content inside this shared folder. The current
user must be on a team to set this policy to
Expand Down Expand Up @@ -8815,6 +8830,8 @@ class SharedFolderAccessError(bb.Union):
invalid.
:ivar sharing.SharedFolderAccessError.not_a_member: The user is not a member
of the shared folder thus cannot access it.
:ivar sharing.SharedFolderAccessError.invalid_member: The user does not
exist or their account is disabled.
:ivar sharing.SharedFolderAccessError.email_unverified: Never set.
:ivar sharing.SharedFolderAccessError.unmounted: The shared folder is
unmounted.
Expand All @@ -8826,6 +8843,8 @@ class SharedFolderAccessError(bb.Union):
# Attribute is overwritten below the class definition
not_a_member = None
# Attribute is overwritten below the class definition
invalid_member = None
# Attribute is overwritten below the class definition
email_unverified = None
# Attribute is overwritten below the class definition
unmounted = None
Expand All @@ -8848,6 +8867,14 @@ def is_not_a_member(self):
"""
return self._tag == 'not_a_member'

def is_invalid_member(self):
"""
Check if the union tag is ``invalid_member``.
:rtype: bool
"""
return self._tag == 'invalid_member'

def is_email_unverified(self):
"""
Check if the union tag is ``email_unverified``.
Expand Down Expand Up @@ -9039,6 +9066,8 @@ class SharedFolderMetadataBase(bb.Struct):
:ivar sharing.SharedFolderMetadataBase.parent_shared_folder_id: The ID of
the parent shared folder. This field is present only if the folder is
contained within another shared folder.
:ivar sharing.SharedFolderMetadataBase.path_display: The full path of this
shared folder. Absent for unmounted folders.
:ivar sharing.SharedFolderMetadataBase.path_lower: The lower-cased full path
of this shared folder. Absent for unmounted folders.
:ivar sharing.SharedFolderMetadataBase.parent_folder_name: Display name for
Expand All @@ -9052,6 +9081,7 @@ class SharedFolderMetadataBase(bb.Struct):
'_owner_display_names_value',
'_owner_team_value',
'_parent_shared_folder_id_value',
'_path_display_value',
'_path_lower_value',
'_parent_folder_name_value',
]
Expand All @@ -9065,6 +9095,7 @@ def __init__(self,
owner_display_names=None,
owner_team=None,
parent_shared_folder_id=None,
path_display=None,
path_lower=None,
parent_folder_name=None):
self._access_type_value = bb.NOT_SET
Expand All @@ -9073,6 +9104,7 @@ def __init__(self,
self._owner_display_names_value = bb.NOT_SET
self._owner_team_value = bb.NOT_SET
self._parent_shared_folder_id_value = bb.NOT_SET
self._path_display_value = bb.NOT_SET
self._path_lower_value = bb.NOT_SET
self._parent_folder_name_value = bb.NOT_SET
if access_type is not None:
Expand All @@ -9087,6 +9119,8 @@ def __init__(self,
self.owner_team = owner_team
if parent_shared_folder_id is not None:
self.parent_shared_folder_id = parent_shared_folder_id
if path_display is not None:
self.path_display = path_display
if path_lower is not None:
self.path_lower = path_lower
if parent_folder_name is not None:
Expand All @@ -9110,6 +9144,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)
path_display = bb.Attribute("path_display", nullable=True)

# Instance attribute type: str (validator is set below)
path_lower = bb.Attribute("path_lower", nullable=True)

Expand Down Expand Up @@ -9169,6 +9206,7 @@ def __init__(self,
owner_display_names=None,
owner_team=None,
parent_shared_folder_id=None,
path_display=None,
path_lower=None,
parent_folder_name=None,
link_metadata=None,
Expand All @@ -9180,6 +9218,7 @@ def __init__(self,
owner_display_names,
owner_team,
parent_shared_folder_id,
path_display,
path_lower,
parent_folder_name)
self._link_metadata_value = bb.NOT_SET
Expand Down Expand Up @@ -11093,13 +11132,15 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
AccessLevel._viewer_validator = bv.Void()
AccessLevel._viewer_no_comment_validator = bv.Void()
AccessLevel._traverse_validator = bv.Void()
AccessLevel._no_access_validator = bv.Void()
AccessLevel._other_validator = bv.Void()
AccessLevel._tagmap = {
'owner': AccessLevel._owner_validator,
'editor': AccessLevel._editor_validator,
'viewer': AccessLevel._viewer_validator,
'viewer_no_comment': AccessLevel._viewer_no_comment_validator,
'traverse': AccessLevel._traverse_validator,
'no_access': AccessLevel._no_access_validator,
'other': AccessLevel._other_validator,
}

Expand All @@ -11108,6 +11149,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
AccessLevel.viewer = AccessLevel('viewer')
AccessLevel.viewer_no_comment = AccessLevel('viewer_no_comment')
AccessLevel.traverse = AccessLevel('traverse')
AccessLevel.no_access = AccessLevel('no_access')
AccessLevel.other = AccessLevel('other')

AclUpdatePolicy._owner_validator = bv.Void()
Expand Down Expand Up @@ -12781,7 +12823,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
ShareFolderArgBase.acl_update_policy.validator = bv.Nullable(AclUpdatePolicy_validator)
ShareFolderArgBase.force_async.validator = bv.Boolean()
ShareFolderArgBase.member_policy.validator = bv.Nullable(MemberPolicy_validator)
ShareFolderArgBase.path.validator = files.WritePath_validator
ShareFolderArgBase.path.validator = files.WritePathOrId_validator
ShareFolderArgBase.shared_link_policy.validator = bv.Nullable(SharedLinkPolicy_validator)
ShareFolderArgBase.viewer_info_policy.validator = bv.Nullable(ViewerInfoPolicy_validator)
ShareFolderArgBase.access_inheritance.validator = AccessInheritance_validator
Expand Down Expand Up @@ -12986,19 +13028,22 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):

SharedFolderAccessError._invalid_id_validator = bv.Void()
SharedFolderAccessError._not_a_member_validator = bv.Void()
SharedFolderAccessError._invalid_member_validator = bv.Void()
SharedFolderAccessError._email_unverified_validator = bv.Void()
SharedFolderAccessError._unmounted_validator = bv.Void()
SharedFolderAccessError._other_validator = bv.Void()
SharedFolderAccessError._tagmap = {
'invalid_id': SharedFolderAccessError._invalid_id_validator,
'not_a_member': SharedFolderAccessError._not_a_member_validator,
'invalid_member': SharedFolderAccessError._invalid_member_validator,
'email_unverified': SharedFolderAccessError._email_unverified_validator,
'unmounted': SharedFolderAccessError._unmounted_validator,
'other': SharedFolderAccessError._other_validator,
}

SharedFolderAccessError.invalid_id = SharedFolderAccessError('invalid_id')
SharedFolderAccessError.not_a_member = SharedFolderAccessError('not_a_member')
SharedFolderAccessError.invalid_member = SharedFolderAccessError('invalid_member')
SharedFolderAccessError.email_unverified = SharedFolderAccessError('email_unverified')
SharedFolderAccessError.unmounted = SharedFolderAccessError('unmounted')
SharedFolderAccessError.other = SharedFolderAccessError('other')
Expand Down Expand Up @@ -13041,6 +13086,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
SharedFolderMetadataBase.owner_display_names.validator = bv.Nullable(bv.List(bv.String()))
SharedFolderMetadataBase.owner_team.validator = bv.Nullable(users.Team_validator)
SharedFolderMetadataBase.parent_shared_folder_id.validator = bv.Nullable(common.SharedFolderId_validator)
SharedFolderMetadataBase.path_display.validator = bv.Nullable(bv.String())
SharedFolderMetadataBase.path_lower.validator = bv.Nullable(bv.String())
SharedFolderMetadataBase.parent_folder_name.validator = bv.Nullable(bv.String())
SharedFolderMetadataBase._all_field_names_ = set([
Expand All @@ -13050,6 +13096,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
'owner_display_names',
'owner_team',
'parent_shared_folder_id',
'path_display',
'path_lower',
'parent_folder_name',
])
Expand All @@ -13060,6 +13107,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
('owner_display_names', SharedFolderMetadataBase.owner_display_names.validator),
('owner_team', SharedFolderMetadataBase.owner_team.validator),
('parent_shared_folder_id', SharedFolderMetadataBase.parent_shared_folder_id.validator),
('path_display', SharedFolderMetadataBase.path_display.validator),
('path_lower', SharedFolderMetadataBase.path_lower.validator),
('parent_folder_name', SharedFolderMetadataBase.parent_folder_name.validator),
]
Expand Down
5 changes: 3 additions & 2 deletions dropbox/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -12396,8 +12396,8 @@ def __init__(self,
team_id=None,
num_licensed_users=None,
num_provisioned_users=None,
num_used_licenses=None,
policies=None):
policies=None,
num_used_licenses=None):
self._name_value = bb.NOT_SET
self._team_id_value = bb.NOT_SET
self._num_licensed_users_value = bb.NOT_SET
Expand Down Expand Up @@ -16980,6 +16980,7 @@ def _process_custom_annotations(self, annotation_type, field_path, processor):
SharingAllowlistListResponse.has_more.default = False
TeamFolderArchiveArg.force_async_off.default = False
TeamFolderListArg.limit.default = 1000
TeamGetInfoResult.num_used_licenses.default = 0
TeamNamespacesListArg.limit.default = 1000
devices_list_member_devices = bb.Route(
'devices/list_member_devices',
Expand Down

0 comments on commit 5c6809d

Please sign in to comment.