Skip to content

Commit 791c0b0

Browse files
committed
Update API spec.
- Authentication - Add token/revoke endpoint. - Account - Add disabled field to Account. - Files - Add include_deleted and include_has_explicit_shared_members parameter to get_metadata and list_f - Add close parameter to upload_session/start endpoint to support explicitly close an upload sessi - Add upload_session/append_v2 endpoint which provides explicit session close support. upload_sess - Add copy_reference endpoint. - Add get_temporary_link endpoint. - Shared links - Add remove_expiration parameter to modify_shared_link_settings endpoint. - Shared folders - Add leave_a_copy to FolderAction. - Add time_invited to SharedFolderMetadata. - Return is_osx_package or inside_osx_package error when user attempts to share an OS X package or - Business endpoints - member_count is now optional in GroupSummary. - devices/list_team_devices endpoint is now deprecated by devices/list_member_devices. - linked_apps/list_team_linked_apps is now deprecated by linked_apps/list_members_linked_apps endp - Add return_members parameter to groups/members/set_access_type endpoint.
1 parent 48b0d70 commit 791c0b0

File tree

12 files changed

+4803
-997
lines changed

12 files changed

+4803
-997
lines changed

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959
# built documents.
6060
#
6161
# The short X.Y version.
62-
version = '6.1'
62+
version = '6.2'
6363
# The full version, including alpha/beta/rc tags.
64-
release = '6.1'
64+
release = '6.2'
6565

6666
# The language for content autogenerated by Sphinx. Refer to documentation
6767
# for a list of supported languages.

dropbox/base.py

Lines changed: 197 additions & 49 deletions
Large diffs are not rendered by default.

dropbox/base_team.py

Lines changed: 218 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
async,
99
auth,
1010
files,
11+
properties,
1112
sharing,
1213
team,
14+
team_policies,
1315
users,
1416
)
1517

@@ -61,6 +63,47 @@ def team_devices_list_member_devices(self,
6163
)
6264
return r
6365

66+
def team_devices_list_members_devices(self,
67+
cursor=None,
68+
include_web_sessions=True,
69+
include_desktop_clients=True,
70+
include_mobile_clients=True):
71+
"""
72+
List all device sessions of a team.
73+
74+
:param Nullable cursor: At the first call to the
75+
:meth:`devices_list_members_devices` the cursor shouldn't be passed.
76+
Then, if the result of the call includes a cursor, the following
77+
requests should include the received cursors in order to receive the
78+
next sub list of team devices
79+
:param bool include_web_sessions: Whether to list web sessions of the
80+
team members
81+
:param bool include_desktop_clients: Whether to list desktop clients of
82+
the team members
83+
:param bool include_mobile_clients: Whether to list mobile clients of
84+
the team members
85+
:rtype: :class:`dropbox.team.ListMembersDevicesResult`
86+
:raises: :class:`dropbox.exceptions.ApiError`
87+
88+
If this raises, ApiError.reason is of type:
89+
:class:`dropbox.team.ListMembersDevicesError`
90+
"""
91+
arg = team.ListMembersDevicesArg(cursor,
92+
include_web_sessions,
93+
include_desktop_clients,
94+
include_mobile_clients)
95+
r = self.request(
96+
'api',
97+
'team/devices/list_members_devices',
98+
'rpc',
99+
bv.Struct(team.ListMembersDevicesArg),
100+
bv.Struct(team.ListMembersDevicesResult),
101+
bv.Union(team.ListMembersDevicesError),
102+
arg,
103+
None,
104+
)
105+
return r
106+
64107
def team_devices_list_team_devices(self,
65108
cursor=None,
66109
include_web_sessions=True,
@@ -335,7 +378,8 @@ def team_groups_list_continue(self,
335378

336379
def team_groups_members_add(self,
337380
group,
338-
members):
381+
members,
382+
return_members=True):
339383
"""
340384
Adds members to a group. The members are added immediately. However the
341385
granting of group-owned resources may take additional time. Use the
@@ -352,7 +396,8 @@ def team_groups_members_add(self,
352396
:class:`dropbox.team.GroupMembersAddError`
353397
"""
354398
arg = team.GroupMembersAddArg(group,
355-
members)
399+
members,
400+
return_members)
356401
r = self.request(
357402
'api',
358403
'team/groups/members/add',
@@ -367,23 +412,26 @@ def team_groups_members_add(self,
367412

368413
def team_groups_members_remove(self,
369414
group,
370-
users):
415+
users,
416+
return_members=True):
371417
"""
372418
Removes members from a group. The members are removed immediately.
373419
However the revoking of group-owned resources may take additional time.
374420
Use the :meth:`groups_job_status_get` to determine whether this process
375421
has completed. Permission : Team member management
376422
423+
:param group: Group from which users will be removed.
377424
:type group: :class:`dropbox.team.GroupSelector`
378-
:type users: list
425+
:param list users: List of users to be removed from the group.
379426
:rtype: :class:`dropbox.team.GroupMembersChangeResult`
380427
:raises: :class:`dropbox.exceptions.ApiError`
381428
382429
If this raises, ApiError.reason is of type:
383430
:class:`dropbox.team.GroupMembersRemoveError`
384431
"""
385432
arg = team.GroupMembersRemoveArg(group,
386-
users)
433+
users,
434+
return_members)
387435
r = self.request(
388436
'api',
389437
'team/groups/members/remove',
@@ -399,36 +447,43 @@ def team_groups_members_remove(self,
399447
def team_groups_members_set_access_type(self,
400448
group,
401449
user,
402-
access_type):
450+
access_type,
451+
return_members=True):
403452
"""
404453
Sets a member's access type in a group. Permission : Team member
405454
management
406455
407456
:param access_type: New group access type the user will have.
408457
:type access_type: :class:`dropbox.team.GroupAccessType`
458+
:param bool return_members: Whether to return the list of members in the
459+
group. Note that the default value will cause all the group members
460+
to be returned in the response. This may take a long time for large
461+
groups.
409462
:rtype: list
410463
:raises: :class:`dropbox.exceptions.ApiError`
411464
412465
If this raises, ApiError.reason is of type:
413-
:class:`dropbox.team.GroupMemberSelectorError`
466+
:class:`dropbox.team.GroupMemberSetAccessTypeError`
414467
"""
415468
arg = team.GroupMembersSetAccessTypeArg(group,
416469
user,
417-
access_type)
470+
access_type,
471+
return_members)
418472
r = self.request(
419473
'api',
420474
'team/groups/members/set_access_type',
421475
'rpc',
422476
bv.Struct(team.GroupMembersSetAccessTypeArg),
423477
bv.List(bv.Union(team.GroupsGetInfoItem)),
424-
bv.Union(team.GroupMemberSelectorError),
478+
bv.Union(team.GroupMemberSetAccessTypeError),
425479
arg,
426480
None,
427481
)
428482
return r
429483

430484
def team_groups_update(self,
431485
group,
486+
return_members=True,
432487
new_group_name=None,
433488
new_group_external_id=None):
434489
"""
@@ -450,6 +505,7 @@ def team_groups_update(self,
450505
:class:`dropbox.team.GroupUpdateError`
451506
"""
452507
arg = team.GroupUpdateArgs(group,
508+
return_members,
453509
new_group_name,
454510
new_group_external_id)
455511
r = self.request(
@@ -468,7 +524,7 @@ def team_linked_apps_list_member_linked_apps(self,
468524
team_member_id):
469525
"""
470526
List all linked applications of the team member. Note, this endpoint
471-
doesn't list any team-linked applications.
527+
does not list any team-linked applications.
472528
473529
:param str team_member_id: The team member id
474530
:rtype: :class:`dropbox.team.ListMemberAppsResult`
@@ -490,6 +546,36 @@ def team_linked_apps_list_member_linked_apps(self,
490546
)
491547
return r
492548

549+
def team_linked_apps_list_members_linked_apps(self,
550+
cursor=None):
551+
"""
552+
List all applications linked to the team members' accounts. Note, this
553+
endpoint does not list any team-linked applications.
554+
555+
:param Nullable cursor: At the first call to the
556+
:meth:`linked_apps_list_members_linked_apps` the cursor shouldn't be
557+
passed. Then, if the result of the call includes a cursor, the
558+
following requests should include the received cursors in order to
559+
receive the next sub list of the team applications
560+
:rtype: :class:`dropbox.team.ListMembersAppsResult`
561+
:raises: :class:`dropbox.exceptions.ApiError`
562+
563+
If this raises, ApiError.reason is of type:
564+
:class:`dropbox.team.ListMembersAppsError`
565+
"""
566+
arg = team.ListMembersAppsArg(cursor)
567+
r = self.request(
568+
'api',
569+
'team/linked_apps/list_members_linked_apps',
570+
'rpc',
571+
bv.Struct(team.ListMembersAppsArg),
572+
bv.Struct(team.ListMembersAppsResult),
573+
bv.Union(team.ListMembersAppsError),
574+
arg,
575+
None,
576+
)
577+
return r
578+
493579
def team_linked_apps_list_team_linked_apps(self,
494580
cursor=None):
495581
"""
@@ -644,8 +730,9 @@ def team_members_get_info(self,
644730
members):
645731
"""
646732
Returns information about multiple team members. Permission : Team
647-
information This endpoint will return an empty member_info item, for IDs
648-
(or emails) that cannot be matched to a valid team member.
733+
information This endpoint will return
734+
``MembersGetInfoItem.id_not_found``, for IDs (or emails) that cannot be
735+
matched to a valid team member.
649736
650737
:param list members: List of team members.
651738
:rtype: list
@@ -948,6 +1035,125 @@ def team_members_unsuspend(self,
9481035
)
9491036
return None
9501037

1038+
def team_properties_template_add(self,
1039+
name,
1040+
description,
1041+
fields):
1042+
"""
1043+
Add a property template. See route files/properties/add to add
1044+
properties to a file.
1045+
1046+
:rtype: :class:`dropbox.team.AddPropertyTemplateResult`
1047+
:raises: :class:`dropbox.exceptions.ApiError`
1048+
1049+
If this raises, ApiError.reason is of type:
1050+
:class:`dropbox.team.ModifyPropertyTemplateError`
1051+
"""
1052+
arg = team.AddPropertyTemplateArg(name,
1053+
description,
1054+
fields)
1055+
r = self.request(
1056+
'api',
1057+
'team/properties/template/add',
1058+
'rpc',
1059+
bv.Struct(team.AddPropertyTemplateArg),
1060+
bv.Struct(team.AddPropertyTemplateResult),
1061+
bv.Union(properties.ModifyPropertyTemplateError),
1062+
arg,
1063+
None,
1064+
)
1065+
return r
1066+
1067+
def team_properties_template_get(self,
1068+
template_id):
1069+
"""
1070+
Get the schema for a specified template.
1071+
1072+
:param str template_id: An identifier for property template added by
1073+
route properties/template/add.
1074+
:rtype: :class:`dropbox.team.GetPropertyTemplateResult`
1075+
:raises: :class:`dropbox.exceptions.ApiError`
1076+
1077+
If this raises, ApiError.reason is of type:
1078+
:class:`dropbox.team.PropertyTemplateError`
1079+
"""
1080+
arg = properties.GetPropertyTemplateArg(template_id)
1081+
r = self.request(
1082+
'api',
1083+
'team/properties/template/get',
1084+
'rpc',
1085+
bv.Struct(properties.GetPropertyTemplateArg),
1086+
bv.Struct(properties.GetPropertyTemplateResult),
1087+
bv.Union(properties.PropertyTemplateError),
1088+
arg,
1089+
None,
1090+
)
1091+
return r
1092+
1093+
def team_properties_template_list(self):
1094+
"""
1095+
Get the property template identifiers for a team. To get the schema of
1096+
each template use :meth:`properties_template_get`.
1097+
1098+
:rtype: :class:`dropbox.team.ListPropertyTemplateIds`
1099+
:raises: :class:`dropbox.exceptions.ApiError`
1100+
1101+
If this raises, ApiError.reason is of type:
1102+
:class:`dropbox.team.PropertyTemplateError`
1103+
"""
1104+
arg = None
1105+
r = self.request(
1106+
'api',
1107+
'team/properties/template/list',
1108+
'rpc',
1109+
bv.Void(),
1110+
bv.Struct(properties.ListPropertyTemplateIds),
1111+
bv.Union(properties.PropertyTemplateError),
1112+
arg,
1113+
None,
1114+
)
1115+
return r
1116+
1117+
def team_properties_template_update(self,
1118+
template_id,
1119+
name=None,
1120+
description=None,
1121+
add_fields=None):
1122+
"""
1123+
Update a property template. This route can update the template name, the
1124+
template description and add optional properties to templates.
1125+
1126+
:param str template_id: An identifier for property template added by
1127+
:meth:`properties_template_add`.
1128+
:param Nullable name: A display name for the property template. Property
1129+
template names can be up to 256 bytes.
1130+
:param Nullable description: Description for new property template.
1131+
Property template descriptions can be up to 1024 bytes.
1132+
:param Nullable add_fields: This is a list of custom properties to add
1133+
to the property template. There can be up to 64 properties in a
1134+
single property template.
1135+
:rtype: :class:`dropbox.team.UpdatePropertyTemplateResult`
1136+
:raises: :class:`dropbox.exceptions.ApiError`
1137+
1138+
If this raises, ApiError.reason is of type:
1139+
:class:`dropbox.team.ModifyPropertyTemplateError`
1140+
"""
1141+
arg = team.UpdatePropertyTemplateArg(template_id,
1142+
name,
1143+
description,
1144+
add_fields)
1145+
r = self.request(
1146+
'api',
1147+
'team/properties/template/update',
1148+
'rpc',
1149+
bv.Struct(team.UpdatePropertyTemplateArg),
1150+
bv.Struct(team.UpdatePropertyTemplateResult),
1151+
bv.Union(properties.ModifyPropertyTemplateError),
1152+
arg,
1153+
None,
1154+
)
1155+
return r
1156+
9511157
def team_reports_get_activity(self,
9521158
start_date=None,
9531159
end_date=None):

dropbox/dropbox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
]
66

77
# TODO(kelkabany): We need to auto populate this as done in the v1 SDK.
8-
__version__ = '6.1'
8+
__version__ = '6.2'
99

1010
import contextlib
1111
import json
@@ -138,7 +138,7 @@ def __init__(self,
138138
:param str user_agent: The user agent to use when making requests. This
139139
helps us identify requests coming from your application. We
140140
recommend you use the format "AppName/Version". If set, we append
141-
"/OfficialDropboxPythonV2SDK/__version__" to the user_agent,
141+
"/OfficialDropboxPythonSDKv2/__version__" to the user_agent,
142142
:param session: If not provided, a new session (connection pool) is
143143
created. To share a session across multiple clients, use
144144
:func:`create_session`.

0 commit comments

Comments
 (0)