Skip to content

Commit d463689

Browse files
committed
new types for Teams API
1 parent 9194b08 commit d463689

10 files changed

+76
-6
lines changed

office365/onedrive/driveitems/driveItem.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,9 @@ def _process_response(response):
449449
chunk_downloaded(bytes_read)
450450
file_object.write(chunk)
451451

452-
self.get_content().before_execute(_construct_request)
453-
self.context.after_execute(_process_response)
452+
self.get_content().before_execute(_construct_request).after_execute(
453+
_process_response, include_response=True
454+
)
454455
return self
455456

456457
def create_folder(self, name, conflict_behavior=ConflictBehavior.Rename):

office365/runtime/client_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def execute_query_retry(
8686
def before_execute(self, action):
8787
# type: (Callable[[RequestOptions], None]) -> Self
8888
"""Attach an event handler to client object which gets triggered after query is submitted to server"""
89-
self.context.before_execute(action)
89+
self.context.before_query_execute(action)
9090
return self
9191

9292
def after_execute(self, action, execute_first=False, include_response=False):

office365/runtime/client_result.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ def before_execute(self, action):
2828
self._context.before_query_execute(action)
2929
return self
3030

31-
def after_execute(self, action, execute_first=False):
32-
# type: (Callable[[Self], None], bool) -> Self
31+
def after_execute(self, action, execute_first=False, include_response=False):
32+
# type: (Callable[[Self], None], bool, bool) -> Self
3333
"""Attach an event handler which is triggered after query is submitted to server"""
34-
self._context.after_query_execute(action, execute_first)
34+
self._context.after_query_execute(action, execute_first, include_response)
3535
return self
3636

3737
def set_property(self, key, value, persist_changes=False):

office365/teams/apps/authorization.py

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from office365.runtime.client_value import ClientValue
2+
from office365.teams.apps.permission_set import TeamsAppPermissionSet
3+
4+
5+
class TeamsAppAuthorization(ClientValue):
6+
"""The authorization details of a teamsApp."""
7+
8+
def __init__(
9+
self, client_app_id=None, required_permission_set=TeamsAppPermissionSet()
10+
):
11+
"""
12+
:param str client_app_id: The registration ID of the Microsoft Entra app ID associated with the teamsApp.
13+
:param TeamsAppPermissionSet required_permission_set: Set of permissions required by the teamsApp.
14+
"""
15+
self.clientAppId = client_app_id
16+
self.requiredPermissionSet = required_permission_set
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from office365.runtime.client_value import ClientValue
2+
from office365.runtime.client_value_collection import ClientValueCollection
3+
from office365.teams.apps.resource_specific_permission import (
4+
TeamsAppResourceSpecificPermission,
5+
)
6+
7+
8+
class TeamsAppPermissionSet(ClientValue):
9+
"""Set of required/granted permissions that can be associated with a Teams app."""
10+
11+
def __init__(self, resource_specific_permissions=None):
12+
self.resourceSpecificPermissions = ClientValueCollection(
13+
TeamsAppResourceSpecificPermission, resource_specific_permissions
14+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class TeamsAppResourceSpecificPermission(ClientValue):
5+
"""Represents the resource-specific permission associated with a teamsApp."""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class EventMessageDetail(ClientValue):
5+
"""Represents details of a system event message.
6+
7+
System messages are messages generated for events such as members added to a channel, members added to a chat,
8+
and team description updated."""

office365/teams/chats/viewpoint.py

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.runtime.client_value import ClientValue
2+
3+
4+
class ChatViewpoint(ClientValue):
5+
""""""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from office365.runtime.client_value import ClientValue
2+
from office365.teams.teamwork.user_identity import TeamworkUserIdentity
3+
4+
5+
class TeamworkOnlineMeetingInfo(ClientValue):
6+
"""Represents details about an online meeting in Microsoft Teams."""
7+
8+
def __init__(self, calendar_event_id=None, join_web_url=None, organizer=TeamworkUserIdentity()):
9+
"""
10+
:param calendar_event_id: The identifier of the calendar event associated with the meeting.
11+
:param join_web_url: The URL that users click to join or uniquely identify the meeting.
12+
:param organizer: The organizer associated with the meeting.
13+
"""
14+
self.calendarEventId = calendar_event_id
15+
self.joinWebUrl = join_web_url
16+
self.organizer = organizer
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from office365.directory.permissions.identity import Identity
2+
3+
4+
class TeamworkUserIdentity(Identity):
5+
"""Represents a user in Microsoft Teams."""

0 commit comments

Comments
 (0)