Skip to content

Commit

Permalink
version 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Jun 3, 2021
1 parent e6079cd commit 0b28dfe
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 34 deletions.
17 changes: 16 additions & 1 deletion docs/api-docs/slack_bolt/adapter/aws_lambda/handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.handler</code></h1>


def to_bolt_request(event) -&gt; BoltRequest:
&#34;&#34;&#34;Note that this handler supports only the payload format 2.0.
This means you can use this with HTTP API while REST API is not supported.

Read https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
for more details.
&#34;&#34;&#34;
body = event.get(&#34;body&#34;, &#34;&#34;)
if event[&#34;isBase64Encoded&#34;]:
body = base64.b64decode(body).decode(&#34;utf-8&#34;)
Expand Down Expand Up @@ -177,12 +183,21 @@ <h2 class="section-title" id="header-functions">Functions</h2>
<span>def <span class="ident">to_bolt_request</span></span>(<span>event) ‑> <a title="slack_bolt.request.request.BoltRequest" href="../../request/request.html#slack_bolt.request.request.BoltRequest">BoltRequest</a></span>
</code></dt>
<dd>
<div class="desc"></div>
<div class="desc"><p>Note that this handler supports only the payload format 2.0.
This means you can use this with HTTP API while REST API is not supported.</p>
<p>Read <a href="https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html">https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html</a>
for more details.</p></div>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def to_bolt_request(event) -&gt; BoltRequest:
&#34;&#34;&#34;Note that this handler supports only the payload format 2.0.
This means you can use this with HTTP API while REST API is not supported.

Read https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
for more details.
&#34;&#34;&#34;
body = event.get(&#34;body&#34;, &#34;&#34;)
if event[&#34;isBase64Encoded&#34;]:
body = base64.b64decode(body).decode(&#34;utf-8&#34;)
Expand Down
8 changes: 8 additions & 0 deletions docs/api-docs/slack_bolt/context/ack/ack.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ <h1 class="title">Module <code>slack_bolt.context.ack.ack</code></h1>
text: Union[str, dict] = &#34;&#34;, # text: str or whole_response: dict
blocks: Optional[Sequence[Union[dict, Block]]] = None,
attachments: Optional[Sequence[Union[dict, Attachment]]] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
response_type: Optional[str] = None, # in_channel / ephemeral
# block_suggestion / dialog_suggestion
options: Optional[Sequence[Union[dict, Option]]] = None,
Expand All @@ -61,6 +63,8 @@ <h1 class="title">Module <code>slack_bolt.context.ack.ack</code></h1>
text_or_whole_response=text,
blocks=blocks,
attachments=attachments,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
response_type=response_type,
options=options,
option_groups=option_groups,
Expand Down Expand Up @@ -99,6 +103,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
text: Union[str, dict] = &#34;&#34;, # text: str or whole_response: dict
blocks: Optional[Sequence[Union[dict, Block]]] = None,
attachments: Optional[Sequence[Union[dict, Attachment]]] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
response_type: Optional[str] = None, # in_channel / ephemeral
# block_suggestion / dialog_suggestion
options: Optional[Sequence[Union[dict, Option]]] = None,
Expand All @@ -113,6 +119,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
text_or_whole_response=text,
blocks=blocks,
attachments=attachments,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
response_type=response_type,
options=options,
option_groups=option_groups,
Expand Down
8 changes: 8 additions & 0 deletions docs/api-docs/slack_bolt/context/ack/async_ack.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ <h1 class="title">Module <code>slack_bolt.context.ack.async_ack</code></h1>
text: Union[str, dict] = &#34;&#34;, # text: str or whole_response: dict
blocks: Optional[Sequence[Union[dict, Block]]] = None,
attachments: Optional[Sequence[Union[dict, Attachment]]] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
response_type: Optional[str] = None, # in_channel / ephemeral
# block_suggestion / dialog_suggestion
options: Optional[Sequence[Union[dict, Option]]] = None,
Expand All @@ -61,6 +63,8 @@ <h1 class="title">Module <code>slack_bolt.context.ack.async_ack</code></h1>
text_or_whole_response=text,
blocks=blocks,
attachments=attachments,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
response_type=response_type,
options=options,
option_groups=option_groups,
Expand Down Expand Up @@ -99,6 +103,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
text: Union[str, dict] = &#34;&#34;, # text: str or whole_response: dict
blocks: Optional[Sequence[Union[dict, Block]]] = None,
attachments: Optional[Sequence[Union[dict, Attachment]]] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
response_type: Optional[str] = None, # in_channel / ephemeral
# block_suggestion / dialog_suggestion
options: Optional[Sequence[Union[dict, Option]]] = None,
Expand All @@ -113,6 +119,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
text_or_whole_response=text,
blocks=blocks,
attachments=attachments,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
response_type=response_type,
options=options,
option_groups=option_groups,
Expand Down
6 changes: 6 additions & 0 deletions docs/api-docs/slack_bolt/context/ack/internals.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ <h1 class="title">Module <code>slack_bolt.context.ack.internals</code></h1>
text_or_whole_response: Union[str, dict] = &#34;&#34;,
blocks: Optional[Sequence[Union[dict, Block]]] = None,
attachments: Optional[Sequence[Union[dict, Attachment]]] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
response_type: Optional[str] = None, # in_channel / ephemeral
# block_suggestion / dialog_suggestion
options: Optional[Sequence[Union[dict, Option]]] = None,
Expand All @@ -56,6 +58,10 @@ <h1 class="title">Module <code>slack_bolt.context.ack.internals</code></h1>
body = {&#34;text&#34;: text}
if response_type:
body[&#34;response_type&#34;] = response_type
if unfurl_links is not None:
body[&#34;unfurl_links&#34;] = unfurl_links
if unfurl_media is not None:
body[&#34;unfurl_media&#34;] = unfurl_media
if attachments and len(attachments) &gt; 0:
body.update(
{&#34;text&#34;: text, &#34;attachments&#34;: convert_to_dict_list(attachments)}
Expand Down
8 changes: 8 additions & 0 deletions docs/api-docs/slack_bolt/context/respond/async_respond.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ <h1 class="title">Module <code>slack_bolt.context.respond.async_respond</code></
response_type: Optional[str] = None,
replace_original: Optional[bool] = None,
delete_original: Optional[bool] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
) -&gt; WebhookResponse:
if self.response_url is not None:
client = AsyncWebhookClient(self.response_url)
Expand All @@ -61,6 +63,8 @@ <h1 class="title">Module <code>slack_bolt.context.respond.async_respond</code></
response_type=response_type,
replace_original=replace_original,
delete_original=delete_original,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
)
return await client.send_dict(message)
elif isinstance(text_or_whole_response, dict):
Expand Down Expand Up @@ -106,6 +110,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
response_type: Optional[str] = None,
replace_original: Optional[bool] = None,
delete_original: Optional[bool] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
) -&gt; WebhookResponse:
if self.response_url is not None:
client = AsyncWebhookClient(self.response_url)
Expand All @@ -118,6 +124,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
response_type=response_type,
replace_original=replace_original,
delete_original=delete_original,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
)
return await client.send_dict(message)
elif isinstance(text_or_whole_response, dict):
Expand Down
6 changes: 6 additions & 0 deletions docs/api-docs/slack_bolt/context/respond/internals.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ <h1 class="title">Module <code>slack_bolt.context.respond.internals</code></h1>
response_type: Optional[str] = None,
replace_original: Optional[bool] = None,
delete_original: Optional[bool] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
) -&gt; Dict[str, Any]:
message = {&#34;text&#34;: text}
if blocks is not None and len(blocks) &gt; 0:
Expand All @@ -53,6 +55,10 @@ <h1 class="title">Module <code>slack_bolt.context.respond.internals</code></h1>
message[&#34;replace_original&#34;] = replace_original
if delete_original is not None:
message[&#34;delete_original&#34;] = delete_original
if unfurl_links is not None:
message[&#34;unfurl_links&#34;] = unfurl_links
if unfurl_media is not None:
message[&#34;unfurl_media&#34;] = unfurl_media
return message</code></pre>
</details>
</section>
Expand Down
8 changes: 8 additions & 0 deletions docs/api-docs/slack_bolt/context/respond/respond.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ <h1 class="title">Module <code>slack_bolt.context.respond.respond</code></h1>
response_type: Optional[str] = None,
replace_original: Optional[bool] = None,
delete_original: Optional[bool] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
) -&gt; WebhookResponse:
if self.response_url is not None:
client = WebhookClient(self.response_url)
Expand All @@ -62,6 +64,8 @@ <h1 class="title">Module <code>slack_bolt.context.respond.respond</code></h1>
response_type=response_type,
replace_original=replace_original,
delete_original=delete_original,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
)
return client.send_dict(message)
elif isinstance(text_or_whole_response, dict):
Expand Down Expand Up @@ -108,6 +112,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
response_type: Optional[str] = None,
replace_original: Optional[bool] = None,
delete_original: Optional[bool] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
) -&gt; WebhookResponse:
if self.response_url is not None:
client = WebhookClient(self.response_url)
Expand All @@ -121,6 +127,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
response_type=response_type,
replace_original=replace_original,
delete_original=delete_original,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
)
return client.send_dict(message)
elif isinstance(text_or_whole_response, dict):
Expand Down
8 changes: 8 additions & 0 deletions docs/api-docs/slack_bolt/context/say/async_say.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ <h1 class="title">Module <code>slack_bolt.context.say.async_say</code></h1>
attachments: Optional[Sequence[Union[Dict, Attachment]]] = None,
channel: Optional[str] = None,
thread_ts: Optional[str] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
**kwargs,
) -&gt; AsyncSlackResponse:
if _can_say(self, channel):
Expand All @@ -66,6 +68,8 @@ <h1 class="title">Module <code>slack_bolt.context.say.async_say</code></h1>
blocks=blocks,
attachments=attachments,
thread_ts=thread_ts,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
**kwargs,
)
elif isinstance(text_or_whole_response, dict):
Expand Down Expand Up @@ -119,6 +123,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
attachments: Optional[Sequence[Union[Dict, Attachment]]] = None,
channel: Optional[str] = None,
thread_ts: Optional[str] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
**kwargs,
) -&gt; AsyncSlackResponse:
if _can_say(self, channel):
Expand All @@ -131,6 +137,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
blocks=blocks,
attachments=attachments,
thread_ts=thread_ts,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
**kwargs,
)
elif isinstance(text_or_whole_response, dict):
Expand Down
8 changes: 8 additions & 0 deletions docs/api-docs/slack_bolt/context/say/say.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ <h1 class="title">Module <code>slack_bolt.context.say.say</code></h1>
attachments: Optional[Sequence[Union[Dict, Attachment]]] = None,
channel: Optional[str] = None,
thread_ts: Optional[str] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
**kwargs,
) -&gt; SlackResponse:
if _can_say(self, channel):
Expand All @@ -67,6 +69,8 @@ <h1 class="title">Module <code>slack_bolt.context.say.say</code></h1>
blocks=blocks,
attachments=attachments,
thread_ts=thread_ts,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
**kwargs,
)
elif isinstance(text_or_whole_response, dict):
Expand Down Expand Up @@ -120,6 +124,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
attachments: Optional[Sequence[Union[Dict, Attachment]]] = None,
channel: Optional[str] = None,
thread_ts: Optional[str] = None,
unfurl_links: Optional[bool] = None,
unfurl_media: Optional[bool] = None,
**kwargs,
) -&gt; SlackResponse:
if _can_say(self, channel):
Expand All @@ -132,6 +138,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
blocks=blocks,
attachments=attachments,
thread_ts=thread_ts,
unfurl_links=unfurl_links,
unfurl_media=unfurl_media,
**kwargs,
)
elif isinstance(text_or_whole_response, dict):
Expand Down
2 changes: 1 addition & 1 deletion docs/api-docs/slack_bolt/kwargs_injection/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<meta name="generator" content="pdoc 0.9.2" />
<title>slack_bolt.the API documentation</title>
<title>slack_bolt.kwargs_injection API documentation</title>
<meta name="description" content="For middleware/listener arguments, Bolt does flexible data injection in accordance with their names …" />
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/sanitize.min.css" integrity="sha256-PK9q560IAAa6WVRRh76LtCaI8pjTJ2z11v0miyNNjrs=" crossorigin>
<link rel="preload stylesheet" as="style" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/11.0.1/typography.min.css" integrity="sha256-7l/o7C8jubJiy74VsKTidCy1yBkRtiUGbVkYBylBqUg=" crossorigin>
Expand Down
13 changes: 8 additions & 5 deletions docs/api-docs/slack_bolt/request/async_request.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ <h1 class="title">Module <code>slack_bolt.request.async_request</code></h1>
build_normalized_headers,
extract_content_type,
error_message_raw_body_required_in_http_mode,
error_message_unknown_request_body_type,
)


Expand Down Expand Up @@ -73,7 +72,7 @@ <h1 class="title">Module <code>slack_bolt.request.async_request</code></h1>

if mode == &#34;http&#34;:
# HTTP Mode
if not isinstance(body, str):
if body is not None and not isinstance(body, str):
raise BoltError(error_message_raw_body_required_in_http_mode())
self.raw_body = body if body is not None else &#34;&#34;
else:
Expand All @@ -88,12 +87,14 @@ <h1 class="title">Module <code>slack_bolt.request.async_request</code></h1>
self.query = parse_query(query)
self.headers = build_normalized_headers(headers)
self.content_type = extract_content_type(self.headers)

if isinstance(body, str):
self.body = parse_body(self.raw_body, self.content_type)
elif isinstance(body, dict):
self.body = body
else:
raise BoltError(error_message_unknown_request_body_type())
self.body = {}

self.context = build_async_context(
AsyncBoltContext(context if context else {}), self.body
)
Expand Down Expand Up @@ -168,7 +169,7 @@ <h2 id="args">Args</h2>

if mode == &#34;http&#34;:
# HTTP Mode
if not isinstance(body, str):
if body is not None and not isinstance(body, str):
raise BoltError(error_message_raw_body_required_in_http_mode())
self.raw_body = body if body is not None else &#34;&#34;
else:
Expand All @@ -183,12 +184,14 @@ <h2 id="args">Args</h2>
self.query = parse_query(query)
self.headers = build_normalized_headers(headers)
self.content_type = extract_content_type(self.headers)

if isinstance(body, str):
self.body = parse_body(self.raw_body, self.content_type)
elif isinstance(body, dict):
self.body = body
else:
raise BoltError(error_message_unknown_request_body_type())
self.body = {}

self.context = build_async_context(
AsyncBoltContext(context if context else {}), self.body
)
Expand Down
Loading

0 comments on commit 0b28dfe

Please sign in to comment.