Skip to content

Commit 0a24600

Browse files
authored
Fixed mappings of business API endpoints. (#149)
1 parent 209bf39 commit 0a24600

File tree

3 files changed

+82
-67
lines changed

3 files changed

+82
-67
lines changed

dropbox/base.py

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -4184,71 +4184,6 @@ def sharing_update_folder_policy(self,
41844184
)
41854185
return r
41864186

4187-
# ------------------------------------------
4188-
# Routes in team_log namespace
4189-
4190-
def team_log_get_events(self,
4191-
limit=1000,
4192-
account_id=None,
4193-
time=None,
4194-
category=None):
4195-
"""
4196-
Retrieves team events. Events have a lifespan of two years. Events older
4197-
than two years will not be returned. Many attributes note 'may be
4198-
missing due to historical data gap'. Note that the file_operations
4199-
category and & analogous paper events are not available on all Dropbox
4200-
Business `plans </business/plans-comparison>`_. Use `features/get_values
4201-
</developers/documentation/http/teams#team-features-get_values>`_ to
4202-
check for this feature. Permission : Team Auditing.
4203-
4204-
:param long limit: Number of results to return per call.
4205-
:param Nullable account_id: Filter the events by account ID. Return ony
4206-
events with this account_id as either Actor, Context, or
4207-
Participants.
4208-
:param Nullable time: Filter by time range.
4209-
:param Nullable category: Filter the returned events to a single
4210-
category.
4211-
:rtype: :class:`dropbox.team_log.GetTeamEventsResult`
4212-
:raises: :class:`.exceptions.ApiError`
4213-
4214-
If this raises, ApiError will contain:
4215-
:class:`dropbox.team_log.GetTeamEventsError`
4216-
"""
4217-
arg = team_log.GetTeamEventsArg(limit,
4218-
account_id,
4219-
time,
4220-
category)
4221-
r = self.request(
4222-
team_log.get_events,
4223-
'team_log',
4224-
arg,
4225-
None,
4226-
)
4227-
return r
4228-
4229-
def team_log_get_events_continue(self,
4230-
cursor):
4231-
"""
4232-
Once a cursor has been retrieved from :meth:`team_log_get_events`, use
4233-
this to paginate through all events. Permission : Team Auditing.
4234-
4235-
:param str cursor: Indicates from what point to get the next set of
4236-
events.
4237-
:rtype: :class:`dropbox.team_log.GetTeamEventsResult`
4238-
:raises: :class:`.exceptions.ApiError`
4239-
4240-
If this raises, ApiError will contain:
4241-
:class:`dropbox.team_log.GetTeamEventsContinueError`
4242-
"""
4243-
arg = team_log.GetTeamEventsContinueArg(cursor)
4244-
r = self.request(
4245-
team_log.get_events_continue,
4246-
'team_log',
4247-
arg,
4248-
None,
4249-
)
4250-
return r
4251-
42524187
# ------------------------------------------
42534188
# Routes in users namespace
42544189

dropbox/base_team.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,3 +1686,68 @@ def team_token_get_authenticated_admin(self):
16861686
)
16871687
return r
16881688

1689+
# ------------------------------------------
1690+
# Routes in team_log namespace
1691+
1692+
def team_log_get_events(self,
1693+
limit=1000,
1694+
account_id=None,
1695+
time=None,
1696+
category=None):
1697+
"""
1698+
Retrieves team events. Events have a lifespan of two years. Events older
1699+
than two years will not be returned. Many attributes note 'may be
1700+
missing due to historical data gap'. Note that the file_operations
1701+
category and & analogous paper events are not available on all Dropbox
1702+
Business `plans </business/plans-comparison>`_. Use `features/get_values
1703+
</developers/documentation/http/teams#team-features-get_values>`_ to
1704+
check for this feature. Permission : Team Auditing.
1705+
1706+
:param long limit: Number of results to return per call.
1707+
:param Nullable account_id: Filter the events by account ID. Return ony
1708+
events with this account_id as either Actor, Context, or
1709+
Participants.
1710+
:param Nullable time: Filter by time range.
1711+
:param Nullable category: Filter the returned events to a single
1712+
category.
1713+
:rtype: :class:`dropbox.team_log.GetTeamEventsResult`
1714+
:raises: :class:`.exceptions.ApiError`
1715+
1716+
If this raises, ApiError will contain:
1717+
:class:`dropbox.team_log.GetTeamEventsError`
1718+
"""
1719+
arg = team_log.GetTeamEventsArg(limit,
1720+
account_id,
1721+
time,
1722+
category)
1723+
r = self.request(
1724+
team_log.get_events,
1725+
'team_log',
1726+
arg,
1727+
None,
1728+
)
1729+
return r
1730+
1731+
def team_log_get_events_continue(self,
1732+
cursor):
1733+
"""
1734+
Once a cursor has been retrieved from :meth:`team_log_get_events`, use
1735+
this to paginate through all events. Permission : Team Auditing.
1736+
1737+
:param str cursor: Indicates from what point to get the next set of
1738+
events.
1739+
:rtype: :class:`dropbox.team_log.GetTeamEventsResult`
1740+
:raises: :class:`.exceptions.ApiError`
1741+
1742+
If this raises, ApiError will contain:
1743+
:class:`dropbox.team_log.GetTeamEventsContinueError`
1744+
"""
1745+
arg = team_log.GetTeamEventsContinueArg(cursor)
1746+
r = self.request(
1747+
team_log.get_events_continue,
1748+
'team_log',
1749+
arg,
1750+
None,
1751+
)
1752+
return r
1753+

generate_base_client.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
help='Path to clone of stone repository.',
3232
)
3333

34+
# List of namespaces for business endpoints
35+
TEAM_NAMESPACES = [
36+
'team',
37+
'team_common',
38+
'team_log',
39+
'team_policies',
40+
]
3441

3542
def main():
3643
"""The entry point for the program."""
@@ -66,16 +73,24 @@ def main():
6673

6774
if verbose:
6875
print('Generating Python client')
76+
77+
blacklist_namespace_args = []
78+
for namespace in TEAM_NAMESPACES:
79+
blacklist_namespace_args.extend(('-b', namespace))
6980
o = subprocess.check_output(
7081
(['python', '-m', 'stone.cli', 'python_client', dropbox_pkg_path] +
71-
specs + ['-a', 'host', '-a', 'style', '-b', 'team'] +
82+
specs + ['-a', 'host', '-a', 'style'] + blacklist_namespace_args +
7283
['--', '-m', 'base', '-c', 'DropboxBase', '-t', 'dropbox']),
7384
cwd=stone_path)
7485
if o:
7586
print('Output:', o)
87+
88+
whitelist_namespace_args = []
89+
for namespace in TEAM_NAMESPACES:
90+
whitelist_namespace_args.extend(('-w', namespace))
7691
o = subprocess.check_output(
7792
(['python', '-m', 'stone.cli', 'python_client', dropbox_pkg_path] +
78-
specs + ['-a', 'host', '-a', 'style', '-w', 'team'] +
93+
specs + ['-a', 'host', '-a', 'style'] + whitelist_namespace_args +
7994
['--', '-m', 'base_team', '-c', 'DropboxTeamBase', '-t', 'dropbox']),
8095
cwd=stone_path)
8196
if o:

0 commit comments

Comments
 (0)