universal-mcp-applications 0.1.39rc8__py3-none-any.whl → 0.1.39rc16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of universal-mcp-applications might be problematic. Click here for more details.
- universal_mcp/applications/BEST_PRACTICES.md +1 -1
- universal_mcp/applications/airtable/app.py +13 -13
- universal_mcp/applications/apollo/app.py +2 -2
- universal_mcp/applications/aws_s3/app.py +30 -19
- universal_mcp/applications/browser_use/app.py +10 -7
- universal_mcp/applications/contentful/app.py +4 -4
- universal_mcp/applications/crustdata/app.py +2 -2
- universal_mcp/applications/e2b/app.py +3 -4
- universal_mcp/applications/elevenlabs/README.md +27 -3
- universal_mcp/applications/elevenlabs/app.py +753 -48
- universal_mcp/applications/exa/app.py +18 -11
- universal_mcp/applications/falai/README.md +5 -7
- universal_mcp/applications/falai/app.py +160 -159
- universal_mcp/applications/firecrawl/app.py +14 -15
- universal_mcp/applications/ghost_content/app.py +4 -4
- universal_mcp/applications/github/app.py +2 -2
- universal_mcp/applications/gong/app.py +2 -2
- universal_mcp/applications/google_docs/README.md +15 -14
- universal_mcp/applications/google_docs/app.py +5 -4
- universal_mcp/applications/google_gemini/app.py +61 -17
- universal_mcp/applications/google_sheet/README.md +2 -1
- universal_mcp/applications/google_sheet/app.py +55 -0
- universal_mcp/applications/heygen/README.md +10 -32
- universal_mcp/applications/heygen/app.py +350 -744
- universal_mcp/applications/klaviyo/app.py +2 -2
- universal_mcp/applications/linkedin/README.md +14 -2
- universal_mcp/applications/linkedin/app.py +411 -38
- universal_mcp/applications/ms_teams/app.py +420 -1285
- universal_mcp/applications/notion/app.py +2 -2
- universal_mcp/applications/openai/app.py +1 -1
- universal_mcp/applications/perplexity/app.py +6 -7
- universal_mcp/applications/reddit/app.py +4 -4
- universal_mcp/applications/resend/app.py +31 -32
- universal_mcp/applications/rocketlane/app.py +2 -2
- universal_mcp/applications/scraper/app.py +51 -21
- universal_mcp/applications/semrush/app.py +1 -1
- universal_mcp/applications/serpapi/app.py +8 -7
- universal_mcp/applications/shopify/app.py +5 -7
- universal_mcp/applications/shortcut/app.py +3 -2
- universal_mcp/applications/slack/app.py +2 -2
- universal_mcp/applications/twilio/app.py +14 -13
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/METADATA +1 -1
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/RECORD +45 -45
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/WHEEL +0 -0
- {universal_mcp_applications-0.1.39rc8.dist-info → universal_mcp_applications-0.1.39rc16.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any
|
|
1
|
+
from typing import Any, Literal
|
|
2
2
|
from universal_mcp.applications.application import APIApplication
|
|
3
3
|
from universal_mcp.integrations import Integration
|
|
4
4
|
|
|
@@ -8,100 +8,63 @@ class MsTeamsApp(APIApplication):
|
|
|
8
8
|
super().__init__(name="ms_teams", integration=integration, **kwargs)
|
|
9
9
|
self.base_url = "https://graph.microsoft.com/v1.0"
|
|
10
10
|
|
|
11
|
-
async def
|
|
11
|
+
async def get_me(
|
|
12
12
|
self,
|
|
13
|
-
top: int | None = None,
|
|
14
|
-
skip: int | None = None,
|
|
15
|
-
search: str | None = None,
|
|
16
|
-
filter: str | None = None,
|
|
17
|
-
count: bool | None = None,
|
|
18
|
-
orderby: list[str] | None = None,
|
|
19
13
|
select: list[str] | None = None,
|
|
20
14
|
expand: list[str] | None = None,
|
|
21
15
|
) -> dict[str, Any]:
|
|
22
16
|
"""
|
|
23
|
-
|
|
17
|
+
Get the currently signed-in user.
|
|
24
18
|
|
|
25
19
|
Args:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
search (string): Search items by search phrases
|
|
29
|
-
filter (string): Filter items by property values
|
|
30
|
-
count (boolean): Include count of items
|
|
31
|
-
orderby (array): Order items by property values
|
|
32
|
-
select (array): Select properties to be returned
|
|
33
|
-
expand (array): Expand related entities
|
|
20
|
+
select (array): Select specific properties to return.
|
|
21
|
+
expand (array): Expand related entities.
|
|
34
22
|
|
|
35
23
|
Returns:
|
|
36
|
-
dict[str, Any]:
|
|
24
|
+
dict[str, Any]: The user resource.
|
|
37
25
|
|
|
38
26
|
Raises:
|
|
39
|
-
HTTPStatusError:
|
|
27
|
+
HTTPStatusError: If the API request fails.
|
|
40
28
|
|
|
41
29
|
Tags:
|
|
42
|
-
|
|
30
|
+
user, me, read, profile
|
|
43
31
|
"""
|
|
44
|
-
url = f"{self.base_url}/
|
|
32
|
+
url = f"{self.base_url}/me"
|
|
33
|
+
|
|
34
|
+
# Helper to format list params
|
|
35
|
+
def fmt(val):
|
|
36
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
37
|
+
|
|
45
38
|
query_params = {
|
|
46
|
-
k: v
|
|
39
|
+
k: fmt(v)
|
|
47
40
|
for k, v in [
|
|
48
|
-
("$top", top),
|
|
49
|
-
("$skip", skip),
|
|
50
|
-
("$search", search),
|
|
51
|
-
("$filter", filter),
|
|
52
|
-
("$count", count),
|
|
53
|
-
("$orderby", orderby),
|
|
54
41
|
("$select", select),
|
|
55
42
|
("$expand", expand),
|
|
56
43
|
]
|
|
57
44
|
if v is not None
|
|
58
45
|
}
|
|
46
|
+
|
|
59
47
|
response = await self._aget(url, params=query_params)
|
|
60
48
|
return self._handle_response(response)
|
|
61
49
|
|
|
62
|
-
async def get_joined_teams(self) -> list[dict[str, Any]]:
|
|
63
|
-
"""
|
|
64
|
-
Fetches all Microsoft Teams the authenticated user belongs to by querying the `/me/joinedTeams` Graph API endpoint. It returns a list of dictionaries, where each dictionary represents a single team's details, unlike functions that list channels or chats for a specific team.
|
|
65
50
|
|
|
66
|
-
|
|
67
|
-
A list of dictionaries, where each dictionary represents a team.
|
|
51
|
+
# Chat Management
|
|
68
52
|
|
|
69
|
-
|
|
70
|
-
httpx.HTTPStatusError: If the API request fails due to authentication or other issues.
|
|
71
|
-
|
|
72
|
-
Tags:
|
|
73
|
-
read, list, teams, microsoft-teams, api, important
|
|
74
|
-
"""
|
|
75
|
-
url = f"{self.base_url}/me/joinedTeams"
|
|
76
|
-
response = await self._aget(url)
|
|
77
|
-
data = self._handle_response(response)
|
|
78
|
-
return data.get("value", [])
|
|
79
|
-
|
|
80
|
-
async def list_channels_for_team(
|
|
53
|
+
async def get_user_chats(
|
|
81
54
|
self,
|
|
82
|
-
team_id: str,
|
|
83
55
|
top: int | None = None,
|
|
84
|
-
|
|
85
|
-
search: str | None = None,
|
|
56
|
+
expand: list[Literal["members", "lastMessagePreview"]] | None = None,
|
|
86
57
|
filter: str | None = None,
|
|
87
|
-
|
|
88
|
-
orderby: list[str] | None = None,
|
|
89
|
-
select: list[str] | None = None,
|
|
90
|
-
expand: list[str] | None = None,
|
|
58
|
+
orderby: Literal["lastMessagePreview/createdDateTime desc"] | None = None,
|
|
91
59
|
) -> dict[str, Any]:
|
|
92
60
|
"""
|
|
93
|
-
Retrieves
|
|
61
|
+
Retrieves a collection of chats the authenticated user is participating in. Supports optional OData query parameters for advanced filtering, sorting, pagination, and field selection, enabling customized data retrieval from the Microsoft Graph API.
|
|
94
62
|
|
|
95
63
|
Args:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
filter (string): Filter items by property values
|
|
101
|
-
count (boolean): Include count of items
|
|
102
|
-
orderby (array): Order items by property values
|
|
103
|
-
select (array): Select properties to be returned
|
|
104
|
-
expand (array): Expand related entities
|
|
64
|
+
top (integer): Controls the number of items per response. Maximum allowed $top value is 50.
|
|
65
|
+
expand (array): Currently supports 'members' and 'lastMessagePreview' properties.
|
|
66
|
+
filter (string): Filters results.
|
|
67
|
+
orderby (string): Currently supports 'lastMessagePreview/createdDateTime desc'. Ascending order is currently not supported.
|
|
105
68
|
|
|
106
69
|
Returns:
|
|
107
70
|
dict[str, Any]: Retrieved collection
|
|
@@ -110,182 +73,70 @@ class MsTeamsApp(APIApplication):
|
|
|
110
73
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
111
74
|
|
|
112
75
|
Tags:
|
|
113
|
-
|
|
76
|
+
chats.chat, important
|
|
114
77
|
"""
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
78
|
+
url = f"{self.base_url}/chats"
|
|
79
|
+
# Helper to format list params
|
|
80
|
+
def fmt(val):
|
|
81
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
82
|
+
|
|
118
83
|
query_params = {
|
|
119
|
-
k: v
|
|
84
|
+
k: fmt(v)
|
|
120
85
|
for k, v in [
|
|
121
86
|
("$top", top),
|
|
122
|
-
("$
|
|
123
|
-
("$search", search),
|
|
87
|
+
("$expand", expand),
|
|
124
88
|
("$filter", filter),
|
|
125
|
-
("$count", count),
|
|
126
89
|
("$orderby", orderby),
|
|
127
|
-
("$select", select),
|
|
128
|
-
("$expand", expand),
|
|
129
90
|
]
|
|
130
91
|
if v is not None
|
|
131
92
|
}
|
|
132
93
|
response = await self._aget(url, params=query_params)
|
|
133
94
|
return self._handle_response(response)
|
|
134
95
|
|
|
135
|
-
async def send_chat_message(self, chat_id: str, content: str) -> dict[str, Any]:
|
|
136
|
-
"""
|
|
137
|
-
Posts a new message to a specific Microsoft Teams chat using its unique ID. This function targets direct or group chats, distinguishing it from `send_channel_message`, which posts to public team channels, and `reply_to_chat_message`, which responds to existing messages.
|
|
138
|
-
|
|
139
|
-
Args:
|
|
140
|
-
chat_id: The unique identifier of the chat.
|
|
141
|
-
content: The message content to send (can be plain text or HTML).
|
|
142
|
-
|
|
143
|
-
Returns:
|
|
144
|
-
A dictionary containing the API response for the sent message, including its ID.
|
|
145
|
-
|
|
146
|
-
Raises:
|
|
147
|
-
httpx.HTTPStatusError: If the API request fails due to invalid ID, permissions, etc.
|
|
148
|
-
|
|
149
|
-
Tags:
|
|
150
|
-
create, send, message, chat, microsoft-teams, api, important
|
|
151
|
-
"""
|
|
152
|
-
url = f"{self.base_url}/chats/{chat_id}/messages"
|
|
153
|
-
payload = {"body": {"content": content}}
|
|
154
|
-
response = await self._apost(url, data=payload)
|
|
155
|
-
return self._handle_response(response)
|
|
156
|
-
|
|
157
|
-
async def send_channel_message(self, team_id: str, channel_id: str, content: str) -> dict[str, Any]:
|
|
158
|
-
"""
|
|
159
|
-
Posts a new message to a specified team channel, initiating a new conversation thread. Unlike `reply_to_channel_message`, which replies to a message, this function starts a new topic. It's distinct from `send_chat_message`, which is for private or group chats, not team channels.
|
|
160
|
-
|
|
161
|
-
Args:
|
|
162
|
-
team_id: The unique identifier of the team.
|
|
163
|
-
channel_id: The unique identifier of the channel within the team.
|
|
164
|
-
content: The message content to send (can be plain text or HTML).
|
|
165
|
-
|
|
166
|
-
Returns:
|
|
167
|
-
A dictionary containing the API response for the sent message, including its ID.
|
|
168
|
-
|
|
169
|
-
Raises:
|
|
170
|
-
httpx.HTTPStatusError: If the API request fails due to invalid IDs, permissions, etc.
|
|
171
|
-
|
|
172
|
-
Tags:
|
|
173
|
-
create, send, message, channel, microsoft-teams, api, important
|
|
174
|
-
"""
|
|
175
|
-
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages"
|
|
176
|
-
payload = {"body": {"content": content}}
|
|
177
|
-
response = await self._apost(url, data=payload)
|
|
178
|
-
return self._handle_response(response)
|
|
179
|
-
|
|
180
|
-
async def reply_to_channel_message(self, team_id: str, channel_id: str, message_id: str, content: str) -> dict[str, Any]:
|
|
181
|
-
"""
|
|
182
|
-
Posts a reply to a specific message within a Microsoft Teams channel. It uses the team, channel, and original message IDs to target an existing conversation thread, distinguishing it from `send_channel_message` which starts a new one.
|
|
183
|
-
|
|
184
|
-
Args:
|
|
185
|
-
team_id: The unique identifier of the team.
|
|
186
|
-
channel_id: The unique identifier of the channel.
|
|
187
|
-
message_id: The unique identifier of the message to reply to.
|
|
188
|
-
content: The reply message content (can be plain text or HTML).
|
|
189
|
-
|
|
190
|
-
Returns:
|
|
191
|
-
A dictionary containing the API response for the sent reply, including its ID.
|
|
192
|
-
|
|
193
|
-
Raises:
|
|
194
|
-
httpx.HTTPStatusError: If the API request fails due to invalid IDs, permissions, etc.
|
|
195
|
-
|
|
196
|
-
Tags:
|
|
197
|
-
create, send, reply, message, channel, microsoft-teams, api, important
|
|
198
|
-
"""
|
|
199
|
-
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
|
|
200
|
-
payload = {"body": {"content": content}}
|
|
201
|
-
response = await self._apost(url, data=payload)
|
|
202
|
-
return self._handle_response(response)
|
|
203
|
-
|
|
204
96
|
async def create_chat(
|
|
205
97
|
self,
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
createdDateTime: str | None = None,
|
|
209
|
-
isHiddenForAllMembers: bool | None = None,
|
|
210
|
-
lastUpdatedDateTime: str | None = None,
|
|
211
|
-
onlineMeetingInfo: dict[str, dict[str, Any]] | None = None,
|
|
212
|
-
tenantId: str | None = None,
|
|
98
|
+
chatType: Literal["oneOnOne", "group"] | str,
|
|
99
|
+
members: list[dict[str, Any]],
|
|
213
100
|
topic: str | None = None,
|
|
214
|
-
|
|
215
|
-
webUrl: str | None = None,
|
|
216
|
-
installedApps: list[Any] | None = None,
|
|
217
|
-
lastMessagePreview: Any | None = None,
|
|
218
|
-
members: list[Any] | None = None,
|
|
219
|
-
messages: list[Any] | None = None,
|
|
220
|
-
permissionGrants: list[Any] | None = None,
|
|
221
|
-
pinnedMessages: list[Any] | None = None,
|
|
222
|
-
tabs: list[Any] | None = None,
|
|
223
|
-
) -> Any:
|
|
101
|
+
) -> dict[str, Any]:
|
|
224
102
|
"""
|
|
225
|
-
Creates a new one-on-one or group chat in Microsoft Teams. This function provisions a new conversation using
|
|
103
|
+
Creates a new one-on-one or group chat in Microsoft Teams. This function provisions a new conversation using required parameters like chatType and members.
|
|
226
104
|
|
|
227
105
|
Args:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
createdDateTime (string): Date and time at which the chat was created. Read-only.
|
|
231
|
-
isHiddenForAllMembers (boolean): Indicates whether the chat is hidden for all its members. Read-only.
|
|
232
|
-
lastUpdatedDateTime (string): Date and time at which the chat was renamed or the list of members was last changed. Read-only.
|
|
233
|
-
onlineMeetingInfo (object): onlineMeetingInfo
|
|
234
|
-
tenantId (string): The identifier of the tenant in which the chat was created. Read-only.
|
|
106
|
+
chatType (string): The type of chat. Possible values are: oneOnOne, group.
|
|
107
|
+
members (array): A collection of member dictionaries. For oneOnOne chats, typically 2 users. For group chats, multiple users. Each member should specify roles and user binding (e.g. `{'@odata.type': '#microsoft.graph.aadUserConversationMember', 'roles': ['owner'], 'user@odata.bind': 'https://graph.microsoft.com/v1.0/users(\\'<user-id>\\')'}`).
|
|
235
108
|
topic (string): (Optional) Subject or topic for the chat. Only available for group chats.
|
|
236
|
-
viewpoint (object): viewpoint
|
|
237
|
-
webUrl (string): The URL for the chat in Microsoft Teams. The URL should be treated as an opaque blob, and not parsed. Read-only.
|
|
238
|
-
installedApps (array): A collection of all the apps in the chat. Nullable.
|
|
239
|
-
lastMessagePreview (string): lastMessagePreview
|
|
240
|
-
members (array): A collection of all the members in the chat. Nullable.
|
|
241
|
-
messages (array): A collection of all the messages in the chat. Nullable.
|
|
242
|
-
permissionGrants (array): A collection of permissions granted to apps for the chat.
|
|
243
|
-
pinnedMessages (array): A collection of all the pinned messages in the chat. Nullable.
|
|
244
|
-
tabs (array): A collection of all the tabs in the chat. Nullable.
|
|
245
109
|
|
|
246
110
|
Returns:
|
|
247
|
-
Any:
|
|
111
|
+
dict[str, Any]: The newly created chat entity.
|
|
248
112
|
|
|
249
113
|
Raises:
|
|
250
114
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
251
115
|
|
|
252
116
|
Tags:
|
|
253
|
-
chats.chat
|
|
117
|
+
chats.chat, create
|
|
254
118
|
"""
|
|
255
|
-
request_body_data = None
|
|
256
119
|
request_body_data = {
|
|
257
|
-
"id": id,
|
|
258
120
|
"chatType": chatType,
|
|
259
|
-
"createdDateTime": createdDateTime,
|
|
260
|
-
"isHiddenForAllMembers": isHiddenForAllMembers,
|
|
261
|
-
"lastUpdatedDateTime": lastUpdatedDateTime,
|
|
262
|
-
"onlineMeetingInfo": onlineMeetingInfo,
|
|
263
|
-
"tenantId": tenantId,
|
|
264
|
-
"topic": topic,
|
|
265
|
-
"viewpoint": viewpoint,
|
|
266
|
-
"webUrl": webUrl,
|
|
267
|
-
"installedApps": installedApps,
|
|
268
|
-
"lastMessagePreview": lastMessagePreview,
|
|
269
121
|
"members": members,
|
|
270
|
-
"
|
|
271
|
-
"permissionGrants": permissionGrants,
|
|
272
|
-
"pinnedMessages": pinnedMessages,
|
|
273
|
-
"tabs": tabs,
|
|
122
|
+
"topic": topic,
|
|
274
123
|
}
|
|
124
|
+
# Filter explicitly None values, though for required ones they should be validated by type hints/caller
|
|
275
125
|
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
126
|
+
|
|
276
127
|
url = f"{self.base_url}/chats"
|
|
277
|
-
|
|
278
|
-
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
128
|
+
response = await self._apost(url, data=request_body_data, content_type="application/json")
|
|
279
129
|
return self._handle_response(response)
|
|
280
130
|
|
|
281
|
-
async def get_chat_details(
|
|
131
|
+
async def get_chat_details(
|
|
132
|
+
self,
|
|
133
|
+
chat_id: str,
|
|
134
|
+
) -> Any:
|
|
282
135
|
"""
|
|
283
|
-
Retrieves the properties and relationships of a specific chat conversation by its unique ID.
|
|
136
|
+
Retrieves the properties and relationships of a specific chat conversation by its unique ID.
|
|
284
137
|
|
|
285
138
|
Args:
|
|
286
|
-
chat_id (string): chat
|
|
287
|
-
select (array): Select properties to be returned
|
|
288
|
-
expand (array): Expand related entities
|
|
139
|
+
chat_id (string): The unique identifier of the chat.
|
|
289
140
|
|
|
290
141
|
Returns:
|
|
291
142
|
Any: Retrieved entity
|
|
@@ -294,353 +145,154 @@ class MsTeamsApp(APIApplication):
|
|
|
294
145
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
295
146
|
|
|
296
147
|
Tags:
|
|
297
|
-
chats.chat
|
|
148
|
+
chats.chat, read
|
|
298
149
|
"""
|
|
299
150
|
if chat_id is None:
|
|
300
151
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
301
152
|
url = f"{self.base_url}/chats/{chat_id}"
|
|
302
|
-
|
|
303
|
-
response = await self._aget(url, params=query_params)
|
|
153
|
+
response = await self._aget(url)
|
|
304
154
|
return self._handle_response(response)
|
|
305
155
|
|
|
306
156
|
async def update_chat_details(
|
|
307
157
|
self,
|
|
308
158
|
chat_id: str,
|
|
309
|
-
id: str | None = None,
|
|
310
|
-
chatType: str | None = None,
|
|
311
|
-
createdDateTime: str | None = None,
|
|
312
|
-
isHiddenForAllMembers: bool | None = None,
|
|
313
|
-
lastUpdatedDateTime: str | None = None,
|
|
314
|
-
onlineMeetingInfo: dict[str, dict[str, Any]] | None = None,
|
|
315
|
-
tenantId: str | None = None,
|
|
316
159
|
topic: str | None = None,
|
|
317
|
-
viewpoint: dict[str, dict[str, Any]] | None = None,
|
|
318
|
-
webUrl: str | None = None,
|
|
319
|
-
installedApps: list[Any] | None = None,
|
|
320
|
-
lastMessagePreview: Any | None = None,
|
|
321
|
-
members: list[Any] | None = None,
|
|
322
|
-
messages: list[Any] | None = None,
|
|
323
|
-
permissionGrants: list[Any] | None = None,
|
|
324
|
-
pinnedMessages: list[Any] | None = None,
|
|
325
|
-
tabs: list[Any] | None = None,
|
|
326
160
|
) -> Any:
|
|
327
161
|
"""
|
|
328
|
-
Updates properties of a specific chat, such as its topic, using its unique ID. This function performs a partial update (PATCH),
|
|
162
|
+
Updates properties of a specific chat, such as its topic, using its unique ID. This function performs a partial update (PATCH). Currently, only the 'topic' property can be updated for group chats.
|
|
329
163
|
|
|
330
164
|
Args:
|
|
331
|
-
chat_id (string): chat
|
|
332
|
-
|
|
333
|
-
chatType (string): chatType
|
|
334
|
-
createdDateTime (string): Date and time at which the chat was created. Read-only.
|
|
335
|
-
isHiddenForAllMembers (boolean): Indicates whether the chat is hidden for all its members. Read-only.
|
|
336
|
-
lastUpdatedDateTime (string): Date and time at which the chat was renamed or the list of members was last changed. Read-only.
|
|
337
|
-
onlineMeetingInfo (object): onlineMeetingInfo
|
|
338
|
-
tenantId (string): The identifier of the tenant in which the chat was created. Read-only.
|
|
339
|
-
topic (string): (Optional) Subject or topic for the chat. Only available for group chats.
|
|
340
|
-
viewpoint (object): viewpoint
|
|
341
|
-
webUrl (string): The URL for the chat in Microsoft Teams. The URL should be treated as an opaque blob, and not parsed. Read-only.
|
|
342
|
-
installedApps (array): A collection of all the apps in the chat. Nullable.
|
|
343
|
-
lastMessagePreview (string): lastMessagePreview
|
|
344
|
-
members (array): A collection of all the members in the chat. Nullable.
|
|
345
|
-
messages (array): A collection of all the messages in the chat. Nullable.
|
|
346
|
-
permissionGrants (array): A collection of permissions granted to apps for the chat.
|
|
347
|
-
pinnedMessages (array): A collection of all the pinned messages in the chat. Nullable.
|
|
348
|
-
tabs (array): A collection of all the tabs in the chat. Nullable.
|
|
165
|
+
chat_id (string): The unique identifier of the chat.
|
|
166
|
+
topic (string): (Optional) The new subject or topic for the chat. Only applicable for group chats.
|
|
349
167
|
|
|
350
168
|
Returns:
|
|
351
|
-
Any:
|
|
169
|
+
Any: Variable response depending on the API, typically the updated entity or status.
|
|
352
170
|
|
|
353
171
|
Raises:
|
|
354
172
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
355
173
|
|
|
356
174
|
Tags:
|
|
357
|
-
chats.chat
|
|
175
|
+
chats.chat, update
|
|
358
176
|
"""
|
|
359
177
|
if chat_id is None:
|
|
360
178
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
361
|
-
|
|
362
|
-
request_body_data = {
|
|
363
|
-
|
|
364
|
-
"chatType": chatType,
|
|
365
|
-
"createdDateTime": createdDateTime,
|
|
366
|
-
"isHiddenForAllMembers": isHiddenForAllMembers,
|
|
367
|
-
"lastUpdatedDateTime": lastUpdatedDateTime,
|
|
368
|
-
"onlineMeetingInfo": onlineMeetingInfo,
|
|
369
|
-
"tenantId": tenantId,
|
|
370
|
-
"topic": topic,
|
|
371
|
-
"viewpoint": viewpoint,
|
|
372
|
-
"webUrl": webUrl,
|
|
373
|
-
"installedApps": installedApps,
|
|
374
|
-
"lastMessagePreview": lastMessagePreview,
|
|
375
|
-
"members": members,
|
|
376
|
-
"messages": messages,
|
|
377
|
-
"permissionGrants": permissionGrants,
|
|
378
|
-
"pinnedMessages": pinnedMessages,
|
|
379
|
-
"tabs": tabs,
|
|
380
|
-
}
|
|
179
|
+
|
|
180
|
+
request_body_data = {"topic": topic}
|
|
181
|
+
# Filter explicitly None values
|
|
381
182
|
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
return self._handle_response(response)
|
|
386
|
-
|
|
387
|
-
async def list_installed_chat_apps(
|
|
388
|
-
self,
|
|
389
|
-
chat_id: str,
|
|
390
|
-
top: int | None = None,
|
|
391
|
-
skip: int | None = None,
|
|
392
|
-
search: str | None = None,
|
|
393
|
-
filter: str | None = None,
|
|
394
|
-
count: bool | None = None,
|
|
395
|
-
orderby: list[str] | None = None,
|
|
396
|
-
select: list[str] | None = None,
|
|
397
|
-
expand: list[str] | None = None,
|
|
398
|
-
) -> dict[str, Any]:
|
|
399
|
-
"""
|
|
400
|
-
Retrieves applications installed in a specific chat, identified by `chat_id`. Differentiating from `list_user_installed_apps`, which targets a user's personal scope, this function queries a single conversation. It supports optional parameters for advanced filtering, sorting, and pagination to customize the returned collection.
|
|
401
|
-
|
|
402
|
-
Args:
|
|
403
|
-
chat_id (string): chat-id
|
|
404
|
-
top (integer): Show only the first n items Example: '50'.
|
|
405
|
-
skip (integer): Skip the first n items
|
|
406
|
-
search (string): Search items by search phrases
|
|
407
|
-
filter (string): Filter items by property values
|
|
408
|
-
count (boolean): Include count of items
|
|
409
|
-
orderby (array): Order items by property values
|
|
410
|
-
select (array): Select properties to be returned
|
|
411
|
-
expand (array): Expand related entities
|
|
412
|
-
|
|
413
|
-
Returns:
|
|
414
|
-
dict[str, Any]: Retrieved collection
|
|
183
|
+
|
|
184
|
+
if not request_body_data:
|
|
185
|
+
raise ValueError("No updateable parameters provided.")
|
|
415
186
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
Tags:
|
|
420
|
-
chats.teamsAppInstallation
|
|
421
|
-
"""
|
|
422
|
-
if chat_id is None:
|
|
423
|
-
raise ValueError("Missing required parameter 'chat-id'.")
|
|
424
|
-
url = f"{self.base_url}/chats/{chat_id}/installedApps"
|
|
425
|
-
query_params = {
|
|
426
|
-
k: v
|
|
427
|
-
for k, v in [
|
|
428
|
-
("$top", top),
|
|
429
|
-
("$skip", skip),
|
|
430
|
-
("$search", search),
|
|
431
|
-
("$filter", filter),
|
|
432
|
-
("$count", count),
|
|
433
|
-
("$orderby", orderby),
|
|
434
|
-
("$select", select),
|
|
435
|
-
("$expand", expand),
|
|
436
|
-
]
|
|
437
|
-
if v is not None
|
|
438
|
-
}
|
|
439
|
-
response = await self._aget(url, params=query_params)
|
|
187
|
+
url = f"{self.base_url}/chats/{chat_id}"
|
|
188
|
+
response = await self._apatch(url, data=request_body_data, content_type="application/json")
|
|
440
189
|
return self._handle_response(response)
|
|
441
190
|
|
|
442
191
|
async def list_chat_members(
|
|
443
192
|
self,
|
|
444
193
|
chat_id: str,
|
|
445
|
-
|
|
446
|
-
skip: int | None = None,
|
|
447
|
-
search: str | None = None,
|
|
448
|
-
filter: str | None = None,
|
|
449
|
-
count: bool | None = None,
|
|
450
|
-
orderby: list[str] | None = None,
|
|
451
|
-
select: list[str] | None = None,
|
|
452
|
-
expand: list[str] | None = None,
|
|
453
|
-
) -> dict[str, Any]:
|
|
194
|
+
) -> list[dict[str, Any]]:
|
|
454
195
|
"""
|
|
455
|
-
Retrieves a collection of all members in a specific chat using its ID.
|
|
196
|
+
Retrieves a collection of all members in a specific chat using its ID.
|
|
197
|
+
Note: The Microsoft Graph API for getting chat members does NOT support OData query parameters like $top, $filter, etc.
|
|
456
198
|
|
|
457
199
|
Args:
|
|
458
|
-
chat_id (string): chat
|
|
459
|
-
top (integer): Show only the first n items Example: '50'.
|
|
460
|
-
skip (integer): Skip the first n items
|
|
461
|
-
search (string): Search items by search phrases
|
|
462
|
-
filter (string): Filter items by property values
|
|
463
|
-
count (boolean): Include count of items
|
|
464
|
-
orderby (array): Order items by property values
|
|
465
|
-
select (array): Select properties to be returned
|
|
466
|
-
expand (array): Expand related entities
|
|
200
|
+
chat_id (string): The unique identifier of the chat.
|
|
467
201
|
|
|
468
202
|
Returns:
|
|
469
|
-
dict[str, Any]:
|
|
203
|
+
list[dict[str, Any]]: A list of conversationMember objects.
|
|
470
204
|
|
|
471
205
|
Raises:
|
|
472
206
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
473
207
|
|
|
474
208
|
Tags:
|
|
475
|
-
chats.conversationMember
|
|
209
|
+
chats.conversationMember, list, read
|
|
476
210
|
"""
|
|
477
211
|
if chat_id is None:
|
|
478
212
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
479
213
|
url = f"{self.base_url}/chats/{chat_id}/members"
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
("$search", search),
|
|
486
|
-
("$filter", filter),
|
|
487
|
-
("$count", count),
|
|
488
|
-
("$orderby", orderby),
|
|
489
|
-
("$select", select),
|
|
490
|
-
("$expand", expand),
|
|
491
|
-
]
|
|
492
|
-
if v is not None
|
|
493
|
-
}
|
|
494
|
-
response = await self._aget(url, params=query_params)
|
|
495
|
-
return self._handle_response(response)
|
|
496
|
-
|
|
497
|
-
async def add_member_to_chat(
|
|
498
|
-
self,
|
|
499
|
-
chat_id: str,
|
|
500
|
-
id: str | None = None,
|
|
501
|
-
displayName: str | None = None,
|
|
502
|
-
roles: list[str] | None = None,
|
|
503
|
-
visibleHistoryStartDateTime: str | None = None,
|
|
504
|
-
) -> Any:
|
|
505
|
-
"""
|
|
506
|
-
Adds a new member to a specific Microsoft Teams chat using its `chat_id`. This function allows for configuring member roles and chat history visibility. It is the direct counterpart to `delete_chat_member`, performing the 'create' action for a chat's membership.
|
|
507
|
-
|
|
508
|
-
Args:
|
|
509
|
-
chat_id (string): chat-id
|
|
510
|
-
id (string): The unique identifier for an entity. Read-only.
|
|
511
|
-
displayName (string): The display name of the user.
|
|
512
|
-
roles (array): The roles for that user. This property contains more qualifiers only when relevant - for example, if the member has owner privileges, the roles property contains owner as one of the values. Similarly, if the member is an in-tenant guest, the roles property contains guest as one of the values. A basic member shouldn't have any values specified in the roles property. An Out-of-tenant external member is assigned the owner role.
|
|
513
|
-
visibleHistoryStartDateTime (string): The timestamp denoting how far back a conversation's history is shared with the conversation member. This property is settable only for members of a chat.
|
|
514
|
-
|
|
515
|
-
Returns:
|
|
516
|
-
Any: Created navigation property.
|
|
517
|
-
|
|
518
|
-
Raises:
|
|
519
|
-
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
520
|
-
|
|
521
|
-
Tags:
|
|
522
|
-
chats.conversationMember
|
|
523
|
-
"""
|
|
524
|
-
if chat_id is None:
|
|
525
|
-
raise ValueError("Missing required parameter 'chat-id'.")
|
|
526
|
-
request_body_data = None
|
|
527
|
-
request_body_data = {
|
|
528
|
-
"id": id,
|
|
529
|
-
"displayName": displayName,
|
|
530
|
-
"roles": roles,
|
|
531
|
-
"visibleHistoryStartDateTime": visibleHistoryStartDateTime,
|
|
532
|
-
}
|
|
533
|
-
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
534
|
-
url = f"{self.base_url}/chats/{chat_id}/members"
|
|
535
|
-
query_params = {}
|
|
536
|
-
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
537
|
-
return self._handle_response(response)
|
|
214
|
+
|
|
215
|
+
# This endpoint generally does not support OData params, so we send none.
|
|
216
|
+
response = await self._aget(url)
|
|
217
|
+
data = self._handle_response(response)
|
|
218
|
+
return data.get("value", [])
|
|
538
219
|
|
|
539
220
|
async def get_chat_member(
|
|
540
|
-
self, chat_id: str, conversationMember_id: str
|
|
221
|
+
self, chat_id: str, conversationMember_id: str
|
|
541
222
|
) -> Any:
|
|
542
223
|
"""
|
|
543
|
-
Retrieves detailed information for a specific member within a chat using their unique ID.
|
|
224
|
+
Retrieves detailed information for a specific member within a chat using their unique ID.
|
|
225
|
+
Note: The Microsoft Graph API for this endpoint does NOT support OData query parameters.
|
|
544
226
|
|
|
545
227
|
Args:
|
|
546
|
-
chat_id (string): chat
|
|
547
|
-
conversationMember_id (string):
|
|
548
|
-
select (array): Select properties to be returned
|
|
549
|
-
expand (array): Expand related entities
|
|
228
|
+
chat_id (string): The unique identifier of the chat.
|
|
229
|
+
conversationMember_id (string): The unique identifier of the member.
|
|
550
230
|
|
|
551
231
|
Returns:
|
|
552
|
-
Any: Retrieved
|
|
232
|
+
Any: Retrieved conversationMember entity.
|
|
553
233
|
|
|
554
234
|
Raises:
|
|
555
235
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
556
236
|
|
|
557
237
|
Tags:
|
|
558
|
-
chats.conversationMember
|
|
238
|
+
chats.conversationMember, read
|
|
559
239
|
"""
|
|
560
240
|
if chat_id is None:
|
|
561
241
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
562
242
|
if conversationMember_id is None:
|
|
563
243
|
raise ValueError("Missing required parameter 'conversationMember-id'.")
|
|
564
244
|
url = f"{self.base_url}/chats/{chat_id}/members/{conversationMember_id}"
|
|
565
|
-
|
|
566
|
-
|
|
245
|
+
|
|
246
|
+
# This endpoint generally does not support OData params
|
|
247
|
+
response = await self._aget(url)
|
|
567
248
|
return self._handle_response(response)
|
|
568
249
|
|
|
569
|
-
|
|
570
|
-
"""
|
|
571
|
-
Removes a specific member from a chat using their unique ID and the chat's ID. This function sends a DELETE request to the Microsoft Graph API to permanently remove the user from the conversation, acting as the counterpart to `add_member_to_chat`.
|
|
572
|
-
|
|
573
|
-
Args:
|
|
574
|
-
chat_id (string): chat-id
|
|
575
|
-
conversationMember_id (string): conversationMember-id
|
|
576
|
-
|
|
577
|
-
Returns:
|
|
578
|
-
Any: Success
|
|
579
|
-
|
|
580
|
-
Raises:
|
|
581
|
-
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
582
|
-
|
|
583
|
-
Tags:
|
|
584
|
-
chats.conversationMember
|
|
585
|
-
"""
|
|
586
|
-
if chat_id is None:
|
|
587
|
-
raise ValueError("Missing required parameter 'chat-id'.")
|
|
588
|
-
if conversationMember_id is None:
|
|
589
|
-
raise ValueError("Missing required parameter 'conversationMember-id'.")
|
|
590
|
-
url = f"{self.base_url}/chats/{chat_id}/members/{conversationMember_id}"
|
|
591
|
-
query_params = {}
|
|
592
|
-
response = await self._adelete(url, params=query_params)
|
|
593
|
-
return self._handle_response(response)
|
|
250
|
+
# Chat Messages
|
|
594
251
|
|
|
595
252
|
async def list_chat_messages(
|
|
596
253
|
self,
|
|
597
254
|
chat_id: str,
|
|
598
255
|
top: int | None = None,
|
|
599
|
-
|
|
600
|
-
search: str | None = None,
|
|
256
|
+
orderby: list[Literal["lastModifiedDateTime desc", "createdDateTime desc"]] | None = None,
|
|
601
257
|
filter: str | None = None,
|
|
602
|
-
count: bool | None = None,
|
|
603
|
-
orderby: list[str] | None = None,
|
|
604
|
-
select: list[str] | None = None,
|
|
605
|
-
expand: list[str] | None = None,
|
|
606
258
|
) -> dict[str, Any]:
|
|
607
259
|
"""
|
|
608
|
-
Retrieves messages from a specific chat using its ID.
|
|
260
|
+
Retrieves messages from a specific chat using its ID.
|
|
261
|
+
|
|
262
|
+
Supported OData parameters with strict limitations:
|
|
263
|
+
- $top: Controls the number of items per response. Maximum allowed value is 50.
|
|
264
|
+
- $orderby: Currently supports 'lastModifiedDateTime desc' (default) and 'createdDateTime desc'. Ascending order is NOT supported.
|
|
265
|
+
- $filter: Sets the date range filter for 'lastModifiedDateTime' (supports gt/lt) and 'createdDateTime' (supports lt).
|
|
266
|
+
Note: You can only filter results if 'orderby' is configured for the same property!
|
|
609
267
|
|
|
610
268
|
Args:
|
|
611
|
-
chat_id (string): chat
|
|
612
|
-
top (integer): Show only the first n items
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
filter (string): Filter items by property values
|
|
616
|
-
count (boolean): Include count of items
|
|
617
|
-
orderby (array): Order items by property values
|
|
618
|
-
select (array): Select properties to be returned
|
|
619
|
-
expand (array): Expand related entities
|
|
269
|
+
chat_id (string): The unique identifier of the chat.
|
|
270
|
+
top (integer): Show only the first n items. Max 50.
|
|
271
|
+
orderby (array): Order items by property values. Restrict to supported descending sorts.
|
|
272
|
+
filter (string): Filter items by property values. Must match orderby property.
|
|
620
273
|
|
|
621
274
|
Returns:
|
|
622
|
-
dict[str, Any]: Retrieved collection
|
|
275
|
+
dict[str, Any]: Retrieved collection of messages.
|
|
623
276
|
|
|
624
277
|
Raises:
|
|
625
278
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
626
279
|
|
|
627
280
|
Tags:
|
|
628
|
-
chats.chatMessage
|
|
281
|
+
chats.chatMessage, list, read
|
|
629
282
|
"""
|
|
630
283
|
if chat_id is None:
|
|
631
284
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
632
285
|
url = f"{self.base_url}/chats/{chat_id}/messages"
|
|
286
|
+
# Helper to format list params
|
|
287
|
+
def fmt(val):
|
|
288
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
289
|
+
|
|
633
290
|
query_params = {
|
|
634
|
-
k: v
|
|
291
|
+
k: fmt(v)
|
|
635
292
|
for k, v in [
|
|
636
293
|
("$top", top),
|
|
637
|
-
("$skip", skip),
|
|
638
|
-
("$search", search),
|
|
639
|
-
("$filter", filter),
|
|
640
|
-
("$count", count),
|
|
641
294
|
("$orderby", orderby),
|
|
642
|
-
("$
|
|
643
|
-
("$expand", expand),
|
|
295
|
+
("$filter", filter),
|
|
644
296
|
]
|
|
645
297
|
if v is not None
|
|
646
298
|
}
|
|
@@ -648,1054 +300,537 @@ class MsTeamsApp(APIApplication):
|
|
|
648
300
|
return self._handle_response(response)
|
|
649
301
|
|
|
650
302
|
async def get_chat_message(
|
|
651
|
-
self, chat_id: str, chatMessage_id: str
|
|
303
|
+
self, chat_id: str, chatMessage_id: str
|
|
652
304
|
) -> Any:
|
|
653
305
|
"""
|
|
654
|
-
Retrieves the full details of a single message from a specific chat using both chat and message IDs.
|
|
306
|
+
Retrieves the full details of a single message from a specific chat using both chat and message IDs.
|
|
307
|
+
Note: The Microsoft Graph API for this endpoint does NOT support OData query parameters like $select or $expand.
|
|
655
308
|
|
|
656
309
|
Args:
|
|
657
|
-
chat_id (string): chat
|
|
658
|
-
chatMessage_id (string):
|
|
659
|
-
select (array): Select properties to be returned
|
|
660
|
-
expand (array): Expand related entities
|
|
310
|
+
chat_id (string): The unique identifier of the chat.
|
|
311
|
+
chatMessage_id (string): The unique identifier of the message.
|
|
661
312
|
|
|
662
313
|
Returns:
|
|
663
|
-
Any: Retrieved
|
|
314
|
+
Any: Retrieved chatMessage entity.
|
|
664
315
|
|
|
665
316
|
Raises:
|
|
666
317
|
HTTPStatusError: Raised when the API request fails with detailed error information including status code and response body.
|
|
667
318
|
|
|
668
319
|
Tags:
|
|
669
|
-
chats.chatMessage
|
|
320
|
+
chats.chatMessage, read
|
|
670
321
|
"""
|
|
671
322
|
if chat_id is None:
|
|
672
323
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
673
324
|
if chatMessage_id is None:
|
|
674
325
|
raise ValueError("Missing required parameter 'chatMessage-id'.")
|
|
675
326
|
url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}"
|
|
676
|
-
|
|
677
|
-
|
|
327
|
+
|
|
328
|
+
# This endpoint explicitly does not support OData params
|
|
329
|
+
response = await self._aget(url)
|
|
678
330
|
return self._handle_response(response)
|
|
679
331
|
|
|
680
|
-
async def
|
|
681
|
-
self,
|
|
682
|
-
chat_id: str,
|
|
683
|
-
chatMessage_id: str,
|
|
684
|
-
top: int | None = None,
|
|
685
|
-
skip: int | None = None,
|
|
686
|
-
search: str | None = None,
|
|
687
|
-
filter: str | None = None,
|
|
688
|
-
count: bool | None = None,
|
|
689
|
-
orderby: list[str] | None = None,
|
|
690
|
-
select: list[str] | None = None,
|
|
691
|
-
expand: list[str] | None = None,
|
|
692
|
-
) -> dict[str, Any]:
|
|
332
|
+
async def send_chat_message(self, chat_id: str, content: str) -> dict[str, Any]:
|
|
693
333
|
"""
|
|
694
|
-
|
|
695
|
-
|
|
334
|
+
Posts a new message to a specific Microsoft Teams chat using its unique ID.
|
|
335
|
+
|
|
696
336
|
Args:
|
|
697
|
-
chat_id (string): chat
|
|
698
|
-
|
|
699
|
-
top (integer): Show only the first n items Example: '50'.
|
|
700
|
-
skip (integer): Skip the first n items
|
|
701
|
-
search (string): Search items by search phrases
|
|
702
|
-
filter (string): Filter items by property values
|
|
703
|
-
count (boolean): Include count of items
|
|
704
|
-
orderby (array): Order items by property values
|
|
705
|
-
select (array): Select properties to be returned
|
|
706
|
-
expand (array): Expand related entities
|
|
337
|
+
chat_id (string): The unique identifier of the chat.
|
|
338
|
+
content (string): The message content to send (plain text or HTML).
|
|
707
339
|
|
|
708
340
|
Returns:
|
|
709
|
-
dict[str, Any]:
|
|
341
|
+
dict[str, Any]: A dictionary containing the API response for the sent message, including its ID.
|
|
710
342
|
|
|
711
343
|
Raises:
|
|
712
|
-
HTTPStatusError:
|
|
344
|
+
HTTPStatusError: If the API request fails due to invalid ID, permissions, etc.
|
|
713
345
|
|
|
714
346
|
Tags:
|
|
715
|
-
chats.chatMessage
|
|
347
|
+
chats.chatMessage, create, send, important
|
|
716
348
|
"""
|
|
717
349
|
if chat_id is None:
|
|
718
350
|
raise ValueError("Missing required parameter 'chat-id'.")
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
for k, v in [
|
|
725
|
-
("$top", top),
|
|
726
|
-
("$skip", skip),
|
|
727
|
-
("$search", search),
|
|
728
|
-
("$filter", filter),
|
|
729
|
-
("$count", count),
|
|
730
|
-
("$orderby", orderby),
|
|
731
|
-
("$select", select),
|
|
732
|
-
("$expand", expand),
|
|
733
|
-
]
|
|
734
|
-
if v is not None
|
|
735
|
-
}
|
|
736
|
-
response = await self._aget(url, params=query_params)
|
|
351
|
+
|
|
352
|
+
url = f"{self.base_url}/chats/{chat_id}/messages"
|
|
353
|
+
payload = {"body": {"content": content}}
|
|
354
|
+
|
|
355
|
+
response = await self._apost(url, data=payload)
|
|
737
356
|
return self._handle_response(response)
|
|
738
357
|
|
|
739
|
-
|
|
358
|
+
# Channels
|
|
359
|
+
|
|
360
|
+
async def list_all_channels(
|
|
740
361
|
self,
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
channelIdentity: dict[str, dict[str, Any]] | None = None,
|
|
747
|
-
chatId: str | None = None,
|
|
748
|
-
createdDateTime: str | None = None,
|
|
749
|
-
deletedDateTime: str | None = None,
|
|
750
|
-
etag: str | None = None,
|
|
751
|
-
eventDetail: dict[str, dict[str, Any]] | None = None,
|
|
752
|
-
from_: Any | None = None,
|
|
753
|
-
importance: str | None = None,
|
|
754
|
-
lastEditedDateTime: str | None = None,
|
|
755
|
-
lastModifiedDateTime: str | None = None,
|
|
756
|
-
locale: str | None = None,
|
|
757
|
-
mentions: list[dict[str, dict[str, Any]]] | None = None,
|
|
758
|
-
messageHistory: list[dict[str, dict[str, Any]]] | None = None,
|
|
759
|
-
messageType: str | None = None,
|
|
760
|
-
policyViolation: dict[str, dict[str, Any]] | None = None,
|
|
761
|
-
reactions: list[dict[str, dict[str, Any]]] | None = None,
|
|
762
|
-
replyToId: str | None = None,
|
|
763
|
-
subject: str | None = None,
|
|
764
|
-
summary: str | None = None,
|
|
765
|
-
webUrl: str | None = None,
|
|
766
|
-
hostedContents: list[Any] | None = None,
|
|
767
|
-
replies: list[Any] | None = None,
|
|
768
|
-
) -> Any:
|
|
362
|
+
team_id: str,
|
|
363
|
+
filter: str | None = None,
|
|
364
|
+
select: list[str] | None = None,
|
|
365
|
+
expand: list[str] | None = None,
|
|
366
|
+
) -> dict[str, Any]:
|
|
769
367
|
"""
|
|
770
|
-
|
|
368
|
+
Retrieves the list of channels either in this team or shared with this team (incoming channels).
|
|
369
|
+
Supported OData parameters:
|
|
370
|
+
- $filter: Filter by property values.
|
|
371
|
+
- $select: Select specific properties to return (recommended for performance).
|
|
372
|
+
- $expand: Expand related entities.
|
|
771
373
|
|
|
772
374
|
Args:
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
body (object): body
|
|
778
|
-
channelIdentity (object): channelIdentity
|
|
779
|
-
chatId (string): If the message was sent in a chat, represents the identity of the chat.
|
|
780
|
-
createdDateTime (string): Timestamp of when the chat message was created.
|
|
781
|
-
deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
|
|
782
|
-
etag (string): Read-only. Version number of the chat message.
|
|
783
|
-
eventDetail (object): eventDetail
|
|
784
|
-
from_ (string): from
|
|
785
|
-
importance (string): importance
|
|
786
|
-
lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
|
|
787
|
-
lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
|
|
788
|
-
locale (string): Locale of the chat message set by the client. Always set to en-us.
|
|
789
|
-
mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
|
|
790
|
-
messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
|
|
791
|
-
messageType (string): messageType
|
|
792
|
-
policyViolation (object): policyViolation
|
|
793
|
-
reactions (array): Reactions for this chat message (for example, Like).
|
|
794
|
-
replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
|
|
795
|
-
subject (string): The subject of the chat message, in plaintext.
|
|
796
|
-
summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
|
|
797
|
-
webUrl (string): Read-only. Link to the message in Microsoft Teams.
|
|
798
|
-
hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
|
|
799
|
-
replies (array): Replies for a specified message. Supports $expand for channel messages.
|
|
375
|
+
team_id (string): The unique identifier of the team.
|
|
376
|
+
filter (string): Filter items by property values.
|
|
377
|
+
select (array): Select properties to be returned.
|
|
378
|
+
expand (array): Expand related entities.
|
|
800
379
|
|
|
801
380
|
Returns:
|
|
802
|
-
Any:
|
|
381
|
+
dict[str, Any]: Retrieved collection of channels.
|
|
803
382
|
|
|
804
383
|
Raises:
|
|
805
|
-
HTTPStatusError:
|
|
384
|
+
HTTPStatusError: If the API request fails.
|
|
806
385
|
|
|
807
386
|
Tags:
|
|
808
|
-
|
|
387
|
+
teams.channel, list, read
|
|
809
388
|
"""
|
|
810
|
-
if
|
|
811
|
-
raise ValueError("Missing required parameter '
|
|
812
|
-
if chatMessage_id is None:
|
|
813
|
-
raise ValueError("Missing required parameter 'chatMessage-id'.")
|
|
814
|
-
request_body_data = None
|
|
815
|
-
request_body_data = {
|
|
816
|
-
"id": id,
|
|
817
|
-
"attachments": attachments,
|
|
818
|
-
"body": body,
|
|
819
|
-
"channelIdentity": channelIdentity,
|
|
820
|
-
"chatId": chatId,
|
|
821
|
-
"createdDateTime": createdDateTime,
|
|
822
|
-
"deletedDateTime": deletedDateTime,
|
|
823
|
-
"etag": etag,
|
|
824
|
-
"eventDetail": eventDetail,
|
|
825
|
-
"from": from_,
|
|
826
|
-
"importance": importance,
|
|
827
|
-
"lastEditedDateTime": lastEditedDateTime,
|
|
828
|
-
"lastModifiedDateTime": lastModifiedDateTime,
|
|
829
|
-
"locale": locale,
|
|
830
|
-
"mentions": mentions,
|
|
831
|
-
"messageHistory": messageHistory,
|
|
832
|
-
"messageType": messageType,
|
|
833
|
-
"policyViolation": policyViolation,
|
|
834
|
-
"reactions": reactions,
|
|
835
|
-
"replyToId": replyToId,
|
|
836
|
-
"subject": subject,
|
|
837
|
-
"summary": summary,
|
|
838
|
-
"webUrl": webUrl,
|
|
839
|
-
"hostedContents": hostedContents,
|
|
840
|
-
"replies": replies,
|
|
841
|
-
}
|
|
842
|
-
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
843
|
-
url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies"
|
|
844
|
-
query_params = {}
|
|
845
|
-
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
846
|
-
return self._handle_response(response)
|
|
847
|
-
|
|
848
|
-
async def get_chat_reply_details(
|
|
849
|
-
self, chat_id: str, chatMessage_id: str, chatMessage_id1: str, select: list[str] | None = None, expand: list[str] | None = None
|
|
850
|
-
) -> Any:
|
|
851
|
-
"""
|
|
852
|
-
Retrieves a specific reply from a chat message thread using the chat, parent message, and reply IDs. Unlike `list_chat_message_replies`, which fetches all replies, this function targets a single reply for detailed information, allowing for customized field selection.
|
|
389
|
+
if team_id is None:
|
|
390
|
+
raise ValueError("Missing required parameter 'team-id'.")
|
|
853
391
|
|
|
854
|
-
|
|
855
|
-
chat_id (string): chat-id
|
|
856
|
-
chatMessage_id (string): chatMessage-id
|
|
857
|
-
chatMessage_id1 (string): chatMessage-id1
|
|
858
|
-
select (array): Select properties to be returned
|
|
859
|
-
expand (array): Expand related entities
|
|
392
|
+
url = f"{self.base_url}/teams/{team_id}/allChannels"
|
|
860
393
|
|
|
861
|
-
|
|
862
|
-
|
|
394
|
+
# Helper to format list params
|
|
395
|
+
def fmt(val):
|
|
396
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
863
397
|
|
|
864
|
-
|
|
865
|
-
|
|
398
|
+
query_params = {
|
|
399
|
+
k: fmt(v)
|
|
400
|
+
for k, v in [
|
|
401
|
+
("$filter", filter),
|
|
402
|
+
("$select", select),
|
|
403
|
+
("$expand", expand),
|
|
404
|
+
]
|
|
405
|
+
if v is not None
|
|
406
|
+
}
|
|
866
407
|
|
|
867
|
-
Tags:
|
|
868
|
-
chats.chatMessage
|
|
869
|
-
"""
|
|
870
|
-
if chat_id is None:
|
|
871
|
-
raise ValueError("Missing required parameter 'chat-id'.")
|
|
872
|
-
if chatMessage_id is None:
|
|
873
|
-
raise ValueError("Missing required parameter 'chatMessage-id'.")
|
|
874
|
-
if chatMessage_id1 is None:
|
|
875
|
-
raise ValueError("Missing required parameter 'chatMessage-id1'.")
|
|
876
|
-
url = f"{self.base_url}/chats/{chat_id}/messages/{chatMessage_id}/replies/{chatMessage_id1}"
|
|
877
|
-
query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
|
|
878
408
|
response = await self._aget(url, params=query_params)
|
|
879
409
|
return self._handle_response(response)
|
|
880
410
|
|
|
881
|
-
async def
|
|
411
|
+
async def get_channel(
|
|
882
412
|
self,
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
displayName: str | None = None,
|
|
889
|
-
firstChannelName: str | None = None,
|
|
890
|
-
funSettings: dict[str, dict[str, Any]] | None = None,
|
|
891
|
-
guestSettings: dict[str, dict[str, Any]] | None = None,
|
|
892
|
-
internalId: str | None = None,
|
|
893
|
-
isArchived: bool | None = None,
|
|
894
|
-
memberSettings: dict[str, dict[str, Any]] | None = None,
|
|
895
|
-
messagingSettings: dict[str, dict[str, Any]] | None = None,
|
|
896
|
-
specialization: str | None = None,
|
|
897
|
-
summary: dict[str, dict[str, Any]] | None = None,
|
|
898
|
-
tenantId: str | None = None,
|
|
899
|
-
visibility: str | None = None,
|
|
900
|
-
webUrl: str | None = None,
|
|
901
|
-
allChannels: list[Any] | None = None,
|
|
902
|
-
channels: list[Any] | None = None,
|
|
903
|
-
group: Any | None = None,
|
|
904
|
-
incomingChannels: list[Any] | None = None,
|
|
905
|
-
installedApps: list[Any] | None = None,
|
|
906
|
-
members: list[Any] | None = None,
|
|
907
|
-
operations: list[Any] | None = None,
|
|
908
|
-
permissionGrants: list[Any] | None = None,
|
|
909
|
-
photo: Any | None = None,
|
|
910
|
-
primaryChannel: Any | None = None,
|
|
911
|
-
schedule: Any | None = None,
|
|
912
|
-
tags: list[Any] | None = None,
|
|
913
|
-
template: Any | None = None,
|
|
914
|
-
) -> Any:
|
|
413
|
+
team_id: str,
|
|
414
|
+
channel_id: str,
|
|
415
|
+
select: list[str] | None = None,
|
|
416
|
+
expand: list[str] | None = None,
|
|
417
|
+
) -> dict[str, Any]:
|
|
915
418
|
"""
|
|
916
|
-
|
|
419
|
+
Retrieve the properties and relationships of a channel.
|
|
420
|
+
Supported OData parameters:
|
|
421
|
+
- $select: Select specific properties to return (recommended for performance).
|
|
422
|
+
- $expand: Expand related entities.
|
|
917
423
|
|
|
918
424
|
Args:
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
description (string): An optional description for the team. Maximum length: 1,024 characters.
|
|
924
|
-
displayName (string): The name of the team.
|
|
925
|
-
firstChannelName (string): The name of the first channel in the team. This is an optional property, only used during team creation and isn't returned in methods to get and list teams.
|
|
926
|
-
funSettings (object): funSettings
|
|
927
|
-
guestSettings (object): guestSettings
|
|
928
|
-
internalId (string): A unique ID for the team that was used in a few places such as the audit log/Office 365 Management Activity API.
|
|
929
|
-
isArchived (boolean): Whether this team is in read-only mode.
|
|
930
|
-
memberSettings (object): memberSettings
|
|
931
|
-
messagingSettings (object): messagingSettings
|
|
932
|
-
specialization (string): specialization
|
|
933
|
-
summary (object): summary
|
|
934
|
-
tenantId (string): The ID of the Microsoft Entra tenant.
|
|
935
|
-
visibility (string): visibility
|
|
936
|
-
webUrl (string): A hyperlink that goes to the team in the Microsoft Teams client. You get this URL when you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated as an opaque blob, and not parsed.
|
|
937
|
-
allChannels (array): List of channels either hosted in or shared with the team (incoming channels).
|
|
938
|
-
channels (array): The collection of channels and messages associated with the team.
|
|
939
|
-
group (string): group
|
|
940
|
-
incomingChannels (array): List of channels shared with the team.
|
|
941
|
-
installedApps (array): The apps installed in this team.
|
|
942
|
-
members (array): Members and owners of the team.
|
|
943
|
-
operations (array): The async operations that ran or are running on this team.
|
|
944
|
-
permissionGrants (array): A collection of permissions granted to apps to access the team.
|
|
945
|
-
photo (string): photo
|
|
946
|
-
primaryChannel (string): primaryChannel
|
|
947
|
-
schedule (string): schedule
|
|
948
|
-
tags (array): The tags associated with the team.
|
|
949
|
-
template (string): template
|
|
425
|
+
team_id (string): The unique identifier of the team.
|
|
426
|
+
channel_id (string): The unique identifier of the channel.
|
|
427
|
+
select (array): Select properties to be returned.
|
|
428
|
+
expand (array): Expand related entities.
|
|
950
429
|
|
|
951
430
|
Returns:
|
|
952
|
-
Any:
|
|
431
|
+
dict[str, Any]: Retrieved channel entity.
|
|
953
432
|
|
|
954
433
|
Raises:
|
|
955
|
-
HTTPStatusError:
|
|
434
|
+
HTTPStatusError: If the API request fails.
|
|
956
435
|
|
|
957
436
|
Tags:
|
|
958
|
-
|
|
959
|
-
"""
|
|
960
|
-
if group_id is None:
|
|
961
|
-
raise ValueError("Missing required parameter 'group-id'.")
|
|
962
|
-
request_body_data = None
|
|
963
|
-
request_body_data = {
|
|
964
|
-
"id": id,
|
|
965
|
-
"classification": classification,
|
|
966
|
-
"createdDateTime": createdDateTime,
|
|
967
|
-
"description": description,
|
|
968
|
-
"displayName": displayName,
|
|
969
|
-
"firstChannelName": firstChannelName,
|
|
970
|
-
"funSettings": funSettings,
|
|
971
|
-
"guestSettings": guestSettings,
|
|
972
|
-
"internalId": internalId,
|
|
973
|
-
"isArchived": isArchived,
|
|
974
|
-
"memberSettings": memberSettings,
|
|
975
|
-
"messagingSettings": messagingSettings,
|
|
976
|
-
"specialization": specialization,
|
|
977
|
-
"summary": summary,
|
|
978
|
-
"tenantId": tenantId,
|
|
979
|
-
"visibility": visibility,
|
|
980
|
-
"webUrl": webUrl,
|
|
981
|
-
"allChannels": allChannels,
|
|
982
|
-
"channels": channels,
|
|
983
|
-
"group": group,
|
|
984
|
-
"incomingChannels": incomingChannels,
|
|
985
|
-
"installedApps": installedApps,
|
|
986
|
-
"members": members,
|
|
987
|
-
"operations": operations,
|
|
988
|
-
"permissionGrants": permissionGrants,
|
|
989
|
-
"photo": photo,
|
|
990
|
-
"primaryChannel": primaryChannel,
|
|
991
|
-
"schedule": schedule,
|
|
992
|
-
"tags": tags,
|
|
993
|
-
"template": template,
|
|
994
|
-
}
|
|
995
|
-
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
996
|
-
url = f"{self.base_url}/groups/{group_id}/team"
|
|
997
|
-
query_params = {}
|
|
998
|
-
response = await self._aput(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
999
|
-
return self._handle_response(response)
|
|
1000
|
-
|
|
1001
|
-
async def create_team(
|
|
1002
|
-
self,
|
|
1003
|
-
id: str | None = None,
|
|
1004
|
-
classification: str | None = None,
|
|
1005
|
-
createdDateTime: str | None = None,
|
|
1006
|
-
description: str | None = None,
|
|
1007
|
-
displayName: str | None = None,
|
|
1008
|
-
firstChannelName: str | None = None,
|
|
1009
|
-
funSettings: dict[str, dict[str, Any]] | None = None,
|
|
1010
|
-
guestSettings: dict[str, dict[str, Any]] | None = None,
|
|
1011
|
-
internalId: str | None = None,
|
|
1012
|
-
isArchived: bool | None = None,
|
|
1013
|
-
memberSettings: dict[str, dict[str, Any]] | None = None,
|
|
1014
|
-
messagingSettings: dict[str, dict[str, Any]] | None = None,
|
|
1015
|
-
specialization: str | None = None,
|
|
1016
|
-
summary: dict[str, dict[str, Any]] | None = None,
|
|
1017
|
-
tenantId: str | None = None,
|
|
1018
|
-
visibility: str | None = None,
|
|
1019
|
-
webUrl: str | None = None,
|
|
1020
|
-
allChannels: list[Any] | None = None,
|
|
1021
|
-
channels: list[Any] | None = None,
|
|
1022
|
-
group: Any | None = None,
|
|
1023
|
-
incomingChannels: list[Any] | None = None,
|
|
1024
|
-
installedApps: list[Any] | None = None,
|
|
1025
|
-
members: list[Any] | None = None,
|
|
1026
|
-
operations: list[Any] | None = None,
|
|
1027
|
-
permissionGrants: list[Any] | None = None,
|
|
1028
|
-
photo: Any | None = None,
|
|
1029
|
-
primaryChannel: Any | None = None,
|
|
1030
|
-
schedule: Any | None = None,
|
|
1031
|
-
tags: list[Any] | None = None,
|
|
1032
|
-
template: Any | None = None,
|
|
1033
|
-
) -> Any:
|
|
437
|
+
teams.channel, read
|
|
1034
438
|
"""
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
classification (string): An optional label. Typically describes the data or business sensitivity of the team. Must match one of a preconfigured set in the tenant's directory.
|
|
1040
|
-
createdDateTime (string): Timestamp at which the team was created.
|
|
1041
|
-
description (string): An optional description for the team. Maximum length: 1,024 characters.
|
|
1042
|
-
displayName (string): The name of the team.
|
|
1043
|
-
firstChannelName (string): The name of the first channel in the team. This is an optional property, only used during team creation and isn't returned in methods to get and list teams.
|
|
1044
|
-
funSettings (object): funSettings
|
|
1045
|
-
guestSettings (object): guestSettings
|
|
1046
|
-
internalId (string): A unique ID for the team that was used in a few places such as the audit log/Office 365 Management Activity API.
|
|
1047
|
-
isArchived (boolean): Whether this team is in read-only mode.
|
|
1048
|
-
memberSettings (object): memberSettings
|
|
1049
|
-
messagingSettings (object): messagingSettings
|
|
1050
|
-
specialization (string): specialization
|
|
1051
|
-
summary (object): summary
|
|
1052
|
-
tenantId (string): The ID of the Microsoft Entra tenant.
|
|
1053
|
-
visibility (string): visibility
|
|
1054
|
-
webUrl (string): A hyperlink that goes to the team in the Microsoft Teams client. You get this URL when you right-click a team in the Microsoft Teams client and select Get link to team. This URL should be treated as an opaque blob, and not parsed.
|
|
1055
|
-
allChannels (array): List of channels either hosted in or shared with the team (incoming channels).
|
|
1056
|
-
channels (array): The collection of channels and messages associated with the team.
|
|
1057
|
-
group (string): group
|
|
1058
|
-
incomingChannels (array): List of channels shared with the team.
|
|
1059
|
-
installedApps (array): The apps installed in this team.
|
|
1060
|
-
members (array): Members and owners of the team.
|
|
1061
|
-
operations (array): The async operations that ran or are running on this team.
|
|
1062
|
-
permissionGrants (array): A collection of permissions granted to apps to access the team.
|
|
1063
|
-
photo (string): photo
|
|
1064
|
-
primaryChannel (string): primaryChannel
|
|
1065
|
-
schedule (string): schedule
|
|
1066
|
-
tags (array): The tags associated with the team.
|
|
1067
|
-
template (string): template
|
|
439
|
+
if team_id is None:
|
|
440
|
+
raise ValueError("Missing required parameter 'team-id'.")
|
|
441
|
+
if channel_id is None:
|
|
442
|
+
raise ValueError("Missing required parameter 'channel-id'.")
|
|
1068
443
|
|
|
1069
|
-
|
|
1070
|
-
Any: Created entity
|
|
444
|
+
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}"
|
|
1071
445
|
|
|
1072
|
-
|
|
1073
|
-
|
|
446
|
+
# Helper to format list params
|
|
447
|
+
def fmt(val):
|
|
448
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
1074
449
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
"createdDateTime": createdDateTime,
|
|
1083
|
-
"description": description,
|
|
1084
|
-
"displayName": displayName,
|
|
1085
|
-
"firstChannelName": firstChannelName,
|
|
1086
|
-
"funSettings": funSettings,
|
|
1087
|
-
"guestSettings": guestSettings,
|
|
1088
|
-
"internalId": internalId,
|
|
1089
|
-
"isArchived": isArchived,
|
|
1090
|
-
"memberSettings": memberSettings,
|
|
1091
|
-
"messagingSettings": messagingSettings,
|
|
1092
|
-
"specialization": specialization,
|
|
1093
|
-
"summary": summary,
|
|
1094
|
-
"tenantId": tenantId,
|
|
1095
|
-
"visibility": visibility,
|
|
1096
|
-
"webUrl": webUrl,
|
|
1097
|
-
"allChannels": allChannels,
|
|
1098
|
-
"channels": channels,
|
|
1099
|
-
"group": group,
|
|
1100
|
-
"incomingChannels": incomingChannels,
|
|
1101
|
-
"installedApps": installedApps,
|
|
1102
|
-
"members": members,
|
|
1103
|
-
"operations": operations,
|
|
1104
|
-
"permissionGrants": permissionGrants,
|
|
1105
|
-
"photo": photo,
|
|
1106
|
-
"primaryChannel": primaryChannel,
|
|
1107
|
-
"schedule": schedule,
|
|
1108
|
-
"tags": tags,
|
|
1109
|
-
"template": template,
|
|
450
|
+
query_params = {
|
|
451
|
+
k: fmt(v)
|
|
452
|
+
for k, v in [
|
|
453
|
+
("$select", select),
|
|
454
|
+
("$expand", expand),
|
|
455
|
+
]
|
|
456
|
+
if v is not None
|
|
1110
457
|
}
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
query_params = {}
|
|
1114
|
-
response = await self._apost(url, data=request_body_data, params=query_params, content_type="application/json")
|
|
458
|
+
|
|
459
|
+
response = await self._aget(url, params=query_params)
|
|
1115
460
|
return self._handle_response(response)
|
|
1116
461
|
|
|
1117
|
-
async def
|
|
1118
|
-
self,
|
|
1119
|
-
|
|
462
|
+
async def get_primary_channel(
|
|
463
|
+
self,
|
|
464
|
+
team_id: str,
|
|
465
|
+
select: list[str] | None = None,
|
|
466
|
+
expand: list[str] | None = None,
|
|
467
|
+
) -> dict[str, Any]:
|
|
1120
468
|
"""
|
|
1121
|
-
|
|
469
|
+
Retrieve the default General channel of a team.
|
|
470
|
+
Supported OData parameters:
|
|
471
|
+
- $select: Select specific properties to return.
|
|
472
|
+
- $expand: Expand related entities.
|
|
1122
473
|
|
|
1123
474
|
Args:
|
|
1124
|
-
team_id (string): team
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
expand (array): Expand related entities
|
|
475
|
+
team_id (string): The unique identifier of the team.
|
|
476
|
+
select (array): Select properties to be returned.
|
|
477
|
+
expand (array): Expand related entities.
|
|
1128
478
|
|
|
1129
479
|
Returns:
|
|
1130
|
-
Any: Retrieved
|
|
480
|
+
dict[str, Any]: Retrieved channel entity.
|
|
1131
481
|
|
|
1132
482
|
Raises:
|
|
1133
|
-
HTTPStatusError:
|
|
483
|
+
HTTPStatusError: If the API request fails.
|
|
1134
484
|
|
|
1135
485
|
Tags:
|
|
1136
|
-
teams.channel
|
|
486
|
+
teams.channel, read
|
|
1137
487
|
"""
|
|
1138
488
|
if team_id is None:
|
|
1139
489
|
raise ValueError("Missing required parameter 'team-id'.")
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
490
|
+
|
|
491
|
+
url = f"{self.base_url}/teams/{team_id}/primaryChannel"
|
|
492
|
+
|
|
493
|
+
# Helper to format list params
|
|
494
|
+
def fmt(val):
|
|
495
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
496
|
+
|
|
497
|
+
query_params = {
|
|
498
|
+
k: fmt(v)
|
|
499
|
+
for k, v in [
|
|
500
|
+
("$select", select),
|
|
501
|
+
("$expand", expand),
|
|
502
|
+
]
|
|
503
|
+
if v is not None
|
|
504
|
+
}
|
|
505
|
+
|
|
1144
506
|
response = await self._aget(url, params=query_params)
|
|
1145
507
|
return self._handle_response(response)
|
|
1146
508
|
|
|
1147
|
-
async def
|
|
509
|
+
async def send_channel_message(
|
|
1148
510
|
self,
|
|
1149
511
|
team_id: str,
|
|
1150
512
|
channel_id: str,
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
attachments: list[dict[str, dict[str, Any]]] | None = None,
|
|
1154
|
-
body: dict[str, dict[str, Any]] | None = None,
|
|
1155
|
-
channelIdentity: dict[str, dict[str, Any]] | None = None,
|
|
1156
|
-
chatId: str | None = None,
|
|
1157
|
-
createdDateTime: str | None = None,
|
|
1158
|
-
deletedDateTime: str | None = None,
|
|
1159
|
-
etag: str | None = None,
|
|
1160
|
-
eventDetail: dict[str, dict[str, Any]] | None = None,
|
|
1161
|
-
from_: Any | None = None,
|
|
1162
|
-
importance: str | None = None,
|
|
1163
|
-
lastEditedDateTime: str | None = None,
|
|
1164
|
-
lastModifiedDateTime: str | None = None,
|
|
1165
|
-
locale: str | None = None,
|
|
1166
|
-
mentions: list[dict[str, dict[str, Any]]] | None = None,
|
|
1167
|
-
messageHistory: list[dict[str, dict[str, Any]]] | None = None,
|
|
1168
|
-
messageType: str | None = None,
|
|
1169
|
-
policyViolation: dict[str, dict[str, Any]] | None = None,
|
|
1170
|
-
reactions: list[dict[str, dict[str, Any]]] | None = None,
|
|
1171
|
-
replyToId: str | None = None,
|
|
1172
|
-
subject: str | None = None,
|
|
1173
|
-
summary: str | None = None,
|
|
1174
|
-
webUrl: str | None = None,
|
|
1175
|
-
hostedContents: list[Any] | None = None,
|
|
1176
|
-
replies: list[Any] | None = None,
|
|
1177
|
-
) -> Any:
|
|
513
|
+
content: str,
|
|
514
|
+
) -> dict[str, Any]:
|
|
1178
515
|
"""
|
|
1179
|
-
|
|
516
|
+
Posts a new message to a specific channel in a team.
|
|
1180
517
|
|
|
1181
518
|
Args:
|
|
1182
|
-
team_id (string): team
|
|
1183
|
-
channel_id (string): channel
|
|
1184
|
-
|
|
1185
|
-
id (string): The unique identifier for an entity. Read-only.
|
|
1186
|
-
attachments (array): References to attached objects like files, tabs, meetings etc.
|
|
1187
|
-
body (object): body
|
|
1188
|
-
channelIdentity (object): channelIdentity
|
|
1189
|
-
chatId (string): If the message was sent in a chat, represents the identity of the chat.
|
|
1190
|
-
createdDateTime (string): Timestamp of when the chat message was created.
|
|
1191
|
-
deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
|
|
1192
|
-
etag (string): Read-only. Version number of the chat message.
|
|
1193
|
-
eventDetail (object): eventDetail
|
|
1194
|
-
from_ (string): from
|
|
1195
|
-
importance (string): importance
|
|
1196
|
-
lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
|
|
1197
|
-
lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
|
|
1198
|
-
locale (string): Locale of the chat message set by the client. Always set to en-us.
|
|
1199
|
-
mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
|
|
1200
|
-
messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
|
|
1201
|
-
messageType (string): messageType
|
|
1202
|
-
policyViolation (object): policyViolation
|
|
1203
|
-
reactions (array): Reactions for this chat message (for example, Like).
|
|
1204
|
-
replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
|
|
1205
|
-
subject (string): The subject of the chat message, in plaintext.
|
|
1206
|
-
summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
|
|
1207
|
-
webUrl (string): Read-only. Link to the message in Microsoft Teams.
|
|
1208
|
-
hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
|
|
1209
|
-
replies (array): Replies for a specified message. Supports $expand for channel messages.
|
|
519
|
+
team_id (string): The unique identifier of the team.
|
|
520
|
+
channel_id (string): The unique identifier of the channel.
|
|
521
|
+
content (string): The message content to send (plain text or HTML).
|
|
1210
522
|
|
|
1211
523
|
Returns:
|
|
1212
|
-
Any:
|
|
524
|
+
dict[str, Any]: A dictionary containing the API response for the sent message, including its ID.
|
|
1213
525
|
|
|
1214
526
|
Raises:
|
|
1215
|
-
HTTPStatusError:
|
|
527
|
+
HTTPStatusError: If the API request fails.
|
|
1216
528
|
|
|
1217
529
|
Tags:
|
|
1218
|
-
teams.channel
|
|
530
|
+
teams.channel, channel.message, create, send
|
|
1219
531
|
"""
|
|
1220
532
|
if team_id is None:
|
|
1221
533
|
raise ValueError("Missing required parameter 'team-id'.")
|
|
1222
534
|
if channel_id is None:
|
|
1223
535
|
raise ValueError("Missing required parameter 'channel-id'.")
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
"attachments": attachments,
|
|
1230
|
-
"body": body,
|
|
1231
|
-
"channelIdentity": channelIdentity,
|
|
1232
|
-
"chatId": chatId,
|
|
1233
|
-
"createdDateTime": createdDateTime,
|
|
1234
|
-
"deletedDateTime": deletedDateTime,
|
|
1235
|
-
"etag": etag,
|
|
1236
|
-
"eventDetail": eventDetail,
|
|
1237
|
-
"from": from_,
|
|
1238
|
-
"importance": importance,
|
|
1239
|
-
"lastEditedDateTime": lastEditedDateTime,
|
|
1240
|
-
"lastModifiedDateTime": lastModifiedDateTime,
|
|
1241
|
-
"locale": locale,
|
|
1242
|
-
"mentions": mentions,
|
|
1243
|
-
"messageHistory": messageHistory,
|
|
1244
|
-
"messageType": messageType,
|
|
1245
|
-
"policyViolation": policyViolation,
|
|
1246
|
-
"reactions": reactions,
|
|
1247
|
-
"replyToId": replyToId,
|
|
1248
|
-
"subject": subject,
|
|
1249
|
-
"summary": summary,
|
|
1250
|
-
"webUrl": webUrl,
|
|
1251
|
-
"hostedContents": hostedContents,
|
|
1252
|
-
"replies": replies,
|
|
1253
|
-
}
|
|
1254
|
-
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
1255
|
-
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{chatMessage_id}"
|
|
1256
|
-
query_params = {}
|
|
1257
|
-
response = self._patch(url, data=request_body_data, params=query_params)
|
|
536
|
+
|
|
537
|
+
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages"
|
|
538
|
+
payload = {"body": {"content": content}}
|
|
539
|
+
|
|
540
|
+
response = await self._apost(url, data=payload)
|
|
1258
541
|
return self._handle_response(response)
|
|
1259
542
|
|
|
1260
|
-
async def
|
|
543
|
+
async def reply_to_channel_message(
|
|
1261
544
|
self,
|
|
1262
545
|
team_id: str,
|
|
1263
546
|
channel_id: str,
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
attachments: list[dict[str, dict[str, Any]]] | None = None,
|
|
1268
|
-
body: dict[str, dict[str, Any]] | None = None,
|
|
1269
|
-
channelIdentity: dict[str, dict[str, Any]] | None = None,
|
|
1270
|
-
chatId: str | None = None,
|
|
1271
|
-
createdDateTime: str | None = None,
|
|
1272
|
-
deletedDateTime: str | None = None,
|
|
1273
|
-
etag: str | None = None,
|
|
1274
|
-
eventDetail: dict[str, dict[str, Any]] | None = None,
|
|
1275
|
-
from_: Any | None = None,
|
|
1276
|
-
importance: str | None = None,
|
|
1277
|
-
lastEditedDateTime: str | None = None,
|
|
1278
|
-
lastModifiedDateTime: str | None = None,
|
|
1279
|
-
locale: str | None = None,
|
|
1280
|
-
mentions: list[dict[str, dict[str, Any]]] | None = None,
|
|
1281
|
-
messageHistory: list[dict[str, dict[str, Any]]] | None = None,
|
|
1282
|
-
messageType: str | None = None,
|
|
1283
|
-
policyViolation: dict[str, dict[str, Any]] | None = None,
|
|
1284
|
-
reactions: list[dict[str, dict[str, Any]]] | None = None,
|
|
1285
|
-
replyToId: str | None = None,
|
|
1286
|
-
subject: str | None = None,
|
|
1287
|
-
summary: str | None = None,
|
|
1288
|
-
webUrl: str | None = None,
|
|
1289
|
-
hostedContents: list[Any] | None = None,
|
|
1290
|
-
replies: list[Any] | None = None,
|
|
1291
|
-
) -> Any:
|
|
547
|
+
message_id: str,
|
|
548
|
+
content: str,
|
|
549
|
+
) -> dict[str, Any]:
|
|
1292
550
|
"""
|
|
1293
|
-
|
|
551
|
+
Sends a reply to an existing message in a channel.
|
|
1294
552
|
|
|
1295
553
|
Args:
|
|
1296
|
-
team_id (string): team
|
|
1297
|
-
channel_id (string): channel
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
id (string): The unique identifier for an entity. Read-only.
|
|
1301
|
-
attachments (array): References to attached objects like files, tabs, meetings etc.
|
|
1302
|
-
body (object): body
|
|
1303
|
-
channelIdentity (object): channelIdentity
|
|
1304
|
-
chatId (string): If the message was sent in a chat, represents the identity of the chat.
|
|
1305
|
-
createdDateTime (string): Timestamp of when the chat message was created.
|
|
1306
|
-
deletedDateTime (string): Read only. Timestamp at which the chat message was deleted, or null if not deleted.
|
|
1307
|
-
etag (string): Read-only. Version number of the chat message.
|
|
1308
|
-
eventDetail (object): eventDetail
|
|
1309
|
-
from_ (string): from
|
|
1310
|
-
importance (string): importance
|
|
1311
|
-
lastEditedDateTime (string): Read only. Timestamp when edits to the chat message were made. Triggers an 'Edited' flag in the Teams UI. If no edits are made the value is null.
|
|
1312
|
-
lastModifiedDateTime (string): Read only. Timestamp when the chat message is created (initial setting) or modified, including when a reaction is added or removed.
|
|
1313
|
-
locale (string): Locale of the chat message set by the client. Always set to en-us.
|
|
1314
|
-
mentions (array): List of entities mentioned in the chat message. Supported entities are: user, bot, team, channel, chat, and tag.
|
|
1315
|
-
messageHistory (array): List of activity history of a message item, including modification time and actions, such as reactionAdded, reactionRemoved, or reaction changes, on the message.
|
|
1316
|
-
messageType (string): messageType
|
|
1317
|
-
policyViolation (object): policyViolation
|
|
1318
|
-
reactions (array): Reactions for this chat message (for example, Like).
|
|
1319
|
-
replyToId (string): Read-only. ID of the parent chat message or root chat message of the thread. (Only applies to chat messages in channels, not chats.)
|
|
1320
|
-
subject (string): The subject of the chat message, in plaintext.
|
|
1321
|
-
summary (string): Summary text of the chat message that could be used for push notifications and summary views or fall back views. Only applies to channel chat messages, not chat messages in a chat.
|
|
1322
|
-
webUrl (string): Read-only. Link to the message in Microsoft Teams.
|
|
1323
|
-
hostedContents (array): Content in a message hosted by Microsoft Teams - for example, images or code snippets.
|
|
1324
|
-
replies (array): Replies for a specified message. Supports $expand for channel messages.
|
|
554
|
+
team_id (string): The unique identifier of the team.
|
|
555
|
+
channel_id (string): The unique identifier of the channel.
|
|
556
|
+
message_id (string): The unique identifier of the message to reply to.
|
|
557
|
+
content (string): The reply content to send (plain text or HTML).
|
|
1325
558
|
|
|
1326
559
|
Returns:
|
|
1327
|
-
Any:
|
|
560
|
+
dict[str, Any]: A dictionary containing the API response for the created reply.
|
|
1328
561
|
|
|
1329
562
|
Raises:
|
|
1330
|
-
HTTPStatusError:
|
|
563
|
+
HTTPStatusError: If the API request fails.
|
|
1331
564
|
|
|
1332
565
|
Tags:
|
|
1333
|
-
teams.channel
|
|
566
|
+
teams.channel, channel.message, reply, create, send
|
|
1334
567
|
"""
|
|
1335
568
|
if team_id is None:
|
|
1336
569
|
raise ValueError("Missing required parameter 'team-id'.")
|
|
1337
570
|
if channel_id is None:
|
|
1338
571
|
raise ValueError("Missing required parameter 'channel-id'.")
|
|
1339
|
-
if
|
|
1340
|
-
raise ValueError("Missing required parameter '
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
"attachments": attachments,
|
|
1347
|
-
"body": body,
|
|
1348
|
-
"channelIdentity": channelIdentity,
|
|
1349
|
-
"chatId": chatId,
|
|
1350
|
-
"createdDateTime": createdDateTime,
|
|
1351
|
-
"deletedDateTime": deletedDateTime,
|
|
1352
|
-
"etag": etag,
|
|
1353
|
-
"eventDetail": eventDetail,
|
|
1354
|
-
"from": from_,
|
|
1355
|
-
"importance": importance,
|
|
1356
|
-
"lastEditedDateTime": lastEditedDateTime,
|
|
1357
|
-
"lastModifiedDateTime": lastModifiedDateTime,
|
|
1358
|
-
"locale": locale,
|
|
1359
|
-
"mentions": mentions,
|
|
1360
|
-
"messageHistory": messageHistory,
|
|
1361
|
-
"messageType": messageType,
|
|
1362
|
-
"policyViolation": policyViolation,
|
|
1363
|
-
"reactions": reactions,
|
|
1364
|
-
"replyToId": replyToId,
|
|
1365
|
-
"subject": subject,
|
|
1366
|
-
"summary": summary,
|
|
1367
|
-
"webUrl": webUrl,
|
|
1368
|
-
"hostedContents": hostedContents,
|
|
1369
|
-
"replies": replies,
|
|
1370
|
-
}
|
|
1371
|
-
request_body_data = {k: v for k, v in request_body_data.items() if v is not None}
|
|
1372
|
-
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{chatMessage_id}/replies/{chatMessage_id1}"
|
|
1373
|
-
query_params = {}
|
|
1374
|
-
response = self._patch(url, data=request_body_data, params=query_params)
|
|
572
|
+
if message_id is None:
|
|
573
|
+
raise ValueError("Missing required parameter 'message-id'.")
|
|
574
|
+
|
|
575
|
+
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/messages/{message_id}/replies"
|
|
576
|
+
payload = {"body": {"content": content}}
|
|
577
|
+
|
|
578
|
+
response = await self._apost(url, data=payload)
|
|
1375
579
|
return self._handle_response(response)
|
|
1376
580
|
|
|
1377
|
-
async def
|
|
581
|
+
async def list_pinned_chat_messages(
|
|
1378
582
|
self,
|
|
1379
|
-
|
|
1380
|
-
channel_id: str,
|
|
1381
|
-
top: int | None = None,
|
|
1382
|
-
skip: int | None = None,
|
|
1383
|
-
search: str | None = None,
|
|
1384
|
-
filter: str | None = None,
|
|
1385
|
-
count: bool | None = None,
|
|
1386
|
-
orderby: list[str] | None = None,
|
|
1387
|
-
select: list[str] | None = None,
|
|
583
|
+
chat_id: str,
|
|
1388
584
|
expand: list[str] | None = None,
|
|
1389
585
|
) -> dict[str, Any]:
|
|
1390
586
|
"""
|
|
1391
|
-
|
|
587
|
+
Get a list of pinned messages in a chat.
|
|
588
|
+
Supported OData parameters:
|
|
589
|
+
- $expand: Expand related entities (e.g., 'message').
|
|
1392
590
|
|
|
1393
591
|
Args:
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
top (integer): Show only the first n items Example: '50'.
|
|
1397
|
-
skip (integer): Skip the first n items
|
|
1398
|
-
search (string): Search items by search phrases
|
|
1399
|
-
filter (string): Filter items by property values
|
|
1400
|
-
count (boolean): Include count of items
|
|
1401
|
-
orderby (array): Order items by property values
|
|
1402
|
-
select (array): Select properties to be returned
|
|
1403
|
-
expand (array): Expand related entities
|
|
592
|
+
chat_id (string): The unique identifier of the chat.
|
|
593
|
+
expand (array): Expand related entities.
|
|
1404
594
|
|
|
1405
595
|
Returns:
|
|
1406
|
-
dict[str, Any]: Retrieved collection
|
|
596
|
+
dict[str, Any]: Retrieved collection of pinned messages.
|
|
1407
597
|
|
|
1408
598
|
Raises:
|
|
1409
|
-
HTTPStatusError:
|
|
599
|
+
HTTPStatusError: If the API request fails.
|
|
1410
600
|
|
|
1411
601
|
Tags:
|
|
1412
|
-
teams.
|
|
602
|
+
teams.chat, pinned_message, list, read
|
|
1413
603
|
"""
|
|
1414
|
-
if
|
|
1415
|
-
raise ValueError("Missing required parameter '
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
604
|
+
if chat_id is None:
|
|
605
|
+
raise ValueError("Missing required parameter 'chat-id'.")
|
|
606
|
+
|
|
607
|
+
url = f"{self.base_url}/chats/{chat_id}/pinnedMessages"
|
|
608
|
+
|
|
609
|
+
# Helper to format list params
|
|
610
|
+
def fmt(val):
|
|
611
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
612
|
+
|
|
1419
613
|
query_params = {
|
|
1420
|
-
k: v
|
|
614
|
+
k: fmt(v)
|
|
1421
615
|
for k, v in [
|
|
1422
|
-
("$top", top),
|
|
1423
|
-
("$skip", skip),
|
|
1424
|
-
("$search", search),
|
|
1425
|
-
("$filter", filter),
|
|
1426
|
-
("$count", count),
|
|
1427
|
-
("$orderby", orderby),
|
|
1428
|
-
("$select", select),
|
|
1429
616
|
("$expand", expand),
|
|
1430
617
|
]
|
|
1431
618
|
if v is not None
|
|
1432
619
|
}
|
|
620
|
+
|
|
1433
621
|
response = await self._aget(url, params=query_params)
|
|
1434
622
|
return self._handle_response(response)
|
|
1435
623
|
|
|
1436
|
-
async def
|
|
624
|
+
async def pin_chat_message(
|
|
1437
625
|
self,
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
configuration: dict[str, dict[str, Any]] | None = None,
|
|
1442
|
-
displayName: str | None = None,
|
|
1443
|
-
webUrl: str | None = None,
|
|
1444
|
-
teamsApp: Any | None = None,
|
|
1445
|
-
) -> Any:
|
|
626
|
+
chat_id: str,
|
|
627
|
+
message_id: str,
|
|
628
|
+
) -> dict[str, Any]:
|
|
1446
629
|
"""
|
|
1447
|
-
|
|
630
|
+
Pin a message in a chat.
|
|
1448
631
|
|
|
1449
632
|
Args:
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
id (string): The unique identifier for an entity. Read-only.
|
|
1453
|
-
configuration (object): configuration
|
|
1454
|
-
displayName (string): Name of the tab.
|
|
1455
|
-
webUrl (string): Deep link URL of the tab instance. Read only.
|
|
1456
|
-
teamsApp (string): teamsApp
|
|
633
|
+
chat_id (string): The unique identifier of the chat.
|
|
634
|
+
message_id (string): The unique identifier of the message to pin.
|
|
1457
635
|
|
|
1458
636
|
Returns:
|
|
1459
|
-
Any:
|
|
637
|
+
dict[str, Any]: A dictionary containing the API response for the pinned message.
|
|
1460
638
|
|
|
1461
639
|
Raises:
|
|
1462
|
-
HTTPStatusError:
|
|
640
|
+
HTTPStatusError: If the API request fails.
|
|
1463
641
|
|
|
1464
642
|
Tags:
|
|
1465
|
-
teams.
|
|
643
|
+
teams.chat, pinned_message, create, pin
|
|
1466
644
|
"""
|
|
1467
|
-
if
|
|
1468
|
-
raise ValueError("Missing required parameter '
|
|
1469
|
-
if
|
|
1470
|
-
raise ValueError("Missing required parameter '
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
645
|
+
if chat_id is None:
|
|
646
|
+
raise ValueError("Missing required parameter 'chat-id'.")
|
|
647
|
+
if message_id is None:
|
|
648
|
+
raise ValueError("Missing required parameter 'message-id'.")
|
|
649
|
+
|
|
650
|
+
url = f"{self.base_url}/chats/{chat_id}/pinnedMessages"
|
|
651
|
+
|
|
652
|
+
# The API requires a specific OData bind format for the message
|
|
653
|
+
payload = {
|
|
654
|
+
"message@odata.bind": f"https://graph.microsoft.com/v1.0/chats/{chat_id}/messages/{message_id}"
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
response = await self._apost(url, data=payload)
|
|
1477
658
|
return self._handle_response(response)
|
|
1478
659
|
|
|
1479
|
-
async def
|
|
1480
|
-
self,
|
|
1481
|
-
|
|
660
|
+
async def unpin_chat_message(
|
|
661
|
+
self,
|
|
662
|
+
chat_id: str,
|
|
663
|
+
pinned_chat_message_id: str,
|
|
664
|
+
) -> dict[str, Any]:
|
|
1482
665
|
"""
|
|
1483
|
-
|
|
666
|
+
Unpin a message from a chat.
|
|
1484
667
|
|
|
1485
668
|
Args:
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
teamsTab_id (string): teamsTab-id
|
|
1489
|
-
select (array): Select properties to be returned
|
|
1490
|
-
expand (array): Expand related entities
|
|
669
|
+
chat_id (string): The unique identifier of the chat.
|
|
670
|
+
pinned_chat_message_id (string): The unique identifier of the pinned message (not the message ID itself).
|
|
1491
671
|
|
|
1492
672
|
Returns:
|
|
1493
|
-
Any:
|
|
673
|
+
dict[str, Any]: A dictionary containing the API response (usually empty for 204).
|
|
1494
674
|
|
|
1495
675
|
Raises:
|
|
1496
|
-
HTTPStatusError:
|
|
676
|
+
HTTPStatusError: If the API request fails.
|
|
1497
677
|
|
|
1498
678
|
Tags:
|
|
1499
|
-
teams.
|
|
679
|
+
teams.chat, pinned_message, delete, unpin
|
|
1500
680
|
"""
|
|
1501
|
-
if
|
|
1502
|
-
raise ValueError("Missing required parameter '
|
|
1503
|
-
if
|
|
1504
|
-
raise ValueError("Missing required parameter '
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
681
|
+
if chat_id is None:
|
|
682
|
+
raise ValueError("Missing required parameter 'chat-id'.")
|
|
683
|
+
if pinned_chat_message_id is None:
|
|
684
|
+
raise ValueError("Missing required parameter 'pinned-chat-message-id'.")
|
|
685
|
+
|
|
686
|
+
url = f"{self.base_url}/chats/{chat_id}/pinnedMessages/{pinned_chat_message_id}"
|
|
687
|
+
|
|
688
|
+
response = await self._adelete(url)
|
|
689
|
+
# DELETE 204 returns no content, handle gracefully
|
|
690
|
+
if response.status_code == 204:
|
|
691
|
+
return {"status": "success", "message": "Message unpinned successfully."}
|
|
1510
692
|
return self._handle_response(response)
|
|
1511
693
|
|
|
1512
|
-
|
|
694
|
+
# Teams
|
|
695
|
+
|
|
696
|
+
async def create_team(
|
|
1513
697
|
self,
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
id: str | None = None,
|
|
1518
|
-
configuration: dict[str, dict[str, Any]] | None = None,
|
|
1519
|
-
displayName: str | None = None,
|
|
1520
|
-
webUrl: str | None = None,
|
|
1521
|
-
teamsApp: Any | None = None,
|
|
1522
|
-
) -> Any:
|
|
698
|
+
display_name: str,
|
|
699
|
+
description: str,
|
|
700
|
+
) -> dict[str, Any]:
|
|
1523
701
|
"""
|
|
1524
|
-
|
|
702
|
+
Create a new team.
|
|
703
|
+
Uses the 'standard' template by default.
|
|
1525
704
|
|
|
1526
705
|
Args:
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
teamsTab_id (string): teamsTab-id
|
|
1530
|
-
id (string): The unique identifier for an entity. Read-only.
|
|
1531
|
-
configuration (object): configuration
|
|
1532
|
-
displayName (string): Name of the tab.
|
|
1533
|
-
webUrl (string): Deep link URL of the tab instance. Read only.
|
|
1534
|
-
teamsApp (string): teamsApp
|
|
706
|
+
display_name (string): The name of the team.
|
|
707
|
+
description (string): The description of the team.
|
|
1535
708
|
|
|
1536
709
|
Returns:
|
|
1537
|
-
Any:
|
|
710
|
+
dict[str, Any]: A dictionary containing the API response (e.g., location header for the async operation).
|
|
1538
711
|
|
|
1539
712
|
Raises:
|
|
1540
|
-
HTTPStatusError:
|
|
713
|
+
HTTPStatusError: If the API request fails.
|
|
1541
714
|
|
|
1542
715
|
Tags:
|
|
1543
|
-
teams.
|
|
716
|
+
teams.team, create, provision
|
|
1544
717
|
"""
|
|
1545
|
-
if
|
|
1546
|
-
raise ValueError("Missing required parameter '
|
|
1547
|
-
if
|
|
1548
|
-
raise ValueError("Missing required parameter '
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
718
|
+
if display_name is None:
|
|
719
|
+
raise ValueError("Missing required parameter 'display-name'.")
|
|
720
|
+
if description is None:
|
|
721
|
+
raise ValueError("Missing required parameter 'description'.")
|
|
722
|
+
|
|
723
|
+
url = f"{self.base_url}/teams"
|
|
724
|
+
|
|
725
|
+
payload = {
|
|
726
|
+
"template@odata.bind": "https://graph.microsoft.com/v1.0/teamsTemplates('standard')",
|
|
727
|
+
"displayName": display_name,
|
|
728
|
+
"description": description
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
response = await self._apost(url, data=payload)
|
|
732
|
+
|
|
733
|
+
# 202 Accepted means it's an async operation.
|
|
734
|
+
# The Location header contains the URL to check status.
|
|
735
|
+
if response.status_code == 202:
|
|
736
|
+
return {
|
|
737
|
+
"status": "accepted",
|
|
738
|
+
"operation_location": response.headers.get("Location"),
|
|
739
|
+
"message": "Team creation initiated. Check operation_location for status."
|
|
740
|
+
}
|
|
741
|
+
|
|
1557
742
|
return self._handle_response(response)
|
|
1558
743
|
|
|
1559
|
-
async def
|
|
744
|
+
async def get_team(
|
|
745
|
+
self,
|
|
746
|
+
team_id: str,
|
|
747
|
+
select: list[str] | None = None,
|
|
748
|
+
expand: list[str] | None = None,
|
|
749
|
+
) -> dict[str, Any]:
|
|
1560
750
|
"""
|
|
1561
|
-
|
|
751
|
+
Retrieve a specific team's details.
|
|
752
|
+
Supported OData parameters:
|
|
753
|
+
- $select: Select specific properties.
|
|
754
|
+
- $expand: Expand related entities.
|
|
1562
755
|
|
|
1563
756
|
Args:
|
|
1564
|
-
team_id (string): team
|
|
1565
|
-
|
|
1566
|
-
|
|
757
|
+
team_id (string): The unique identifier of the team.
|
|
758
|
+
select (array): Select specific properties.
|
|
759
|
+
expand (array): Expand related entities.
|
|
1567
760
|
|
|
1568
761
|
Returns:
|
|
1569
|
-
Any:
|
|
762
|
+
dict[str, Any]: The team resource.
|
|
1570
763
|
|
|
1571
764
|
Raises:
|
|
1572
|
-
HTTPStatusError:
|
|
765
|
+
HTTPStatusError: If the API request fails.
|
|
1573
766
|
|
|
1574
767
|
Tags:
|
|
1575
|
-
teams.
|
|
768
|
+
teams.team, read, get
|
|
1576
769
|
"""
|
|
1577
770
|
if team_id is None:
|
|
1578
771
|
raise ValueError("Missing required parameter 'team-id'.")
|
|
1579
|
-
if channel_id is None:
|
|
1580
|
-
raise ValueError("Missing required parameter 'channel-id'.")
|
|
1581
|
-
if teamsTab_id is None:
|
|
1582
|
-
raise ValueError("Missing required parameter 'teamsTab-id'.")
|
|
1583
|
-
url = f"{self.base_url}/teams/{team_id}/channels/{channel_id}/tabs/{teamsTab_id}"
|
|
1584
|
-
query_params = {}
|
|
1585
|
-
response = await self._adelete(url, params=query_params)
|
|
1586
|
-
return self._handle_response(response)
|
|
1587
|
-
|
|
1588
|
-
async def get_primary_team_channel(self, team_id: str, select: list[str] | None = None, expand: list[str] | None = None) -> Any:
|
|
1589
|
-
"""
|
|
1590
|
-
Retrieves the primary channel (usually 'General') for a specified team using its ID. Unlike `get_channel_details`, this function directly accesses the team's default channel without requiring a specific channel ID. Optional parameters can select or expand properties in the returned data.
|
|
1591
772
|
|
|
1592
|
-
|
|
1593
|
-
team_id (string): team-id
|
|
1594
|
-
select (array): Select properties to be returned
|
|
1595
|
-
expand (array): Expand related entities
|
|
773
|
+
url = f"{self.base_url}/teams/{team_id}"
|
|
1596
774
|
|
|
1597
|
-
|
|
1598
|
-
|
|
775
|
+
# Helper to format list params
|
|
776
|
+
def fmt(val):
|
|
777
|
+
return ",".join(val) if isinstance(val, list) else val
|
|
1599
778
|
|
|
1600
|
-
|
|
1601
|
-
|
|
779
|
+
query_params = {
|
|
780
|
+
k: fmt(v)
|
|
781
|
+
for k, v in [
|
|
782
|
+
("$select", select),
|
|
783
|
+
("$expand", expand),
|
|
784
|
+
]
|
|
785
|
+
if v is not None
|
|
786
|
+
}
|
|
1602
787
|
|
|
1603
|
-
Tags:
|
|
1604
|
-
teams.channel
|
|
1605
|
-
"""
|
|
1606
|
-
if team_id is None:
|
|
1607
|
-
raise ValueError("Missing required parameter 'team-id'.")
|
|
1608
|
-
url = f"{self.base_url}/teams/{team_id}/primaryChannel"
|
|
1609
|
-
query_params = {k: v for k, v in [("$select", select), ("$expand", expand)] if v is not None}
|
|
1610
788
|
response = await self._aget(url, params=query_params)
|
|
1611
789
|
return self._handle_response(response)
|
|
1612
790
|
|
|
1613
|
-
async def
|
|
791
|
+
async def list_joined_teams(
|
|
1614
792
|
self,
|
|
1615
|
-
user_id: str,
|
|
1616
|
-
top: int | None = None,
|
|
1617
|
-
skip: int | None = None,
|
|
1618
|
-
search: str | None = None,
|
|
1619
|
-
filter: str | None = None,
|
|
1620
|
-
count: bool | None = None,
|
|
1621
|
-
orderby: list[str] | None = None,
|
|
1622
|
-
select: list[str] | None = None,
|
|
1623
|
-
expand: list[str] | None = None,
|
|
1624
793
|
) -> dict[str, Any]:
|
|
1625
794
|
"""
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
user_id (string): user-id
|
|
1630
|
-
top (integer): Show only the first n items Example: '50'.
|
|
1631
|
-
skip (integer): Skip the first n items
|
|
1632
|
-
search (string): Search items by search phrases
|
|
1633
|
-
filter (string): Filter items by property values
|
|
1634
|
-
count (boolean): Include count of items
|
|
1635
|
-
orderby (array): Order items by property values
|
|
1636
|
-
select (array): Select properties to be returned
|
|
1637
|
-
expand (array): Expand related entities
|
|
795
|
+
List the teams that the user is a direct member of.
|
|
796
|
+
Note: This endpoint does not support OData query parameters.
|
|
797
|
+
It returns a subset of properties (id, displayName, description, isArchived, tenantId) by default.
|
|
1638
798
|
|
|
1639
799
|
Returns:
|
|
1640
|
-
dict[str, Any]:
|
|
800
|
+
dict[str, Any]: A dictionary containing the list of teams.
|
|
1641
801
|
|
|
1642
802
|
Raises:
|
|
1643
|
-
HTTPStatusError:
|
|
1644
|
-
|
|
803
|
+
HTTPStatusError: If the API request fails.
|
|
804
|
+
|
|
1645
805
|
Tags:
|
|
1646
|
-
|
|
806
|
+
teams.team, list, read, joined
|
|
1647
807
|
"""
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
query_params = {
|
|
1652
|
-
k: v
|
|
1653
|
-
for k, v in [
|
|
1654
|
-
("$top", top),
|
|
1655
|
-
("$skip", skip),
|
|
1656
|
-
("$search", search),
|
|
1657
|
-
("$filter", filter),
|
|
1658
|
-
("$count", count),
|
|
1659
|
-
("$orderby", orderby),
|
|
1660
|
-
("$select", select),
|
|
1661
|
-
("$expand", expand),
|
|
1662
|
-
]
|
|
1663
|
-
if v is not None
|
|
1664
|
-
}
|
|
1665
|
-
response = await self._aget(url, params=query_params)
|
|
808
|
+
url = f"{self.base_url}/me/joinedTeams"
|
|
809
|
+
|
|
810
|
+
response = await self._aget(url)
|
|
1666
811
|
return self._handle_response(response)
|
|
1667
812
|
|
|
1668
813
|
def list_tools(self):
|
|
1669
814
|
return [
|
|
815
|
+
self.get_me,
|
|
1670
816
|
self.get_user_chats,
|
|
1671
|
-
self.get_joined_teams,
|
|
1672
|
-
self.list_channels_for_team,
|
|
1673
|
-
self.send_chat_message,
|
|
1674
|
-
self.send_channel_message,
|
|
1675
|
-
self.reply_to_channel_message,
|
|
1676
817
|
self.create_chat,
|
|
1677
818
|
self.get_chat_details,
|
|
1678
819
|
self.update_chat_details,
|
|
1679
|
-
self.list_installed_chat_apps,
|
|
1680
820
|
self.list_chat_members,
|
|
1681
|
-
self.add_member_to_chat,
|
|
1682
821
|
self.get_chat_member,
|
|
1683
|
-
self.delete_chat_member,
|
|
1684
822
|
self.list_chat_messages,
|
|
1685
823
|
self.get_chat_message,
|
|
1686
|
-
self.
|
|
1687
|
-
self.
|
|
1688
|
-
self.
|
|
1689
|
-
self.
|
|
824
|
+
self.send_chat_message,
|
|
825
|
+
self.list_all_channels,
|
|
826
|
+
self.get_channel,
|
|
827
|
+
self.get_primary_channel,
|
|
828
|
+
self.send_channel_message,
|
|
829
|
+
self.reply_to_channel_message,
|
|
830
|
+
self.list_pinned_chat_messages,
|
|
831
|
+
self.pin_chat_message,
|
|
832
|
+
self.unpin_chat_message,
|
|
1690
833
|
self.create_team,
|
|
1691
|
-
self.
|
|
1692
|
-
self.
|
|
1693
|
-
self.update_channel_message_reply,
|
|
1694
|
-
self.list_channel_tabs,
|
|
1695
|
-
self.create_channel_tab,
|
|
1696
|
-
self.get_channel_tab_details,
|
|
1697
|
-
self.update_channel_tab,
|
|
1698
|
-
self.delete_channel_tab,
|
|
1699
|
-
self.get_primary_team_channel,
|
|
1700
|
-
self.list_user_installed_apps,
|
|
834
|
+
self.get_team,
|
|
835
|
+
self.list_joined_teams,
|
|
1701
836
|
]
|