• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / botbuilder-python / 409676

28 May 2025 05:17PM UTC coverage: 67.239% (-0.008%) from 67.247%
409676

push

python-ci

web-flow
Teams SSO and OAuth fixes (#2226)

* Fixed Teams SSO & OAuth

* Formatting

---------

Co-authored-by: Tracy Boehrer <trboehre@microsoft.com>

10 of 21 new or added lines in 8 files covered. (47.62%)

1 existing line in 1 file now uncovered.

9205 of 13690 relevant lines covered (67.24%)

2.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.22
/libraries/botframework-connector/botframework/connector/teams/operations/teams_operations.py
1
# coding=utf-8
2
# --------------------------------------------------------------------------
3
# Copyright (c) Microsoft Corporation. All rights reserved.
4
# Licensed under the MIT License. See License.txt in the project root for
5
# license information.
6
# --------------------------------------------------------------------------
7

8
from msrest.pipeline import ClientRawResponse
4✔
9
from msrest.exceptions import HttpOperationError
4✔
10

11
from ... import models
4✔
12

13

14
class TeamsOperations(object):
4✔
15
    """TeamsOperations operations.
16

17
    :param client: Client for service requests.
18
    :param config: Configuration of service client.
19
    :param serializer: An object model serializer.
20
    :param deserializer: An object model deserializer.
21
    """
22

23
    models = models
4✔
24

25
    def __init__(self, client, config, serializer, deserializer):
4✔
26
        self._client = client
×
27
        self._serialize = serializer
×
28
        self._deserialize = deserializer
×
29

30
        self.config = config
×
31

32
    def get_teams_channels(
4✔
33
        self, team_id, custom_headers=None, raw=False, **operation_config
34
    ):
35
        """Fetches channel list for a given team.
36

37
        Fetch the channel list.
38

39
        :param team_id: Team Id
40
        :type team_id: str
41
        :param dict custom_headers: headers that will be added to the request
42
        :param bool raw: returns the direct response alongside the
43
         deserialized response
44
        :param operation_config: :ref:`Operation configuration
45
         overrides<msrest:optionsforoperations>`.
46
        :return: ConversationList or ClientRawResponse if raw=true
47
        :rtype: ~botframework.connector.teams.models.ConversationList or
48
         ~msrest.pipeline.ClientRawResponse
49
        :raises:
50
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
51
        """
52
        # Construct URL
53
        url = self.get_teams_channels.metadata["url"]
×
54
        path_format_arguments = {
×
55
            "teamId": self._serialize.url("team_id", team_id, "str")
56
        }
57
        url = self._client.format_url(url, **path_format_arguments)
×
58

59
        # Construct parameters
60
        query_parameters = {}
×
61

62
        # Construct headers
63
        header_parameters = {}
×
64
        header_parameters["Accept"] = "application/json"
×
65
        if custom_headers:
×
66
            header_parameters.update(custom_headers)
×
67

68
        # Construct and send request
69
        request = self._client.get(url, query_parameters, header_parameters)
×
70
        response = self._client.send(request, stream=False, **operation_config)
×
71

72
        if response.status_code not in [200]:
×
73
            raise HttpOperationError(self._deserialize, response)
×
74

75
        deserialized = None
×
76

77
        if response.status_code == 200:
×
78
            deserialized = self._deserialize("ConversationList", response)
×
79

80
        if raw:
×
81
            client_raw_response = ClientRawResponse(deserialized, response)
×
82
            return client_raw_response
×
83

84
        return deserialized
×
85

86
    get_teams_channels.metadata = {"url": "/v3/teams/{teamId}/conversations"}
4✔
87

88
    def get_team_details(
4✔
89
        self, team_id, custom_headers=None, raw=False, **operation_config
90
    ):
91
        """Fetches details related to a team.
92

93
        Fetch details for a team.
94

95
        :param team_id: Team Id
96
        :type team_id: str
97
        :param dict custom_headers: headers that will be added to the request
98
        :param bool raw: returns the direct response alongside the
99
         deserialized response
100
        :param operation_config: :ref:`Operation configuration
101
         overrides<msrest:optionsforoperations>`.
102
        :return: TeamDetails or ClientRawResponse if raw=true
103
        :rtype: ~botframework.connector.teams.models.TeamDetails or
104
         ~msrest.pipeline.ClientRawResponse
105
        :raises:
106
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
107
        """
108
        # Construct URL
109
        url = self.get_team_details.metadata["url"]
×
110
        path_format_arguments = {
×
111
            "teamId": self._serialize.url("team_id", team_id, "str")
112
        }
113
        url = self._client.format_url(url, **path_format_arguments)
×
114

115
        # Construct parameters
116
        query_parameters = {}
×
117

118
        # Construct headers
119
        header_parameters = {}
×
120
        header_parameters["Accept"] = "application/json"
×
121
        if custom_headers:
×
122
            header_parameters.update(custom_headers)
×
123

124
        # Construct and send request
125
        request = self._client.get(url, query_parameters, header_parameters)
×
126
        response = self._client.send(request, stream=False, **operation_config)
×
127

128
        if response.status_code not in [200]:
×
129
            raise HttpOperationError(self._deserialize, response)
×
130

131
        deserialized = None
×
132

133
        if response.status_code == 200:
×
134
            deserialized = self._deserialize("TeamDetails", response)
×
135

136
        if raw:
×
137
            client_raw_response = ClientRawResponse(deserialized, response)
×
138
            return client_raw_response
×
139

140
        return deserialized
×
141

142
    get_team_details.metadata = {"url": "/v3/teams/{teamId}"}
4✔
143

144
    def fetch_participant(
4✔
145
        self,
146
        meeting_id: str,
147
        participant_id: str,
148
        tenant_id: str,
149
        custom_headers=None,
150
        raw=False,
151
        **operation_config
152
    ):
153
        """Fetches Teams meeting participant details.
154

155
        :param meeting_id: Teams meeting id
156
        :type meeting_id: str
157
        :param participant_id: Teams meeting participant id
158
        :type participant_id: str
159
        :param tenant_id: Teams meeting tenant id
160
        :type tenant_id: str
161
        :param dict custom_headers: headers that will be added to the request
162
        :param bool raw: returns the direct response alongside the
163
         deserialized response
164
        :param operation_config: :ref:`Operation configuration
165
         overrides<msrest:optionsforoperations>`.
166
        :return: TeamsMeetingParticipant or ClientRawResponse if raw=true
167
        :rtype: ~botframework.connector.teams.models.TeamsParticipantChannelAccount or
168
         ~msrest.pipeline.ClientRawResponse
169
        :raises:
170
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
171
        """
172

173
        # Construct URL
174
        url = self.fetch_participant.metadata["url"]
×
175
        path_format_arguments = {
×
176
            "meetingId": self._serialize.url("meeting_id", meeting_id, "str"),
177
            "participantId": self._serialize.url(
178
                "participant_id", participant_id, "str"
179
            ),
180
            "tenantId": self._serialize.url("tenant_id", tenant_id, "str"),
181
        }
182
        url = self._client.format_url(url, **path_format_arguments)
×
183

184
        # Construct parameters
185
        query_parameters = {}
×
186

187
        # Construct headers
188
        header_parameters = {}
×
189
        header_parameters["Accept"] = "application/json"
×
190
        if custom_headers:
×
191
            header_parameters.update(custom_headers)
×
192

193
        # Construct and send request
194
        request = self._client.get(url, query_parameters, header_parameters)
×
195
        response = self._client.send(request, stream=False, **operation_config)
×
196

197
        if response.status_code not in [200]:
×
198
            raise HttpOperationError(self._deserialize, response)
×
199

200
        deserialized = None
×
201

202
        if response.status_code == 200:
×
203
            deserialized = self._deserialize("TeamsMeetingParticipant", response)
×
204

205
        if raw:
×
206
            client_raw_response = ClientRawResponse(deserialized, response)
×
207
            return client_raw_response
×
208

209
        return deserialized
×
210

211
    fetch_participant.metadata = {
4✔
212
        "url": "/v1/meetings/{meetingId}/participants/{participantId}?tenantId={tenantId}"
213
    }
214

215
    def fetch_meeting(
4✔
216
        self, meeting_id: str, custom_headers=None, raw=False, **operation_config
217
    ):
218
        """Fetch meeting information.
219

220
        :param meeting_id: Meeting Id, encoded as a BASE64 string.
221
        :type meeting_id: str
222
        :param dict custom_headers: headers that will be added to the request
223
        :param bool raw: returns the direct response alongside the
224
         deserialized response
225
        :param operation_config: :ref:`Operation configuration
226
         overrides<msrest:optionsforoperations>`.
227
        :return: MeetingInfo or ClientRawResponse if raw=true
228
        :rtype: ~botframework.connector.teams.models.MeetingInfo or
229
         ~msrest.pipeline.ClientRawResponse
230
        :raises:
231
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
232
        """
233

234
        # Construct URL
235
        url = self.fetch_participant.metadata["url"]
×
236
        path_format_arguments = {
×
237
            "meetingId": self._serialize.url("meeting_id", meeting_id, "str")
238
        }
239
        url = self._client.format_url(url, **path_format_arguments)
×
240

241
        # Construct parameters
242
        query_parameters = {}
×
243

244
        # Construct headers
245
        header_parameters = {}
×
246
        header_parameters["Accept"] = "application/json"
×
247
        if custom_headers:
×
248
            header_parameters.update(custom_headers)
×
249

250
        # Construct and send request
251
        request = self._client.get(url, query_parameters, header_parameters)
×
252
        response = self._client.send(request, stream=False, **operation_config)
×
253

254
        if response.status_code not in [200]:
×
255
            raise HttpOperationError(self._deserialize, response)
×
256

257
        deserialized = None
×
258

259
        if response.status_code == 200:
×
260
            deserialized = self._deserialize("MeetingInfo", response)
×
261

262
        if raw:
×
263
            client_raw_response = ClientRawResponse(deserialized, response)
×
264
            return client_raw_response
×
265

266
        return deserialized
×
267

268
    fetch_participant.metadata = {"url": "/v1/meetings/{meetingId}"}
4✔
269

270
    def send_meeting_notification(
4✔
271
        self,
272
        meeting_id: str,
273
        notification: models.MeetingNotificationBase,
274
        custom_headers=None,
275
        raw=False,
276
        **operation_config
277
    ):
278
        """Send a teams meeting notification.
279

280
        :param meeting_id: Meeting Id, encoded as a BASE64 string.
281
        :type meeting_id: str
282
        :param notification: The notification to send to Teams
283
        :type notification: ~botframework.connector.teams.models.MeetingNotificationBase
284
        :param dict custom_headers: headers that will be added to the request
285
        :param bool raw: returns the direct response alongside the
286
         deserialized response
287
        :param operation_config: :ref:`Operation configuration
288
         overrides<msrest:optionsforoperations>`.
289
        :return: MeetingNotificationResponse or ClientRawResponse if raw=true
290
        :rtype: ~botframework.connector.teams.models.MeetingNotificationResponse or
291
         ~msrest.pipeline.ClientRawResponse
292
        :raises:
293
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
294
        """
295

296
        # Construct URL
297
        url = self.send_meeting_notification.metadata["url"]
×
298
        path_format_arguments = {
×
299
            "meetingId": self._serialize.url("meeting_id", meeting_id, "str"),
300
        }
301
        url = self._client.format_url(url, **path_format_arguments)
×
302

303
        # Construct parameters
304
        query_parameters = {}
×
305

306
        # Construct headers
307
        header_parameters = {}
×
308
        header_parameters["Accept"] = "application/json"
×
309
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
310
        if custom_headers:
×
311
            header_parameters.update(custom_headers)
×
312

313
        # Construct body
314
        body_content = self._serialize.body(notification, "notification")
×
315

316
        # Construct and send request
317
        request = self._client.post(
×
318
            url, query_parameters, header_parameters, body_content
319
        )
320
        response = self._client.send(request, stream=False, **operation_config)
×
321

322
        if response.status_code not in [200, 201, 202]:
×
323
            raise models.ErrorResponseException(self._deserialize, response)
×
324

325
        deserialized = None
×
326
        if response.status_code == 200:
×
327
            deserialized = self._deserialize("MeetingNotificationResponse", response)
×
328
        if response.status_code == 201:
×
329
            deserialized = self._deserialize("MeetingNotificationResponse", response)
×
330
        if response.status_code == 202:
×
331
            deserialized = self._deserialize("MeetingNotificationResponse", response)
×
332

333
        if raw:
×
334
            client_raw_response = ClientRawResponse(deserialized, response)
×
335
            return client_raw_response
×
336

337
        return deserialized
×
338

339
    send_meeting_notification.metadata = {
4✔
340
        "url": "/v1/meetings/{meetingId}/notification"
341
    }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc