Skip to content

Commit 9d595b0

Browse files
authored
Merge pull request #690 from microsoft/mm-api-ref-docs-fixes-wip
mm-api-ref-docs-fixes-wip
2 parents d079c03 + aa571ed commit 9d595b0

File tree

6 files changed

+123
-95
lines changed

6 files changed

+123
-95
lines changed

libraries/botbuilder-core/botbuilder/core/activity_handler.py

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ async def on_turn(self, turn_context: TurnContext):
1313
in order to process an inbound :class:`botbuilder.schema.Activity`.
1414
1515
:param turn_context: The context object for this turn
16-
:type turn_context: :class:`TurnContext`
16+
:type turn_context: :class:`botbuilder.core.TurnContext`
1717
1818
:returns: A task that represents the work queued to execute
1919
2020
.. remarks::
2121
It calls other methods in this class based on the type of the activity to
2222
process, which allows a derived class to provide type-specific logic in a controlled way.
2323
In a derived class, override this method to add logic that applies to all activity types.
24-
25-
.. note::
26-
- Add logic to apply before the type-specific logic and before the call to the
27-
:meth:`ActivityHandler.on_turn()` method.
28-
- Add logic to apply after the type-specific logic after the call to the
29-
:meth:`ActivityHandler.on_turn()` method.
24+
Also
25+
- Add logic to apply before the type-specific logic and before calling :meth:`ActivityHandler.on_turn()`.
26+
- Add logic to apply after the type-specific logic after calling :meth:`ActivityHandler.on_turn()`.
3027
"""
3128
if turn_context is None:
3229
raise TypeError("ActivityHandler.on_turn(): turn_context cannot be None.")
@@ -65,10 +62,9 @@ async def on_message_activity( # pylint: disable=unused-argument
6562
such as the conversational logic.
6663
6764
:param turn_context: The context object for this turn
68-
:type turn_context: :class:`TurnContext`
65+
:type turn_context: :class:`botbuilder.core.TurnContext`
6966
7067
:returns: A task that represents the work queued to execute
71-
7268
"""
7369
return
7470

@@ -78,11 +74,11 @@ async def on_conversation_update_activity(self, turn_context: TurnContext):
7874
:meth:`ActivityHandler.on_turn()` is used.
7975
8076
:param turn_context: The context object for this turn
81-
:type turn_context: :class:`TurnContext`
77+
:type turn_context: :class:`botbuilder.core.TurnContext`
8278
8379
:returns: A task that represents the work queued to execute
8480
85-
.. note::
81+
.. remarks::
8682
When the :meth:'ActivityHandler.on_turn()` method receives a conversation update activity, it calls this
8783
method.
8884
If the conversation update activity indicates that members other than the bot joined the conversation,
@@ -119,11 +115,11 @@ async def on_members_added_activity(
119115
conversation update activity
120116
:type members_added: :class:`typing.List`
121117
:param turn_context: The context object for this turn
122-
:type turn_context: :class:`TurnContext`
118+
:type turn_context: :class:`botbuilder.core.TurnContext`
123119
124120
:returns: A task that represents the work queued to execute
125121
126-
.. note::
122+
.. remarks::
127123
When the :meth:'ActivityHandler.on_conversation_update_activity()` method receives a conversation
128124
update activity that indicates
129125
one or more users other than the bot are joining the conversation, it calls this method.
@@ -141,11 +137,11 @@ async def on_members_removed_activity(
141137
conversation update activity
142138
:type members_added: :class:`typing.List`
143139
:param turn_context: The context object for this turn
144-
:type turn_context: :class:`TurnContext`
140+
:type turn_context: :class:`botbuilder.core.TurnContext`
145141
146142
:returns: A task that represents the work queued to execute
147143
148-
.. note::
144+
.. remarks::
149145
When the :meth:'ActivityHandler.on_conversation_update_activity()` method receives a conversation
150146
update activity that indicates one or more users other than the bot are leaving the conversation,
151147
it calls this method.
@@ -159,11 +155,11 @@ async def on_message_reaction_activity(self, turn_context: TurnContext):
159155
:meth:'ActivityHandler.on_turn()` is used.
160156
161157
:param turn_context: The context object for this turn
162-
:type turn_context: :class:`TurnContext`
158+
:type turn_context: :class:`botbuilder.core.TurnContext`
163159
164160
:returns: A task that represents the work queued to execute
165161
166-
.. note::
162+
.. remarks::
167163
Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji) to a previously
168164
sent activity.
169165
Message reactions are only supported by a few channels. The activity that the message reaction corresponds
@@ -200,11 +196,11 @@ async def on_reactions_added( # pylint: disable=unused-argument
200196
:param message_reactions: The list of reactions added
201197
:type message_reactions: :class:`typing.List`
202198
:param turn_context: The context object for this turn
203-
:type turn_context: :class:`TurnContext`
199+
:type turn_context: :class:`botbuilder.core.TurnContext`
204200
205201
:returns: A task that represents the work queued to execute
206202
207-
.. note::
203+
.. remarks::
208204
Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji)
209205
to a previously sent message on the conversation. Message reactions are supported by only a few channels.
210206
The activity that the message is in reaction to is identified by the activity's reply to Id property.
@@ -223,11 +219,11 @@ async def on_reactions_removed( # pylint: disable=unused-argument
223219
:param message_reactions: The list of reactions removed
224220
:type message_reactions: :class:`typing.List`
225221
:param turn_context: The context object for this turn
226-
:type turn_context: :class:`TurnContext`
222+
:type turn_context: :class:`botbuilder.core.TurnContext`
227223
228224
:returns: A task that represents the work queued to execute
229225
230-
.. note::
226+
.. remarks::
231227
Message reactions correspond to the user adding a 'like' or 'sad' etc. (often an emoji)
232228
to a previously sent message on the conversation. Message reactions are supported by only a few channels.
233229
The activity that the message is in reaction to is identified by the activity's reply to Id property.
@@ -242,11 +238,11 @@ async def on_event_activity(self, turn_context: TurnContext):
242238
:meth:'ActivityHandler.on_turn()` is used.
243239
244240
:param turn_context: The context object for this turn
245-
:type turn_context: :class:`TurnContext`
241+
:type turn_context: :class:`botbuilder.core.TurnContext`
246242
247243
:returns: A task that represents the work queued to execute
248244
249-
.. note::
245+
.. remarks::
250246
When the :meth:'ActivityHandler.on_turn()` method receives an event activity, it calls this method.
251247
If the activity name is `tokens/response`, it calls :meth:'ActivityHandler.on_token_response_event()`;
252248
otherwise, it calls :meth:'ActivityHandler.on_event()`.
@@ -273,11 +269,11 @@ async def on_token_response_event( # pylint: disable=unused-argument
273269
If using an `oauth_prompt`, override this method to forward this activity to the current dialog.
274270
275271
:param turn_context: The context object for this turn
276-
:type turn_context: :class:`TurnContext`
272+
:type turn_context: :class:`botbuilder.core.TurnContext`
277273
278274
:returns: A task that represents the work queued to execute
279275
280-
.. note::
276+
.. remarks::
281277
When the :meth:'ActivityHandler.on_event()` method receives an event with an activity name of
282278
`tokens/response`, it calls this method. If your bot uses an `oauth_prompt`, forward the incoming
283279
activity to the current dialog.
@@ -293,11 +289,11 @@ async def on_event( # pylint: disable=unused-argument
293289
294290
295291
:param turn_context: The context object for this turn
296-
:type turn_context: :class:`TurnContext`
292+
:type turn_context: :class:`botbuilder.core.TurnContext`
297293
298294
:returns: A task that represents the work queued to execute
299295
300-
.. note::
296+
.. remarks::
301297
When the :meth:'ActivityHandler.on_event_activity()` is used method receives an event with an
302298
activity name other than `tokens/response`, it calls this method.
303299
This method could optionally be overridden if the bot is meant to handle miscellaneous events.
@@ -311,7 +307,7 @@ async def on_end_of_conversation_activity( # pylint: disable=unused-argument
311307
Invoked when a conversation end activity is received from the channel.
312308
313309
:param turn_context: The context object for this turn
314-
:type turn_context: :class:`TurnContext`
310+
:type turn_context: :class:`botbuilder.core.TurnContext`
315311
:returns: A task that represents the work queued to execute
316312
"""
317313
return
@@ -325,11 +321,11 @@ async def on_unrecognized_activity_type( # pylint: disable=unused-argument
325321
If overridden, this method could potentially respond to any of the other activity types.
326322
327323
:param turn_context: The context object for this turn
328-
:type turn_context: :class:`TurnContext`
324+
:type turn_context: :class:`botbuilder.core.TurnContext`
329325
330326
:returns: A task that represents the work queued to execute
331327
332-
.. note::
328+
.. remarks::
333329
When the :meth:`ActivityHandler.on_turn()` method receives an activity that is not a message,
334330
conversation update, message reaction, or event activity, it calls this method.
335331
"""

libraries/botbuilder-core/botbuilder/core/bot_framework_adapter.py

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,9 @@ def __init__(
8787
"""
8888
Contains the settings used to initialize a :class:`BotFrameworkAdapter` instance.
8989
90-
:param app_id: The bot application ID. This is the appId returned by the Azure portal registration, and is
91-
the value of the `MicrosoftAppId` parameter in the `config.py` file.
90+
:param app_id: The bot application ID.
9291
:type app_id: str
93-
:param app_password: The bot application password. This is the password returned by the Azure portal
94-
registration, and is
92+
:param app_password: The bot application password.
9593
the value os the `MicrosoftAppPassword` parameter in the `config.py` file.
9694
:type app_password: str
9795
:param channel_auth_tenant: The channel tenant to use in conversation
@@ -201,7 +199,7 @@ async def continue_conversation(
201199
202200
:return: A task that represents the work queued to execute.
203201
204-
.. note::
202+
.. remarks::
205203
This is often referred to as the bots *proactive messaging* flow as it lets the bot proactively
206204
send messages to a conversation or user that are already in a communication.
207205
Scenarios such as sending notifications or coupons to a user are enabled by this function.
@@ -247,7 +245,7 @@ async def create_conversation(
247245
248246
:return: A task representing the work queued to execute.
249247
250-
.. note::
248+
.. remarks::
251249
To start a conversation, your bot must know its account information and the user's
252250
account information on that channel.
253251
Most channels only support initiating a direct message (non-group) conversation.
@@ -306,9 +304,7 @@ async def create_conversation(
306304

307305
async def process_activity(self, req, auth_header: str, logic: Callable):
308306
"""
309-
Creates a turn context and runs the middleware pipeline for an incoming activity,
310-
Processes an activity received by the bots web server. This includes any messages sent from a
311-
user and is the method that drives what's often referred to as the bots *reactive messaging* flow.
307+
Creates a turn context and runs the middleware pipeline for an incoming activity.
312308
313309
:param req: The incoming activity
314310
:type req: :class:`typing.str`
@@ -317,15 +313,15 @@ async def process_activity(self, req, auth_header: str, logic: Callable):
317313
:param logic: The logic to execute at the end of the adapter's middleware pipeline.
318314
:type logic: :class:`typing.Callable`
319315
320-
:return: A task that represents the work queued to execute. If the activity type
321-
was `Invoke` and the corresponding key (`channelId` + `activityId`) was found then
322-
an :class:`InvokeResponse` is returned; otherwise, `null` is returned.
316+
:return: A task that represents the work queued to execute.
323317
324-
.. note::
318+
.. remarks::
319+
This class processes an activity received by the bots web server. This includes any messages
320+
sent from a user and is the method that drives what's often referred to as the
321+
bots *reactive messaging* flow.
325322
Call this method to reactively send a message to a conversation.
326323
If the task completes successfully, then an :class:`InvokeResponse` is returned;
327324
otherwise. `null` is returned.
328-
329325
"""
330326
activity = await self.parse_request(req)
331327
auth_header = auth_header or ""
@@ -457,7 +453,7 @@ async def update_activity(self, context: TurnContext, activity: Activity):
457453
458454
:return: A task that represents the work queued to execute
459455
460-
.. note::
456+
.. remarks::
461457
If the activity is successfully sent, the task result contains
462458
a :class:`botbuilder.schema.ResourceResponse` object containing the ID that
463459
the receiving channel assigned to the activity.
@@ -490,6 +486,7 @@ async def delete_activity(
490486
:return: A task that represents the work queued to execute
491487
492488
.. note::
489+
493490
The activity_id of the :class:`botbuilder.schema.ConversationReference` identifies the activity to delete.
494491
"""
495492
try:
@@ -565,7 +562,7 @@ async def delete_conversation_member(
565562
Deletes a member from the current conversation.
566563
567564
:param context: The context object for the turn
568-
:type context: :class:`TurnContext`
565+
:type context: :class:`botbuilder.core.TurnContext`
569566
:param member_id: The ID of the member to remove from the conversation
570567
:type member_id: str
571568
@@ -603,7 +600,7 @@ async def get_activity_members(self, context: TurnContext, activity_id: str):
603600
Lists the members of a given activity.
604601
605602
:param context: The context object for the turn
606-
:type context: :class:`TurnContext`
603+
:type context: :class:`botbuilder.core.TurnContext`
607604
:param activity_id: (Optional) Activity ID to enumerate.
608605
If not specified the current activities ID will be used.
609606
@@ -645,7 +642,7 @@ async def get_conversation_members(self, context: TurnContext):
645642
Lists the members of a current conversation.
646643
647644
:param context: The context object for the turn
648-
:type context: :class:`TurnContext`
645+
:type context: :class:`botbuilder.core.TurnContext`
649646
650647
:raises: An exception error
651648
@@ -674,9 +671,7 @@ async def get_conversation_members(self, context: TurnContext):
674671

675672
async def get_conversations(self, service_url: str, continuation_token: str = None):
676673
"""
677-
Lists the Conversations in which this bot has participated for a given channel server. The channel server
678-
returns results in pages and each page will include a `continuationToken` that can be used to fetch the next
679-
page of results from the server.
674+
Lists the Conversations in which this bot has participated for a given channel server.
680675
681676
:param service_url: The URL of the channel server to query. This can be retrieved from
682677
`context.activity.serviceUrl`
@@ -689,8 +684,10 @@ async def get_conversations(self, service_url: str, continuation_token: str = No
689684
690685
:return: A task that represents the work queued to execute
691686
692-
.. note:: If the task completes successfully, the result contains a page of the members of the current
693-
conversation.
687+
.. remarks::
688+
The channel server returns results in pages and each page will include a `continuationToken` that
689+
can be used to fetch the next page of results from the server.
690+
If the task completes successfully, the result contains a page of the members of the current conversation.
694691
This overload may be called from outside the context of a conversation, as only the bot's service URL and
695692
credentials are required.
696693
"""
@@ -705,7 +702,7 @@ async def get_user_token(
705702
Attempts to retrieve the token for a user that's in a login flow.
706703
707704
:param context: Context for the current turn of conversation with the user
708-
:type context: :class:`TurnContext`
705+
:type context: :class:`botbuilder.core.TurnContext`
709706
:param connection_name: Name of the auth connection to use
710707
:type connection_name: str
711708
:param magic_code" (Optional) user entered code to validate
@@ -752,7 +749,7 @@ async def sign_out_user(
752749
Signs the user out with the token server.
753750
754751
:param context: Context for the current turn of conversation with the user
755-
:type context: :class:`TurnContext`
752+
:type context: :class:`botbuilder.core.TurnContext`
756753
:param connection_name: Name of the auth connection to use
757754
:type connection_name: str
758755
:param user_id: User id of user to sign out
@@ -781,13 +778,14 @@ async def get_oauth_sign_in_link(
781778
Gets the raw sign-in link to be sent to the user for sign-in for a connection name.
782779
783780
:param context: Context for the current turn of conversation with the user
784-
:type context: :class:`TurnContext`
781+
:type context: :class:`botbuilder.core.TurnContext`
785782
:param connection_name: Name of the auth connection to use
786783
:type connection_name: str
787784
788785
:returns: A task that represents the work queued to execute
789786
790787
.. note::
788+
791789
If the task completes successfully, the result contains the raw sign-in link
792790
"""
793791
self.check_emulating_oauth_cards(context)
@@ -814,7 +812,7 @@ async def get_token_status(
814812
Retrieves the token status for each configured connection for the given user.
815813
816814
:param context: Context for the current turn of conversation with the user
817-
:type context: :class:`TurnContext`
815+
:type context: :class:`botbuilder.core.TurnContext`
818816
:param user_id: The user Id for which token status is retrieved
819817
:type user_id: str
820818
:param include_filter: (Optional) Comma separated list of connection's to include.
@@ -848,14 +846,11 @@ async def get_aad_tokens(
848846
Retrieves Azure Active Directory tokens for particular resources on a configured connection.
849847
850848
:param context: Context for the current turn of conversation with the user
851-
:type context: :class:`TurnContext`
852-
849+
:type context: :class:`botbuilder.core.TurnContext`
853850
:param connection_name: The name of the Azure Active Directory connection configured with this bot
854851
:type connection_name: str
855-
856852
:param resource_urls: The list of resource URLs to retrieve tokens for
857853
:type resource_urls: :class:`typing.List`
858-
859854
:returns: Dictionary of resource Urls to the corresponding :class:'botbuilder.schema.TokenResponse`
860855
:rtype: :class:`typing.Dict`
861856
"""

0 commit comments

Comments
 (0)