• 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

10.03
/libraries/botframework-connector/botframework/connector/operations/_conversations_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 ConversationsOperations:
4✔
15
    """ConversationsOperations operations.
16

17
    You should not instantiate directly this class, but create a Client instance that will create it for you and attach
18
     it as attribute.
19

20
    :param client: Client for service requests.
21
    :param config: Configuration of service client.
22
    :param serializer: An object model serializer.
23
    :param deserializer: An object model deserializer.
24
    :ivar api_version: The API version to use for the request. Constant value: "v3".
25
    """
26

27
    models = models
4✔
28

29
    def __init__(self, client, config, serializer, deserializer):
4✔
30
        self._client = client
×
31
        self._serialize = serializer
×
32
        self._deserialize = deserializer
×
33

34
        self.config = config
×
35
        self.api_version = "v3"
×
36

37
    def get_conversations(
4✔
38
        self,
39
        continuation_token=None,
40
        custom_headers=None,
41
        raw=False,
42
        **operation_config
43
    ):
44
        """GetConversations.
45

46
        List the Conversations in which this bot has participated.
47
        GET from this method with a skip token
48
        The return value is a ConversationsResult, which contains an array of
49
        ConversationMembers and a skip token.  If the skip token is not empty,
50
        then
51
        there are further values to be returned. Call this method again with
52
        the returned token to get more values.
53
        Each ConversationMembers object contains the ID of the conversation and
54
        an array of ChannelAccounts that describe the members of the
55
        conversation.
56

57
        :param continuation_token: skip or continuation token
58
        :type continuation_token: str
59
        :param dict custom_headers: headers that will be added to the request
60
        :param bool raw: returns the direct response alongside the
61
         deserialized response
62
        :param operation_config: :ref:`Operation configuration
63
         overrides<msrest:optionsforoperations>`.
64
        :return: ConversationsResult or ClientRawResponse if raw=true
65
        :rtype: ~botframework.connector.models.ConversationsResult or
66
         ~msrest.pipeline.ClientRawResponse
67
        :raises:
68
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
69
        """
70
        # Construct URL
71
        url = self.get_conversations.metadata["url"]
×
72

73
        # Construct parameters
74
        query_parameters = {}
×
75
        if continuation_token is not None:
×
76
            query_parameters["continuationToken"] = self._serialize.query(
×
77
                "continuation_token", continuation_token, "str"
78
            )
79

80
        # Construct headers
81
        header_parameters = {}
×
82
        header_parameters["Accept"] = "application/json"
×
83
        if custom_headers:
×
84
            header_parameters.update(custom_headers)
×
85

86
        # Construct and send request
87
        request = self._client.get(url, query_parameters, header_parameters)
×
88
        response = self._client.send(request, stream=False, **operation_config)
×
89

90
        if response.status_code not in [200]:
×
91
            raise models.ErrorResponseException(self._deserialize, response)
×
92

93
        deserialized = None
×
94
        if response.status_code == 200:
×
95
            deserialized = self._deserialize("ConversationsResult", response)
×
96

97
        if raw:
×
98
            client_raw_response = ClientRawResponse(deserialized, response)
×
99
            return client_raw_response
×
100

101
        return deserialized
×
102

103
    get_conversations.metadata = {"url": "/v3/conversations"}
4✔
104

105
    def create_conversation(
4✔
106
        self, parameters, custom_headers=None, raw=False, **operation_config
107
    ):
108
        """CreateConversation.
109

110
        Create a new Conversation.
111
        POST to this method with a
112
        * Bot being the bot creating the conversation
113
        * IsGroup set to true if this is not a direct message (default is
114
        false)
115
        * Array containing the members to include in the conversation
116
        The return value is a ResourceResponse which contains a conversation id
117
        which is suitable for use
118
        in the message payload and REST API uris.
119
        Most channels only support the semantics of bots initiating a direct
120
        message conversation.  An example of how to do that would be:
121
        ```
122
        var resource = await connector.conversations.CreateConversation(new
123
        ConversationParameters(){ Bot = bot, members = new ChannelAccount[] {
124
        new ChannelAccount("user1") } );
125
        await connect.Conversations.SendToConversationAsync(resource.Id, new
126
        Activity() ... ) ;
127
        ```.
128

129
        :param parameters: Parameters to create the conversation from
130
        :type parameters:
131
         ~botframework.connector.models.ConversationParameters
132
        :param dict custom_headers: headers that will be added to the request
133
        :param bool raw: returns the direct response alongside the
134
         deserialized response
135
        :param operation_config: :ref:`Operation configuration
136
         overrides<msrest:optionsforoperations>`.
137
        :return: ConversationResourceResponse or ClientRawResponse if raw=true
138
        :rtype: ~botframework.connector.models.ConversationResourceResponse or
139
         ~msrest.pipeline.ClientRawResponse
140
        :raises:
141
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
142
        """
143
        # Construct URL
144
        url = self.create_conversation.metadata["url"]
×
145

146
        # Construct parameters
147
        query_parameters = {}
×
148

149
        # Construct headers
150
        header_parameters = {}
×
151
        header_parameters["Accept"] = "application/json"
×
152
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
153
        if custom_headers:
×
154
            header_parameters.update(custom_headers)
×
155

156
        # Construct body
157
        body_content = self._serialize.body(parameters, "ConversationParameters")
×
158

159
        # Construct and send request
160
        request = self._client.post(
×
161
            url, query_parameters, header_parameters, body_content
162
        )
163
        response = self._client.send(request, stream=False, **operation_config)
×
164

165
        if response.status_code not in [200, 201, 202]:
×
166
            raise models.ErrorResponseException(self._deserialize, response)
×
167

168
        deserialized = None
×
169
        if response.status_code == 200:
×
170
            deserialized = self._deserialize("ConversationResourceResponse", response)
×
171
        if response.status_code == 201:
×
172
            deserialized = self._deserialize("ConversationResourceResponse", response)
×
173
        if response.status_code == 202:
×
174
            deserialized = self._deserialize("ConversationResourceResponse", response)
×
175

176
        if raw:
×
177
            client_raw_response = ClientRawResponse(deserialized, response)
×
178
            return client_raw_response
×
179

180
        return deserialized
×
181

182
    create_conversation.metadata = {"url": "/v3/conversations"}
4✔
183

184
    def send_to_conversation(
4✔
185
        self,
186
        conversation_id,
187
        activity,
188
        custom_headers=None,
189
        raw=False,
190
        **operation_config
191
    ):
192
        """SendToConversation.
193

194
        This method allows you to send an activity to the end of a
195
        conversation.
196
        This is slightly different from ReplyToActivity().
197
        * SendToConversation(conversationId) - will append the activity to the
198
        end of the conversation according to the timestamp or semantics of the
199
        channel.
200
        * ReplyToActivity(conversationId,ActivityId) - adds the activity as a
201
        reply to another activity, if the channel supports it. If the channel
202
        does not support nested replies, ReplyToActivity falls back to
203
        SendToConversation.
204
        Use ReplyToActivity when replying to a specific activity in the
205
        conversation.
206
        Use SendToConversation in all other cases.
207

208
        :param conversation_id: Conversation ID
209
        :type conversation_id: str
210
        :param activity: Activity to send
211
        :type activity: ~botframework.connector.models.Activity
212
        :param dict custom_headers: headers that will be added to the request
213
        :param bool raw: returns the direct response alongside the
214
         deserialized response
215
        :param operation_config: :ref:`Operation configuration
216
         overrides<msrest:optionsforoperations>`.
217
        :return: ResourceResponse or ClientRawResponse if raw=true
218
        :rtype: ~botframework.connector.models.ResourceResponse or
219
         ~msrest.pipeline.ClientRawResponse
220
        :raises:
221
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
222
        """
223
        # Construct URL
224
        url = self.send_to_conversation.metadata["url"]
×
225
        path_format_arguments = {
×
226
            "conversationId": self._serialize.url(
227
                "conversation_id", conversation_id, "str"
228
            )
229
        }
230
        url = self._client.format_url(url, **path_format_arguments)
×
231

232
        # Construct parameters
233
        query_parameters = {}
×
234

235
        # Construct headers
236
        header_parameters = {}
×
237
        header_parameters["Accept"] = "application/json"
×
238
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
239
        if custom_headers:
×
240
            header_parameters.update(custom_headers)
×
241

242
        # Construct body
243
        body_content = self._serialize.body(activity, "Activity")
×
244

245
        # Construct and send request
246
        request = self._client.post(
×
247
            url, query_parameters, header_parameters, body_content
248
        )
249
        response = self._client.send(request, stream=False, **operation_config)
×
250

251
        if response.status_code not in [200, 201, 202]:
×
252
            raise models.ErrorResponseException(self._deserialize, response)
×
253

254
        deserialized = None
×
255
        if response.status_code == 200:
×
256
            deserialized = self._deserialize("ResourceResponse", response)
×
257
        if response.status_code == 201:
×
258
            deserialized = self._deserialize("ResourceResponse", response)
×
259
        if response.status_code == 202:
×
260
            deserialized = self._deserialize("ResourceResponse", response)
×
261

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

266
        return deserialized
×
267

268
    send_to_conversation.metadata = {
4✔
269
        "url": "/v3/conversations/{conversationId}/activities"
270
    }
271

272
    def send_conversation_history(
4✔
273
        self,
274
        conversation_id,
275
        activities=None,
276
        custom_headers=None,
277
        raw=False,
278
        **operation_config
279
    ):
280
        """SendConversationHistory.
281

282
        This method allows you to upload the historic activities to the
283
        conversation.
284
        Sender must ensure that the historic activities have unique ids and
285
        appropriate timestamps. The ids are used by the client to deal with
286
        duplicate activities and the timestamps are used by the client to
287
        render the activities in the right order.
288

289
        :param conversation_id: Conversation ID
290
        :type conversation_id: str
291
        :param activities: A collection of Activities that conforms to the
292
         Transcript schema.
293
        :type activities: list[~botframework.connector.models.Activity]
294
        :param dict custom_headers: headers that will be added to the request
295
        :param bool raw: returns the direct response alongside the
296
         deserialized response
297
        :param operation_config: :ref:`Operation configuration
298
         overrides<msrest:optionsforoperations>`.
299
        :return: ResourceResponse or ClientRawResponse if raw=true
300
        :rtype: ~botframework.connector.models.ResourceResponse or
301
         ~msrest.pipeline.ClientRawResponse
302
        :raises:
303
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
304
        """
305
        history = models.Transcript(activities=activities)
×
306

307
        # Construct URL
308
        url = self.send_conversation_history.metadata["url"]
×
309
        path_format_arguments = {
×
310
            "conversationId": self._serialize.url(
311
                "conversation_id", conversation_id, "str"
312
            )
313
        }
314
        url = self._client.format_url(url, **path_format_arguments)
×
315

316
        # Construct parameters
317
        query_parameters = {}
×
318

319
        # Construct headers
320
        header_parameters = {}
×
321
        header_parameters["Accept"] = "application/json"
×
322
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
323
        if custom_headers:
×
324
            header_parameters.update(custom_headers)
×
325

326
        # Construct body
327
        body_content = self._serialize.body(history, "Transcript")
×
328

329
        # Construct and send request
330
        request = self._client.post(
×
331
            url, query_parameters, header_parameters, body_content
332
        )
333
        response = self._client.send(request, stream=False, **operation_config)
×
334

335
        if response.status_code not in [200, 201, 202]:
×
336
            raise models.ErrorResponseException(self._deserialize, response)
×
337

338
        deserialized = None
×
339
        if response.status_code == 200:
×
340
            deserialized = self._deserialize("ResourceResponse", response)
×
341
        if response.status_code == 201:
×
342
            deserialized = self._deserialize("ResourceResponse", response)
×
343
        if response.status_code == 202:
×
344
            deserialized = self._deserialize("ResourceResponse", response)
×
345

346
        if raw:
×
347
            client_raw_response = ClientRawResponse(deserialized, response)
×
348
            return client_raw_response
×
349

350
        return deserialized
×
351

352
    send_conversation_history.metadata = {
4✔
353
        "url": "/v3/conversations/{conversationId}/activities/history"
354
    }
355

356
    def update_activity(
4✔
357
        self,
358
        conversation_id,
359
        activity_id,
360
        activity,
361
        custom_headers=None,
362
        raw=False,
363
        **operation_config
364
    ):
365
        """UpdateActivity.
366

367
        Edit an existing activity.
368
        Some channels allow you to edit an existing activity to reflect the new
369
        state of a bot conversation.
370
        For example, you can remove buttons after someone has clicked "Approve"
371
        button.
372

373
        :param conversation_id: Conversation ID
374
        :type conversation_id: str
375
        :param activity_id: activityId to update
376
        :type activity_id: str
377
        :param activity: replacement Activity
378
        :type activity: ~botframework.connector.models.Activity
379
        :param dict custom_headers: headers that will be added to the request
380
        :param bool raw: returns the direct response alongside the
381
         deserialized response
382
        :param operation_config: :ref:`Operation configuration
383
         overrides<msrest:optionsforoperations>`.
384
        :return: ResourceResponse or ClientRawResponse if raw=true
385
        :rtype: ~botframework.connector.models.ResourceResponse or
386
         ~msrest.pipeline.ClientRawResponse
387
        :raises:
388
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
389
        """
390
        # Construct URL
391
        url = self.update_activity.metadata["url"]
×
392
        path_format_arguments = {
×
393
            "conversationId": self._serialize.url(
394
                "conversation_id", conversation_id, "str"
395
            ),
396
            "activityId": self._serialize.url("activity_id", activity_id, "str"),
397
        }
398
        url = self._client.format_url(url, **path_format_arguments)
×
399

400
        # Construct parameters
401
        query_parameters = {}
×
402

403
        # Construct headers
404
        header_parameters = {}
×
405
        header_parameters["Accept"] = "application/json"
×
406
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
407
        if custom_headers:
×
408
            header_parameters.update(custom_headers)
×
409

410
        # Construct body
411
        body_content = self._serialize.body(activity, "Activity")
×
412

413
        # Construct and send request
414
        request = self._client.put(
×
415
            url, query_parameters, header_parameters, body_content
416
        )
417
        response = self._client.send(request, stream=False, **operation_config)
×
418

419
        if response.status_code not in [200, 201, 202]:
×
420
            raise models.ErrorResponseException(self._deserialize, response)
×
421

422
        deserialized = None
×
423
        if response.status_code == 200:
×
424
            deserialized = self._deserialize("ResourceResponse", response)
×
425
        if response.status_code == 201:
×
426
            deserialized = self._deserialize("ResourceResponse", response)
×
427
        if response.status_code == 202:
×
428
            deserialized = self._deserialize("ResourceResponse", response)
×
429

430
        if raw:
×
431
            client_raw_response = ClientRawResponse(deserialized, response)
×
432
            return client_raw_response
×
433

434
        return deserialized
×
435

436
    update_activity.metadata = {
4✔
437
        "url": "/v3/conversations/{conversationId}/activities/{activityId}"
438
    }
439

440
    def reply_to_activity(
4✔
441
        self,
442
        conversation_id,
443
        activity_id,
444
        activity,
445
        custom_headers=None,
446
        raw=False,
447
        **operation_config
448
    ):
449
        """ReplyToActivity.
450

451
        This method allows you to reply to an activity.
452
        This is slightly different from SendToConversation().
453
        * SendToConversation(conversationId) - will append the activity to the
454
        end of the conversation according to the timestamp or semantics of the
455
        channel.
456
        * ReplyToActivity(conversationId,ActivityId) - adds the activity as a
457
        reply to another activity, if the channel supports it. If the channel
458
        does not support nested replies, ReplyToActivity falls back to
459
        SendToConversation.
460
        Use ReplyToActivity when replying to a specific activity in the
461
        conversation.
462
        Use SendToConversation in all other cases.
463

464
        :param conversation_id: Conversation ID
465
        :type conversation_id: str
466
        :param activity_id: activityId the reply is to (OPTIONAL)
467
        :type activity_id: str
468
        :param activity: Activity to send
469
        :type activity: ~botframework.connector.models.Activity
470
        :param dict custom_headers: headers that will be added to the request
471
        :param bool raw: returns the direct response alongside the
472
         deserialized response
473
        :param operation_config: :ref:`Operation configuration
474
         overrides<msrest:optionsforoperations>`.
475
        :return: ResourceResponse or ClientRawResponse if raw=true
476
        :rtype: ~botframework.connector.models.ResourceResponse or
477
         ~msrest.pipeline.ClientRawResponse
478
        :raises:
479
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
480
        """
481
        # Construct URL
482
        url = self.reply_to_activity.metadata["url"]
×
483
        path_format_arguments = {
×
484
            "conversationId": self._serialize.url(
485
                "conversation_id", conversation_id, "str"
486
            ),
487
            "activityId": self._serialize.url("activity_id", activity_id, "str"),
488
        }
489
        url = self._client.format_url(url, **path_format_arguments)
×
490

491
        # Construct parameters
492
        query_parameters = {}
×
493

494
        # Construct headers
495
        header_parameters = {}
×
496
        header_parameters["Accept"] = "application/json"
×
497
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
498
        header_parameters["x-ms-conversation-id"] = conversation_id
×
499
        if custom_headers:
×
500
            header_parameters.update(custom_headers)
×
501

502
        # Construct body
503
        body_content = self._serialize.body(activity, "Activity")
×
504

505
        # Construct and send request
506
        request = self._client.post(
×
507
            url, query_parameters, header_parameters, body_content
508
        )
509
        response = self._client.send(request, stream=False, **operation_config)
×
510

511
        if response.status_code not in [200, 201, 202]:
×
512
            raise models.ErrorResponseException(self._deserialize, response)
×
513

514
        deserialized = None
×
515
        if response.status_code == 200:
×
516
            deserialized = self._deserialize("ResourceResponse", response)
×
517
        if response.status_code == 201:
×
518
            deserialized = self._deserialize("ResourceResponse", response)
×
519
        if response.status_code == 202:
×
520
            deserialized = self._deserialize("ResourceResponse", response)
×
521

522
        if raw:
×
523
            client_raw_response = ClientRawResponse(deserialized, response)
×
524
            return client_raw_response
×
525

526
        return deserialized
×
527

528
    reply_to_activity.metadata = {
4✔
529
        "url": "/v3/conversations/{conversationId}/activities/{activityId}"
530
    }
531

532
    def delete_activity(  # pylint: disable=inconsistent-return-statements
4✔
533
        self,
534
        conversation_id,
535
        activity_id,
536
        custom_headers=None,
537
        raw=False,
538
        **operation_config
539
    ):
540
        """DeleteActivity.
541

542
        Delete an existing activity.
543
        Some channels allow you to delete an existing activity, and if
544
        successful this method will remove the specified activity.
545

546
        :param conversation_id: Conversation ID
547
        :type conversation_id: str
548
        :param activity_id: activityId to delete
549
        :type activity_id: str
550
        :param dict custom_headers: headers that will be added to the request
551
        :param bool raw: returns the direct response alongside the
552
         deserialized response
553
        :param operation_config: :ref:`Operation configuration
554
         overrides<msrest:optionsforoperations>`.
555
        :return: None or ClientRawResponse if raw=true
556
        :rtype: None or ~msrest.pipeline.ClientRawResponse
557
        :raises:
558
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
559
        """
560
        # Construct URL
561
        url = self.delete_activity.metadata["url"]
×
562
        path_format_arguments = {
×
563
            "conversationId": self._serialize.url(
564
                "conversation_id", conversation_id, "str"
565
            ),
566
            "activityId": self._serialize.url("activity_id", activity_id, "str"),
567
        }
568
        url = self._client.format_url(url, **path_format_arguments)
×
569

570
        # Construct parameters
571
        query_parameters = {}
×
572

573
        # Construct headers
574
        header_parameters = {}
×
575
        if custom_headers:
×
576
            header_parameters.update(custom_headers)
×
577

578
        # Construct and send request
579
        request = self._client.delete(url, query_parameters, header_parameters)
×
580
        response = self._client.send(request, stream=False, **operation_config)
×
581

582
        if response.status_code not in [200, 202]:
×
583
            raise models.ErrorResponseException(self._deserialize, response)
×
584

585
        if raw:
×
586
            client_raw_response = ClientRawResponse(None, response)
×
587
            return client_raw_response
×
588

589
    delete_activity.metadata = {
4✔
590
        "url": "/v3/conversations/{conversationId}/activities/{activityId}"
591
    }
592

593
    def get_conversation_members(
4✔
594
        self, conversation_id, custom_headers=None, raw=False, **operation_config
595
    ):
596
        """GetConversationMembers.
597

598
        Enumerate the members of a conversation.
599
        This REST API takes a ConversationId and returns an array of
600
        ChannelAccount objects representing the members of the conversation.
601

602
        :param conversation_id: Conversation ID
603
        :type conversation_id: str
604
        :param dict custom_headers: headers that will be added to the request
605
        :param bool raw: returns the direct response alongside the
606
         deserialized response
607
        :param operation_config: :ref:`Operation configuration
608
         overrides<msrest:optionsforoperations>`.
609
        :return: list or ClientRawResponse if raw=true
610
        :rtype: list[~botframework.connector.models.ChannelAccount] or
611
         ~msrest.pipeline.ClientRawResponse
612
        :raises:
613
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
614
        """
615
        # Construct URL
616
        url = self.get_conversation_members.metadata["url"]
×
617
        path_format_arguments = {
×
618
            "conversationId": self._serialize.url(
619
                "conversation_id", conversation_id, "str"
620
            )
621
        }
622
        url = self._client.format_url(url, **path_format_arguments)
×
623

624
        # Construct parameters
625
        query_parameters = {}
×
626

627
        # Construct headers
628
        header_parameters = {}
×
629
        header_parameters["Accept"] = "application/json"
×
630
        if custom_headers:
×
631
            header_parameters.update(custom_headers)
×
632

633
        # Construct and send request
634
        request = self._client.get(url, query_parameters, header_parameters)
×
635
        response = self._client.send(request, stream=False, **operation_config)
×
636

637
        if response.status_code not in [200]:
×
638
            raise models.ErrorResponseException(self._deserialize, response)
×
639

640
        deserialized = None
×
641
        if response.status_code == 200:
×
642
            deserialized = self._deserialize("[ChannelAccount]", response)
×
643

644
        if raw:
×
645
            client_raw_response = ClientRawResponse(deserialized, response)
×
646
            return client_raw_response
×
647

648
        return deserialized
×
649

650
    get_conversation_members.metadata = {
4✔
651
        "url": "/v3/conversations/{conversationId}/members"
652
    }
653

654
    def get_conversation_member(
4✔
655
        self,
656
        conversation_id,
657
        member_id,
658
        custom_headers=None,
659
        raw=False,
660
        **operation_config
661
    ):
662
        """GetConversationMember.
663

664
        Get a member of a conversation.
665
        This REST API takes a ConversationId and memberId and returns a
666
        ChannelAccount object representing the member of the conversation.
667

668
        :param conversation_id: Conversation Id
669
        :type conversation_id: str
670
        :param member_id: Member Id
671
        :type member_id: str
672
        :param dict custom_headers: headers that will be added to the request
673
        :param bool raw: returns the direct response alongside the
674
         deserialized response
675
        :param operation_config: :ref:`Operation configuration
676
         overrides<msrest:optionsforoperations>`.
677
        :return: list or ClientRawResponse if raw=true
678
        :rtype: list[~botframework.connector.models.ChannelAccount] or
679
         ~msrest.pipeline.ClientRawResponse
680
        :raises:
681
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
682
        """
683
        # Construct URL
684
        url = self.get_conversation_member.metadata["url"]
×
685
        path_format_arguments = {
×
686
            "conversationId": self._serialize.url(
687
                "conversation_id", conversation_id, "str"
688
            ),
689
            "memberId": self._serialize.url("member_id", member_id, "str"),
690
        }
691
        url = self._client.format_url(url, **path_format_arguments)
×
692

693
        # Construct parameters
694
        query_parameters = {}
×
695

696
        # Construct headers
697
        header_parameters = {}
×
698
        header_parameters["Accept"] = "application/json"
×
699
        if custom_headers:
×
700
            header_parameters.update(custom_headers)
×
701

702
        # Construct and send request
703
        request = self._client.get(url, query_parameters, header_parameters)
×
704
        response = self._client.send(request, stream=False, **operation_config)
×
705

706
        if response.status_code not in [200]:
×
707
            raise models.ErrorResponseException(self._deserialize, response)
×
708

709
        deserialized = None
×
710
        if response.status_code == 200:
×
711
            deserialized = self._deserialize("ChannelAccount", response)
×
712

713
        if raw:
×
714
            client_raw_response = ClientRawResponse(deserialized, response)
×
715
            return client_raw_response
×
716

717
        return deserialized
×
718

719
    get_conversation_member.metadata = {
4✔
720
        "url": "/v3/conversations/{conversationId}/members/{memberId}"
721
    }
722

723
    def get_conversation_paged_members(
4✔
724
        self,
725
        conversation_id,
726
        page_size=None,
727
        continuation_token=None,
728
        custom_headers=None,
729
        raw=False,
730
        **operation_config
731
    ):
732
        """GetConversationPagedMembers.
733

734
        Enumerate the members of a conversation one page at a time.
735
        This REST API takes a ConversationId. Optionally a pageSize and/or
736
        continuationToken can be provided. It returns a PagedMembersResult,
737
        which contains an array
738
        of ChannelAccounts representing the members of the conversation and a
739
        continuation token that can be used to get more values.
740
        One page of ChannelAccounts records are returned with each call. The
741
        number of records in a page may vary between channels and calls. The
742
        pageSize parameter can be used as
743
        a suggestion. If there are no additional results the response will not
744
        contain a continuation token. If there are no members in the
745
        conversation the Members will be empty or not present in the response.
746
        A response to a request that has a continuation token from a prior
747
        request may rarely return members from a previous request.
748

749
        :param conversation_id: Conversation ID
750
        :type conversation_id: str
751
        :param page_size: Suggested page size
752
        :type page_size: int
753
        :param continuation_token: Continuation Token
754
        :type continuation_token: str
755
        :param dict custom_headers: headers that will be added to the request
756
        :param bool raw: returns the direct response alongside the
757
         deserialized response
758
        :param operation_config: :ref:`Operation configuration
759
         overrides<msrest:optionsforoperations>`.
760
        :return: PagedMembersResult or ClientRawResponse if raw=true
761
        :rtype: ~botframework.connector.models.PagedMembersResult or
762
         ~msrest.pipeline.ClientRawResponse
763
        :raises:
764
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
765
        """
766
        # Construct URL
767
        url = self.get_conversation_paged_members.metadata["url"]
×
768
        path_format_arguments = {
×
769
            "conversationId": self._serialize.url(
770
                "conversation_id", conversation_id, "str"
771
            )
772
        }
773
        url = self._client.format_url(url, **path_format_arguments)
×
774

775
        # Construct parameters
776
        query_parameters = {}
×
777
        if page_size is not None:
×
778
            query_parameters["pageSize"] = self._serialize.query(
×
779
                "page_size", page_size, "int"
780
            )
781
        if continuation_token is not None:
×
782
            query_parameters["continuationToken"] = self._serialize.query(
×
783
                "continuation_token", continuation_token, "str"
784
            )
785

786
        # Construct headers
787
        header_parameters = {}
×
788
        header_parameters["Accept"] = "application/json"
×
789
        if custom_headers:
×
790
            header_parameters.update(custom_headers)
×
791

792
        # Construct and send request
793
        request = self._client.get(url, query_parameters, header_parameters)
×
794
        response = self._client.send(request, stream=False, **operation_config)
×
795

796
        if response.status_code not in [200]:
×
797
            raise HttpOperationError(self._deserialize, response)
×
798

799
        deserialized = None
×
800
        if response.status_code == 200:
×
801
            deserialized = self._deserialize("PagedMembersResult", response)
×
802

803
        if raw:
×
804
            client_raw_response = ClientRawResponse(deserialized, response)
×
805
            return client_raw_response
×
806

807
        return deserialized
×
808

809
    get_conversation_paged_members.metadata = {
4✔
810
        "url": "/v3/conversations/{conversationId}/pagedmembers"
811
    }
812

813
    def get_teams_conversation_paged_members(
4✔
814
        self,
815
        conversation_id,
816
        page_size=None,
817
        continuation_token=None,
818
        custom_headers=None,
819
        raw=False,
820
        **operation_config
821
    ):
822
        """GetTeamsConversationPagedMembers.
823

824
        Enumerate the members of a Teams conversation one page at a time.
825
        This REST API takes a ConversationId. Optionally a pageSize and/or
826
        continuationToken can be provided. It returns a PagedMembersResult,
827
        which contains an array
828
        of ChannelAccounts representing the members of the conversation and a
829
        continuation token that can be used to get more values.
830
        One page of ChannelAccounts records are returned with each call. The
831
        number of records in a page may vary between channels and calls. The
832
        pageSize parameter can be used as
833
        a suggestion. If there are no additional results the response will not
834
        contain a continuation token. If there are no members in the
835
        conversation the Members will be empty or not present in the response.
836
        A response to a request that has a continuation token from a prior
837
        request may rarely return members from a previous request.
838

839
        :param conversation_id: Conversation ID
840
        :type conversation_id: str
841
        :param page_size: Suggested page size
842
        :type page_size: int
843
        :param continuation_token: Continuation Token
844
        :type continuation_token: str
845
        :param dict custom_headers: headers that will be added to the request
846
        :param bool raw: returns the direct response alongside the
847
         deserialized response
848
        :param operation_config: :ref:`Operation configuration
849
         overrides<msrest:optionsforoperations>`.
850
        :return: PagedMembersResult or ClientRawResponse if raw=true
851
        :rtype: ~botframework.connector.models.PagedMembersResult or
852
         ~msrest.pipeline.ClientRawResponse
853
        :raises:
854
         :class:`HttpOperationError<msrest.exceptions.HttpOperationError>`
855
        """
856
        # Construct URL
857
        url = self.get_conversation_paged_members.metadata["url"]
×
858
        path_format_arguments = {
×
859
            "conversationId": self._serialize.url(
860
                "conversation_id", conversation_id, "str"
861
            )
862
        }
863
        url = self._client.format_url(url, **path_format_arguments)
×
864

865
        # Construct parameters
866
        query_parameters = {}
×
867
        if page_size is not None:
×
868
            query_parameters["pageSize"] = self._serialize.query(
×
869
                "page_size", page_size, "int"
870
            )
871
        if continuation_token is not None:
×
872
            query_parameters["continuationToken"] = self._serialize.query(
×
873
                "continuation_token", continuation_token, "str"
874
            )
875

876
        # Construct headers
877
        header_parameters = {}
×
878
        header_parameters["Accept"] = "application/json"
×
879
        if custom_headers:
×
880
            header_parameters.update(custom_headers)
×
881

882
        # Construct and send request
883
        request = self._client.get(url, query_parameters, header_parameters)
×
884
        response = self._client.send(request, stream=False, **operation_config)
×
885

886
        if response.status_code not in [200]:
×
887
            raise HttpOperationError(self._deserialize, response)
×
888

889
        deserialized = None
×
890
        if response.status_code == 200:
×
891
            deserialized = self._deserialize("TeamsPagedMembersResult", response)
×
892

893
        if raw:
×
894
            client_raw_response = ClientRawResponse(deserialized, response)
×
895
            return client_raw_response
×
896

897
        return deserialized
×
898

899
    get_conversation_paged_members.metadata = {
4✔
900
        "url": "/v3/conversations/{conversationId}/pagedmembers"
901
    }
902

903
    def delete_conversation_member(  # pylint: disable=inconsistent-return-statements
4✔
904
        self,
905
        conversation_id,
906
        member_id,
907
        custom_headers=None,
908
        raw=False,
909
        **operation_config
910
    ):
911
        """DeleteConversationMember.
912

913
        Deletes a member from a conversation.
914
        This REST API takes a ConversationId and a memberId (of type string)
915
        and removes that member from the conversation. If that member was the
916
        last member
917
        of the conversation, the conversation will also be deleted.
918

919
        :param conversation_id: Conversation ID
920
        :type conversation_id: str
921
        :param member_id: ID of the member to delete from this conversation
922
        :type member_id: str
923
        :param dict custom_headers: headers that will be added to the request
924
        :param bool raw: returns the direct response alongside the
925
         deserialized response
926
        :param operation_config: :ref:`Operation configuration
927
         overrides<msrest:optionsforoperations>`.
928
        :return: None or ClientRawResponse if raw=true
929
        :rtype: None or ~msrest.pipeline.ClientRawResponse
930
        :raises:
931
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
932
        """
933
        # Construct URL
934
        url = self.delete_conversation_member.metadata["url"]
×
935
        path_format_arguments = {
×
936
            "conversationId": self._serialize.url(
937
                "conversation_id", conversation_id, "str"
938
            ),
939
            "memberId": self._serialize.url("member_id", member_id, "str"),
940
        }
941
        url = self._client.format_url(url, **path_format_arguments)
×
942

943
        # Construct parameters
944
        query_parameters = {}
×
945

946
        # Construct headers
947
        header_parameters = {}
×
948
        if custom_headers:
×
949
            header_parameters.update(custom_headers)
×
950

951
        # Construct and send request
952
        request = self._client.delete(url, query_parameters, header_parameters)
×
953
        response = self._client.send(request, stream=False, **operation_config)
×
954

955
        if response.status_code not in [200, 204]:
×
956
            raise models.ErrorResponseException(self._deserialize, response)
×
957

958
        if raw:
×
959
            client_raw_response = ClientRawResponse(None, response)
×
960
            return client_raw_response
×
961

962
    delete_conversation_member.metadata = {
4✔
963
        "url": "/v3/conversations/{conversationId}/members/{memberId}"
964
    }
965

966
    def get_activity_members(
4✔
967
        self,
968
        conversation_id,
969
        activity_id,
970
        custom_headers=None,
971
        raw=False,
972
        **operation_config
973
    ):
974
        """GetActivityMembers.
975

976
        Enumerate the members of an activity.
977
        This REST API takes a ConversationId and a ActivityId, returning an
978
        array of ChannelAccount objects representing the members of the
979
        particular activity in the conversation.
980

981
        :param conversation_id: Conversation ID
982
        :type conversation_id: str
983
        :param activity_id: Activity ID
984
        :type activity_id: str
985
        :param dict custom_headers: headers that will be added to the request
986
        :param bool raw: returns the direct response alongside the
987
         deserialized response
988
        :param operation_config: :ref:`Operation configuration
989
         overrides<msrest:optionsforoperations>`.
990
        :return: list or ClientRawResponse if raw=true
991
        :rtype: list[~botframework.connector.models.ChannelAccount] or
992
         ~msrest.pipeline.ClientRawResponse
993
        :raises:
994
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
995
        """
996
        # Construct URL
997
        url = self.get_activity_members.metadata["url"]
×
998
        path_format_arguments = {
×
999
            "conversationId": self._serialize.url(
1000
                "conversation_id", conversation_id, "str"
1001
            ),
1002
            "activityId": self._serialize.url("activity_id", activity_id, "str"),
1003
        }
1004
        url = self._client.format_url(url, **path_format_arguments)
×
1005

1006
        # Construct parameters
1007
        query_parameters = {}
×
1008

1009
        # Construct headers
1010
        header_parameters = {}
×
1011
        header_parameters["Accept"] = "application/json"
×
1012
        if custom_headers:
×
1013
            header_parameters.update(custom_headers)
×
1014

1015
        # Construct and send request
1016
        request = self._client.get(url, query_parameters, header_parameters)
×
1017
        response = self._client.send(request, stream=False, **operation_config)
×
1018

1019
        if response.status_code not in [200]:
×
1020
            raise models.ErrorResponseException(self._deserialize, response)
×
1021

1022
        deserialized = None
×
1023
        if response.status_code == 200:
×
1024
            deserialized = self._deserialize("[ChannelAccount]", response)
×
1025

1026
        if raw:
×
1027
            client_raw_response = ClientRawResponse(deserialized, response)
×
1028
            return client_raw_response
×
1029

1030
        return deserialized
×
1031

1032
    get_activity_members.metadata = {
4✔
1033
        "url": "/v3/conversations/{conversationId}/activities/{activityId}/members"
1034
    }
1035

1036
    def upload_attachment(
4✔
1037
        self,
1038
        conversation_id,
1039
        attachment_upload,
1040
        custom_headers=None,
1041
        raw=False,
1042
        **operation_config
1043
    ):
1044
        """UploadAttachment.
1045

1046
        Upload an attachment directly into a channel's blob storage.
1047
        This is useful because it allows you to store data in a compliant store
1048
        when dealing with enterprises.
1049
        The response is a ResourceResponse which contains an AttachmentId which
1050
        is suitable for using with the attachments API.
1051

1052
        :param conversation_id: Conversation ID
1053
        :type conversation_id: str
1054
        :param attachment_upload: Attachment data
1055
        :type attachment_upload: ~botframework.connector.models.AttachmentData
1056
        :param dict custom_headers: headers that will be added to the request
1057
        :param bool raw: returns the direct response alongside the
1058
         deserialized response
1059
        :param operation_config: :ref:`Operation configuration
1060
         overrides<msrest:optionsforoperations>`.
1061
        :return: ResourceResponse or ClientRawResponse if raw=true
1062
        :rtype: ~botframework.connector.models.ResourceResponse or
1063
         ~msrest.pipeline.ClientRawResponse
1064
        :raises:
1065
         :class:`ErrorResponseException<botframework.connector.models.ErrorResponseException>`
1066
        """
1067
        # Construct URL
1068
        url = self.upload_attachment.metadata["url"]
×
1069
        path_format_arguments = {
×
1070
            "conversationId": self._serialize.url(
1071
                "conversation_id", conversation_id, "str"
1072
            )
1073
        }
1074
        url = self._client.format_url(url, **path_format_arguments)
×
1075

1076
        # Construct parameters
1077
        query_parameters = {}
×
1078

1079
        # Construct headers
1080
        header_parameters = {}
×
1081
        header_parameters["Accept"] = "application/json"
×
1082
        header_parameters["Content-Type"] = "application/json; charset=utf-8"
×
1083
        if custom_headers:
×
1084
            header_parameters.update(custom_headers)
×
1085

1086
        # Construct body
1087
        body_content = self._serialize.body(attachment_upload, "AttachmentData")
×
1088

1089
        # Construct and send request
1090
        request = self._client.post(
×
1091
            url, query_parameters, header_parameters, body_content
1092
        )
1093
        response = self._client.send(request, stream=False, **operation_config)
×
1094

1095
        if response.status_code not in [200, 201, 202]:
×
1096
            raise models.ErrorResponseException(self._deserialize, response)
×
1097

1098
        deserialized = None
×
1099
        if response.status_code == 200:
×
1100
            deserialized = self._deserialize("ResourceResponse", response)
×
1101
        if response.status_code == 201:
×
1102
            deserialized = self._deserialize("ResourceResponse", response)
×
1103
        if response.status_code == 202:
×
1104
            deserialized = self._deserialize("ResourceResponse", response)
×
1105

1106
        if raw:
×
1107
            client_raw_response = ClientRawResponse(deserialized, response)
×
1108
            return client_raw_response
×
1109

1110
        return deserialized
×
1111

1112
    upload_attachment.metadata = {
4✔
1113
        "url": "/v3/conversations/{conversationId}/attachments"
1114
    }
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