Skip to content

Commit 7b692e8

Browse files
committed
Update API documents
1 parent 4c8b33f commit 7b692e8

File tree

8 files changed

+198
-35
lines changed

8 files changed

+198
-35
lines changed

docs/api-docs/slack_bolt/authorization/async_authorize.html

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ <h1 class="title">Module <code>slack_bolt.authorization.async_authorize</code></
4444

4545

4646
class AsyncAuthorize:
47+
&#34;&#34;&#34;This provides authorize function that returns AuthorizeResult
48+
for an incoming request from Slack.&#34;&#34;&#34;
49+
4750
def __init__(self):
4851
pass
4952

@@ -59,6 +62,10 @@ <h1 class="title">Module <code>slack_bolt.authorization.async_authorize</code></
5962

6063

6164
class AsyncCallableAuthorize(AsyncAuthorize):
65+
&#34;&#34;&#34;When you pass the authorize argument in AsyncApp constructor,
66+
This authorize implementation will be used.
67+
&#34;&#34;&#34;
68+
6269
def __init__(
6370
self, *, logger: Logger, func: Callable[..., Awaitable[AuthorizeResult]]
6471
):
@@ -121,6 +128,11 @@ <h1 class="title">Module <code>slack_bolt.authorization.async_authorize</code></
121128

122129

123130
class AsyncInstallationStoreAuthorize(AsyncAuthorize):
131+
&#34;&#34;&#34;If you use the OAuth flow settings, this authorize implementation will be used.
132+
As long as your own InstallationStore (or the built-in ones) works as you expect,
133+
you can expect that the authorize layer should work for you without any customization.
134+
&#34;&#34;&#34;
135+
124136
authorize_result_cache: Dict[str, AuthorizeResult]
125137
find_installation_available: Optional[bool]
126138
find_bot_available: Optional[bool]
@@ -325,12 +337,16 @@ <h2 class="section-title" id="header-classes">Classes</h2>
325337
<span>class <span class="ident">AsyncAuthorize</span></span>
326338
</code></dt>
327339
<dd>
328-
<div class="desc"></div>
340+
<div class="desc"><p>This provides authorize function that returns AuthorizeResult
341+
for an incoming request from Slack.</p></div>
329342
<details class="source">
330343
<summary>
331344
<span>Expand source code</span>
332345
</summary>
333346
<pre><code class="python">class AsyncAuthorize:
347+
&#34;&#34;&#34;This provides authorize function that returns AuthorizeResult
348+
for an incoming request from Slack.&#34;&#34;&#34;
349+
334350
def __init__(self):
335351
pass
336352

@@ -355,12 +371,17 @@ <h3>Subclasses</h3>
355371
<span>(</span><span>*, logger: logging.Logger, func: Callable[..., Awaitable[<a title="slack_bolt.authorization.authorize_result.AuthorizeResult" href="authorize_result.html#slack_bolt.authorization.authorize_result.AuthorizeResult">AuthorizeResult</a>]])</span>
356372
</code></dt>
357373
<dd>
358-
<div class="desc"></div>
374+
<div class="desc"><p>When you pass the authorize argument in AsyncApp constructor,
375+
This authorize implementation will be used.</p></div>
359376
<details class="source">
360377
<summary>
361378
<span>Expand source code</span>
362379
</summary>
363380
<pre><code class="python">class AsyncCallableAuthorize(AsyncAuthorize):
381+
&#34;&#34;&#34;When you pass the authorize argument in AsyncApp constructor,
382+
This authorize implementation will be used.
383+
&#34;&#34;&#34;
384+
364385
def __init__(
365386
self, *, logger: Logger, func: Callable[..., Awaitable[AuthorizeResult]]
366387
):
@@ -431,12 +452,19 @@ <h3>Ancestors</h3>
431452
<span>(</span><span>*, logger: logging.Logger, installation_store: slack_sdk.oauth.installation_store.async_installation_store.AsyncInstallationStore, client_id: Optional[str] = None, client_secret: Optional[str] = None, token_rotation_expiration_minutes: Optional[int] = None, bot_only: bool = False, cache_enabled: bool = False)</span>
432453
</code></dt>
433454
<dd>
434-
<div class="desc"></div>
455+
<div class="desc"><p>If you use the OAuth flow settings, this authorize implementation will be used.
456+
As long as your own InstallationStore (or the built-in ones) works as you expect,
457+
you can expect that the authorize layer should work for you without any customization.</p></div>
435458
<details class="source">
436459
<summary>
437460
<span>Expand source code</span>
438461
</summary>
439462
<pre><code class="python">class AsyncInstallationStoreAuthorize(AsyncAuthorize):
463+
&#34;&#34;&#34;If you use the OAuth flow settings, this authorize implementation will be used.
464+
As long as your own InstallationStore (or the built-in ones) works as you expect,
465+
you can expect that the authorize layer should work for you without any customization.
466+
&#34;&#34;&#34;
467+
440468
authorize_result_cache: Dict[str, AuthorizeResult]
441469
find_installation_available: Optional[bool]
442470
find_bot_available: Optional[bool]

docs/api-docs/slack_bolt/authorization/authorize.html

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ <h1 class="title">Module <code>slack_bolt.authorization.authorize</code></h1>
2727
<span>Expand source code</span>
2828
</summary>
2929
<pre><code class="python">import inspect
30-
import os
3130
from logging import Logger
3231
from typing import Optional, Callable, Dict, Any
3332

@@ -44,6 +43,9 @@ <h1 class="title">Module <code>slack_bolt.authorization.authorize</code></h1>
4443

4544

4645
class Authorize:
46+
&#34;&#34;&#34;This provides authorize function that returns AuthorizeResult
47+
for an incoming request from Slack.&#34;&#34;&#34;
48+
4749
def __init__(self):
4850
pass
4951

@@ -59,6 +61,10 @@ <h1 class="title">Module <code>slack_bolt.authorization.authorize</code></h1>
5961

6062

6163
class CallableAuthorize(Authorize):
64+
&#34;&#34;&#34;When you pass the authorize argument in AsyncApp constructor,
65+
This authorize implementation will be used.
66+
&#34;&#34;&#34;
67+
6268
def __init__(
6369
self,
6470
*,
@@ -124,6 +130,11 @@ <h1 class="title">Module <code>slack_bolt.authorization.authorize</code></h1>
124130

125131

126132
class InstallationStoreAuthorize(Authorize):
133+
&#34;&#34;&#34;If you use the OAuth flow settings, this authorize implementation will be used.
134+
As long as your own InstallationStore (or the built-in ones) works as you expect,
135+
you can expect that the authorize layer should work for you without any customization.
136+
&#34;&#34;&#34;
137+
127138
authorize_result_cache: Dict[str, AuthorizeResult]
128139
bot_only: bool
129140
find_installation_available: bool
@@ -322,12 +333,16 @@ <h2 class="section-title" id="header-classes">Classes</h2>
322333
<span>class <span class="ident">Authorize</span></span>
323334
</code></dt>
324335
<dd>
325-
<div class="desc"></div>
336+
<div class="desc"><p>This provides authorize function that returns AuthorizeResult
337+
for an incoming request from Slack.</p></div>
326338
<details class="source">
327339
<summary>
328340
<span>Expand source code</span>
329341
</summary>
330342
<pre><code class="python">class Authorize:
343+
&#34;&#34;&#34;This provides authorize function that returns AuthorizeResult
344+
for an incoming request from Slack.&#34;&#34;&#34;
345+
331346
def __init__(self):
332347
pass
333348

@@ -352,12 +367,17 @@ <h3>Subclasses</h3>
352367
<span>(</span><span>*, logger: logging.Logger, func: Callable[..., <a title="slack_bolt.authorization.authorize_result.AuthorizeResult" href="authorize_result.html#slack_bolt.authorization.authorize_result.AuthorizeResult">AuthorizeResult</a>])</span>
353368
</code></dt>
354369
<dd>
355-
<div class="desc"></div>
370+
<div class="desc"><p>When you pass the authorize argument in AsyncApp constructor,
371+
This authorize implementation will be used.</p></div>
356372
<details class="source">
357373
<summary>
358374
<span>Expand source code</span>
359375
</summary>
360376
<pre><code class="python">class CallableAuthorize(Authorize):
377+
&#34;&#34;&#34;When you pass the authorize argument in AsyncApp constructor,
378+
This authorize implementation will be used.
379+
&#34;&#34;&#34;
380+
361381
def __init__(
362382
self,
363383
*,
@@ -431,12 +451,19 @@ <h3>Ancestors</h3>
431451
<span>(</span><span>*, logger: logging.Logger, installation_store: slack_sdk.oauth.installation_store.installation_store.InstallationStore, client_id: Optional[str] = None, client_secret: Optional[str] = None, token_rotation_expiration_minutes: Optional[int] = None, bot_only: bool = False, cache_enabled: bool = False)</span>
432452
</code></dt>
433453
<dd>
434-
<div class="desc"></div>
454+
<div class="desc"><p>If you use the OAuth flow settings, this authorize implementation will be used.
455+
As long as your own InstallationStore (or the built-in ones) works as you expect,
456+
you can expect that the authorize layer should work for you without any customization.</p></div>
435457
<details class="source">
436458
<summary>
437459
<span>Expand source code</span>
438460
</summary>
439461
<pre><code class="python">class InstallationStoreAuthorize(Authorize):
462+
&#34;&#34;&#34;If you use the OAuth flow settings, this authorize implementation will be used.
463+
As long as your own InstallationStore (or the built-in ones) works as you expect,
464+
you can expect that the authorize layer should work for you without any customization.
465+
&#34;&#34;&#34;
466+
440467
authorize_result_cache: Dict[str, AuthorizeResult]
441468
bot_only: bool
442469
find_installation_available: bool

docs/api-docs/slack_bolt/middleware/authorization/async_multi_teams_authorization.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,13 @@ <h1 class="title">Module <code>slack_bolt.middleware.authorization.async_multi_t
9090
req.context.client.token = token
9191
return await next()
9292
else:
93-
# Just in case
94-
self.logger.error(&#34;auth.test API call result is unexpectedly None&#34;)
93+
# This situation can arise if:
94+
# * A developer installed the app from the &#34;Install to Workspace&#34; button in Slack app config page
95+
# * The InstallationStore failed to save or deleted the installation for this workspace
96+
self.logger.error(
97+
&#34;Although the app should be installed into this workspace, &#34;
98+
&#34;the AuthorizeResult (returned value from authorize) for it was not found.&#34;
99+
)
95100
return _build_error_response()
96101

97102
except SlackApiError as e:
@@ -175,8 +180,13 @@ <h2 id="args">Args</h2>
175180
req.context.client.token = token
176181
return await next()
177182
else:
178-
# Just in case
179-
self.logger.error(&#34;auth.test API call result is unexpectedly None&#34;)
183+
# This situation can arise if:
184+
# * A developer installed the app from the &#34;Install to Workspace&#34; button in Slack app config page
185+
# * The InstallationStore failed to save or deleted the installation for this workspace
186+
self.logger.error(
187+
&#34;Although the app should be installed into this workspace, &#34;
188+
&#34;the AuthorizeResult (returned value from authorize) for it was not found.&#34;
189+
)
180190
return _build_error_response()
181191

182192
except SlackApiError as e:

docs/api-docs/slack_bolt/middleware/authorization/multi_teams_authorization.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ <h1 class="title">Module <code>slack_bolt.middleware.authorization.multi_teams_a
9595
req.context.client.token = token
9696
return next()
9797
else:
98-
# Just in case
99-
self.logger.error(&#34;auth.test API call result is unexpectedly None&#34;)
98+
# This situation can arise if:
99+
# * A developer installed the app from the &#34;Install to Workspace&#34; button in Slack app config page
100+
# * The InstallationStore failed to save or deleted the installation for this workspace
101+
self.logger.error(
102+
&#34;Although the app should be installed into this workspace, &#34;
103+
&#34;the AuthorizeResult (returned value from authorize) for it was not found.&#34;
104+
)
100105
return _build_error_response()
101106

102107
except SlackApiError as e:
@@ -181,8 +186,13 @@ <h2 id="args">Args</h2>
181186
req.context.client.token = token
182187
return next()
183188
else:
184-
# Just in case
185-
self.logger.error(&#34;auth.test API call result is unexpectedly None&#34;)
189+
# This situation can arise if:
190+
# * A developer installed the app from the &#34;Install to Workspace&#34; button in Slack app config page
191+
# * The InstallationStore failed to save or deleted the installation for this workspace
192+
self.logger.error(
193+
&#34;Although the app should be installed into this workspace, &#34;
194+
&#34;the AuthorizeResult (returned value from authorize) for it was not found.&#34;
195+
)
186196
return _build_error_response()
187197

188198
except SlackApiError as e:

docs/api-docs/slack_bolt/oauth/async_oauth_settings.html

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,24 @@ <h1 class="title">Module <code>slack_bolt.oauth.async_oauth_settings</code></h1>
146146
self.client_id = client_id
147147
self.client_secret = client_secret
148148

149-
self.scopes = scopes or os.environ.get(&#34;SLACK_SCOPES&#34;, &#34;&#34;).split(&#34;,&#34;)
149+
# NOTE: pytype says that self.scopes can be str, not Sequence[str].
150+
# That&#39;s true but we will check the pattern in the following if statement.
151+
# Thus, we ignore the warnings here. This is the same for user_scopes too.
152+
self.scopes = ( # type: ignore
153+
scopes # type: ignore
154+
if scopes is not None
155+
else os.environ.get(&#34;SLACK_SCOPES&#34;, &#34;&#34;).split(&#34;,&#34;) # type: ignore
156+
) # type: ignore
150157
if isinstance(self.scopes, str):
151158
self.scopes = self.scopes.split(&#34;,&#34;)
152-
self.user_scopes = user_scopes or os.environ.get(&#34;SLACK_USER_SCOPES&#34;, &#34;&#34;).split(
153-
&#34;,&#34;
154-
)
159+
self.user_scopes = ( # type: ignore
160+
user_scopes
161+
if user_scopes is not None
162+
else os.environ.get(&#34;SLACK_USER_SCOPES&#34;, &#34;&#34;).split(&#34;,&#34;) # type: ignore
163+
) # type: ignore
155164
if isinstance(self.user_scopes, str):
156165
self.user_scopes = self.user_scopes.split(&#34;,&#34;)
166+
157167
self.redirect_uri = redirect_uri or os.environ.get(&#34;SLACK_REDIRECT_URI&#34;)
158168
# Handler configuration
159169
self.install_path = install_path or os.environ.get(
@@ -368,14 +378,24 @@ <h2 id="args">Args</h2>
368378
self.client_id = client_id
369379
self.client_secret = client_secret
370380

371-
self.scopes = scopes or os.environ.get(&#34;SLACK_SCOPES&#34;, &#34;&#34;).split(&#34;,&#34;)
381+
# NOTE: pytype says that self.scopes can be str, not Sequence[str].
382+
# That&#39;s true but we will check the pattern in the following if statement.
383+
# Thus, we ignore the warnings here. This is the same for user_scopes too.
384+
self.scopes = ( # type: ignore
385+
scopes # type: ignore
386+
if scopes is not None
387+
else os.environ.get(&#34;SLACK_SCOPES&#34;, &#34;&#34;).split(&#34;,&#34;) # type: ignore
388+
) # type: ignore
372389
if isinstance(self.scopes, str):
373390
self.scopes = self.scopes.split(&#34;,&#34;)
374-
self.user_scopes = user_scopes or os.environ.get(&#34;SLACK_USER_SCOPES&#34;, &#34;&#34;).split(
375-
&#34;,&#34;
376-
)
391+
self.user_scopes = ( # type: ignore
392+
user_scopes
393+
if user_scopes is not None
394+
else os.environ.get(&#34;SLACK_USER_SCOPES&#34;, &#34;&#34;).split(&#34;,&#34;) # type: ignore
395+
) # type: ignore
377396
if isinstance(self.user_scopes, str):
378397
self.user_scopes = self.user_scopes.split(&#34;,&#34;)
398+
379399
self.redirect_uri = redirect_uri or os.environ.get(&#34;SLACK_REDIRECT_URI&#34;)
380400
# Handler configuration
381401
self.install_path = install_path or os.environ.get(

0 commit comments

Comments
 (0)