@@ -27,10 +27,12 @@ class SlackHelper:
27
27
@staticmethod
28
28
def activity_to_slack (activity : Activity ) -> SlackMessage :
29
29
"""
30
- Formats a BotBuilder activity into an outgoing Slack message.
30
+ Formats a BotBuilder Activity into an outgoing Slack message.
31
+
31
32
:param activity: A BotBuilder Activity object.
32
- :return: A Slack message object with {text, attachments, channel, thread ts} as well
33
- as any fields found in activity.channelData
33
+ :type activity: :class:`botbuilder.schema.Activity`
34
+ :return: A Slack message object with {text, attachments, channel, thread ts} and any fields found in activity.channelData.
35
+ :rtype: :class:`SlackMessage`
34
36
"""
35
37
36
38
if not activity :
@@ -83,13 +85,18 @@ def response( # pylint: disable=unused-argument
83
85
req : Request , code : int , text : str = None , encoding : str = None
84
86
) -> Response :
85
87
"""
86
- Formats an aiohttp Response
87
-
88
- :param req: The original aoihttp Request
89
- :param code: The HTTP result code to return
90
- :param text: The text to return
91
- :param encoding: The text encoding. Defaults to utf-8
88
+ Formats an aiohttp Response.
89
+
90
+ :param req: The original aiohttp Request.
91
+ :type req: :class:`aiohttp.web_request.Request`
92
+ :param code: The HTTP result code to return.
93
+ :type code: int
94
+ :param text: The text to return.
95
+ :type text: str
96
+ :param encoding: The text encoding. Defaults to UTF-8.
97
+ :type encoding: str
92
98
:return: The aoihttp Response
99
+ :rtype: :class:`aiohttp.web_response.Response`
93
100
"""
94
101
95
102
response = Response (status = code )
@@ -103,10 +110,12 @@ def response( # pylint: disable=unused-argument
103
110
@staticmethod
104
111
def payload_to_activity (payload : SlackPayload ) -> Activity :
105
112
"""
106
- Creates an activity based on the slack event payload.
113
+ Creates an activity based on the Slack event payload.
107
114
108
- :param payload: The payload of the slack event.
115
+ :param payload: The payload of the Slack event.
116
+ :type payload: :class:`SlackPayload`
109
117
:return: An activity containing the event data.
118
+ :rtype: :class:`botbuilder.schema.Activity`
110
119
"""
111
120
112
121
if not payload :
@@ -138,11 +147,14 @@ def payload_to_activity(payload: SlackPayload) -> Activity:
138
147
@staticmethod
139
148
async def event_to_activity (event : SlackEvent , client : SlackClient ) -> Activity :
140
149
"""
141
- Creates an activity based on the slack event data.
150
+ Creates an activity based on the Slack event data.
142
151
143
- :param event: The data of the slack event.
152
+ :param event: The data of the Slack event.
153
+ :type event: :class:`SlackEvent`
144
154
:param client: The Slack client.
155
+ :type client: :class:`SlackClient`
145
156
:return: An activity containing the event data.
157
+ :rtype: :class:`botbuilder.schema.Activity`
146
158
"""
147
159
148
160
if not event :
@@ -191,11 +203,14 @@ async def command_to_activity(
191
203
body : SlackRequestBody , client : SlackClient
192
204
) -> Activity :
193
205
"""
194
- Creates an activity based on a slack event related to a slash command.
206
+ Creates an activity based on a Slack event related to a slash command.
195
207
196
- :param body: The data of the slack event.
208
+ :param body: The data of the Slack event.
209
+ :type body: :class:`SlackRequestBody`
197
210
:param client: The Slack client.
211
+ :type client: :class:`SlackClient`
198
212
:return: An activity containing the event data.
213
+ :rtype: :class:`botbuilder.schema.Activity`
199
214
"""
200
215
201
216
if not body :
@@ -223,7 +238,9 @@ def query_string_to_dictionary(query: str) -> {}:
223
238
Converts a query string to a dictionary with key-value pairs.
224
239
225
240
:param query: The query string to convert.
241
+ :type query: str
226
242
:return: A dictionary with the query values.
243
+ :rtype: :class:`typing.Dict`
227
244
"""
228
245
229
246
values = {}
@@ -247,9 +264,12 @@ def deserialize_body(content_type: str, request_body: str) -> SlackRequestBody:
247
264
"""
248
265
Deserializes the request's body as a SlackRequestBody object.
249
266
250
- :param content_type: The content type of the body
251
- :param request_body: The body of the request
252
- :return: A SlackRequestBody object
267
+ :param content_type: The content type of the body.
268
+ :type content_type: str
269
+ :param request_body: The body of the request.
270
+ :type request_body: str
271
+ :return: A SlackRequestBody object.
272
+ :rtype: :class:`SlackRequestBody`
253
273
"""
254
274
255
275
if not request_body :
0 commit comments