Skip to content

Commit

Permalink
Update API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Jul 12, 2022
1 parent 60c69fc commit 65e502d
Show file tree
Hide file tree
Showing 95 changed files with 1,350 additions and 4,094 deletions.
23 changes: 5 additions & 18 deletions docs/api-docs/slack_bolt/adapter/aws_lambda/chalice_handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.chalice_handler</co
def __init__(self, app: App, chalice: Chalice, lambda_client: Optional[BaseClient] = None): # type: ignore
self.app = app
self.chalice = chalice
self.logger = get_bolt_app_logger(
app.name, ChaliceSlackRequestHandler, app.logger
)
self.logger = get_bolt_app_logger(app.name, ChaliceSlackRequestHandler, app.logger)

if getenv(&#34;AWS_CHALICE_CLI_MODE&#34;) == &#34;true&#34; and lambda_client is None:
try:
Expand Down Expand Up @@ -92,10 +90,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.chalice_handler</co
bolt_req: BoltRequest = to_bolt_request(request, body)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand Down Expand Up @@ -223,9 +218,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
def __init__(self, app: App, chalice: Chalice, lambda_client: Optional[BaseClient] = None): # type: ignore
self.app = app
self.chalice = chalice
self.logger = get_bolt_app_logger(
app.name, ChaliceSlackRequestHandler, app.logger
)
self.logger = get_bolt_app_logger(app.name, ChaliceSlackRequestHandler, app.logger)

if getenv(&#34;AWS_CHALICE_CLI_MODE&#34;) == &#34;true&#34; and lambda_client is None:
try:
Expand Down Expand Up @@ -266,10 +259,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
bolt_req: BoltRequest = to_bolt_request(request, body)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand Down Expand Up @@ -340,10 +330,7 @@ <h3>Methods</h3>
bolt_req: BoltRequest = to_bolt_request(request, body)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.chalice_lazy_listen

chalice_request: dict = request.context[&#34;chalice_request&#34;]
request.headers[&#34;x-slack-bolt-lazy-only&#34;] = [&#34;1&#34;]
request.headers[&#34;x-slack-bolt-lazy-function-name&#34;] = [
request.lazy_function_name
]
request.headers[&#34;x-slack-bolt-lazy-function-name&#34;] = [request.lazy_function_name]
payload = {
&#34;method&#34;: &#34;NONE&#34;,
&#34;headers&#34;: {k: v[0] for k, v in request.headers.items()},
Expand Down Expand Up @@ -99,9 +97,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>

chalice_request: dict = request.context[&#34;chalice_request&#34;]
request.headers[&#34;x-slack-bolt-lazy-only&#34;] = [&#34;1&#34;]
request.headers[&#34;x-slack-bolt-lazy-function-name&#34;] = [
request.lazy_function_name
]
request.headers[&#34;x-slack-bolt-lazy-function-name&#34;] = [request.lazy_function_name]
payload = {
&#34;method&#34;: &#34;NONE&#34;,
&#34;headers&#34;: {k: v[0] for k, v in request.headers.items()},
Expand Down
26 changes: 8 additions & 18 deletions docs/api-docs/slack_bolt/adapter/aws_lambda/handler.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.handler</code></h1>
def __init__(self, app: App): # type: ignore
self.app = app
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler, app.logger)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(
self.logger
)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(self.logger)
if self.app.oauth_flow is not None:
self.app.oauth_flow.settings.redirect_uri_page_renderer.install_path = &#34;?&#34;

Expand All @@ -72,10 +70,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.handler</code></h1>
bolt_req: BoltRequest = to_bolt_request(event)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand All @@ -89,6 +84,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.handler</code></h1>
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = context.function_name
bolt_req.context[&#34;aws_lambda_function_name&#34;] = aws_lambda_function_name
bolt_req.context[&#34;aws_lambda_invoked_function_arn&#34;] = context.invoked_function_arn
bolt_req.context[&#34;lambda_request&#34;] = event
bolt_resp = self.app.dispatch(bolt_req)
aws_response = to_aws_response(bolt_resp)
Expand Down Expand Up @@ -229,9 +225,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
def __init__(self, app: App): # type: ignore
self.app = app
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler, app.logger)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(
self.logger
)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(self.logger)
if self.app.oauth_flow is not None:
self.app.oauth_flow.settings.redirect_uri_page_renderer.install_path = &#34;?&#34;

Expand All @@ -258,10 +252,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
bolt_req: BoltRequest = to_bolt_request(event)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand All @@ -275,6 +266,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = context.function_name
bolt_req.context[&#34;aws_lambda_function_name&#34;] = aws_lambda_function_name
bolt_req.context[&#34;aws_lambda_invoked_function_arn&#34;] = context.invoked_function_arn
bolt_req.context[&#34;lambda_request&#34;] = event
bolt_resp = self.app.dispatch(bolt_req)
aws_response = to_aws_response(bolt_resp)
Expand Down Expand Up @@ -334,10 +326,7 @@ <h3>Methods</h3>
bolt_req: BoltRequest = to_bolt_request(event)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand All @@ -351,6 +340,7 @@ <h3>Methods</h3>
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = context.function_name
bolt_req.context[&#34;aws_lambda_function_name&#34;] = aws_lambda_function_name
bolt_req.context[&#34;aws_lambda_invoked_function_arn&#34;] = context.invoked_function_arn
bolt_req.context[&#34;lambda_request&#34;] = event
bolt_resp = self.app.dispatch(bolt_req)
aws_response = to_aws_response(bolt_resp)
Expand Down
16 changes: 5 additions & 11 deletions docs/api-docs/slack_bolt/adapter/aws_lambda/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
def __init__(self, app: App): # type: ignore
self.app = app
self.logger = get_bolt_app_logger(app.name, SlackRequestHandler, app.logger)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(
self.logger
)
self.app.listener_runner.lazy_listener_runner = LambdaLazyListenerRunner(self.logger)
if self.app.oauth_flow is not None:
self.app.oauth_flow.settings.redirect_uri_page_renderer.install_path = &#34;?&#34;

Expand All @@ -116,10 +114,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
bolt_req: BoltRequest = to_bolt_request(event)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand All @@ -133,6 +128,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = context.function_name
bolt_req.context[&#34;aws_lambda_function_name&#34;] = aws_lambda_function_name
bolt_req.context[&#34;aws_lambda_invoked_function_arn&#34;] = context.invoked_function_arn
bolt_req.context[&#34;lambda_request&#34;] = event
bolt_resp = self.app.dispatch(bolt_req)
aws_response = to_aws_response(bolt_resp)
Expand Down Expand Up @@ -192,10 +188,7 @@ <h3>Methods</h3>
bolt_req: BoltRequest = to_bolt_request(event)
query = bolt_req.query
is_callback = query is not None and (
(
_first_value(query, &#34;code&#34;) is not None
and _first_value(query, &#34;state&#34;) is not None
)
(_first_value(query, &#34;code&#34;) is not None and _first_value(query, &#34;state&#34;) is not None)
or _first_value(query, &#34;error&#34;) is not None
)
if is_callback:
Expand All @@ -209,6 +202,7 @@ <h3>Methods</h3>
# https://docs.aws.amazon.com/lambda/latest/dg/python-context.html
aws_lambda_function_name = context.function_name
bolt_req.context[&#34;aws_lambda_function_name&#34;] = aws_lambda_function_name
bolt_req.context[&#34;aws_lambda_invoked_function_arn&#34;] = context.invoked_function_arn
bolt_req.context[&#34;lambda_request&#34;] = event
bolt_resp = self.app.dispatch(bolt_req)
aws_response = to_aws_response(bolt_resp)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,18 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.lambda_s3_oauth_flo
client_id=os.environ[&#34;SLACK_CLIENT_ID&#34;],
client_secret=os.environ[&#34;SLACK_CLIENT_SECRET&#34;],
)
oauth_state_bucket_name = (
oauth_state_bucket_name or os.environ[&#34;SLACK_STATE_S3_BUCKET_NAME&#34;]
)
installation_bucket_name = (
installation_bucket_name or os.environ[&#34;SLACK_INSTALLATION_S3_BUCKET_NAME&#34;]
)
oauth_state_bucket_name = oauth_state_bucket_name or os.environ[&#34;SLACK_STATE_S3_BUCKET_NAME&#34;]
installation_bucket_name = installation_bucket_name or os.environ[&#34;SLACK_INSTALLATION_S3_BUCKET_NAME&#34;]
self.s3_client = boto3.client(&#34;s3&#34;)
if settings.state_store is None or not isinstance(
settings.state_store, AmazonS3OAuthStateStore
):
if settings.state_store is None or not isinstance(settings.state_store, AmazonS3OAuthStateStore):
settings.state_store = AmazonS3OAuthStateStore(
logger=logger,
s3_client=self.s3_client,
bucket_name=oauth_state_bucket_name,
expiration_seconds=settings.state_expiration_seconds,
)

if settings.installation_store is None or not isinstance(
settings.installation_store, AmazonS3InstallationStore
):
if settings.installation_store is None or not isinstance(settings.installation_store, AmazonS3InstallationStore):
settings.installation_store = AmazonS3InstallationStore(
logger=logger,
s3_client=self.s3_client,
Expand Down Expand Up @@ -155,26 +147,18 @@ <h2 id="args">Args</h2>
client_id=os.environ[&#34;SLACK_CLIENT_ID&#34;],
client_secret=os.environ[&#34;SLACK_CLIENT_SECRET&#34;],
)
oauth_state_bucket_name = (
oauth_state_bucket_name or os.environ[&#34;SLACK_STATE_S3_BUCKET_NAME&#34;]
)
installation_bucket_name = (
installation_bucket_name or os.environ[&#34;SLACK_INSTALLATION_S3_BUCKET_NAME&#34;]
)
oauth_state_bucket_name = oauth_state_bucket_name or os.environ[&#34;SLACK_STATE_S3_BUCKET_NAME&#34;]
installation_bucket_name = installation_bucket_name or os.environ[&#34;SLACK_INSTALLATION_S3_BUCKET_NAME&#34;]
self.s3_client = boto3.client(&#34;s3&#34;)
if settings.state_store is None or not isinstance(
settings.state_store, AmazonS3OAuthStateStore
):
if settings.state_store is None or not isinstance(settings.state_store, AmazonS3OAuthStateStore):
settings.state_store = AmazonS3OAuthStateStore(
logger=logger,
s3_client=self.s3_client,
bucket_name=oauth_state_bucket_name,
expiration_seconds=settings.state_expiration_seconds,
)

if settings.installation_store is None or not isinstance(
settings.installation_store, AmazonS3InstallationStore
):
if settings.installation_store is None or not isinstance(settings.installation_store, AmazonS3InstallationStore):
settings.installation_store = AmazonS3InstallationStore(
logger=logger,
s3_client=self.s3_client,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,10 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.lazy_listener_runne
event: dict = request.context[&#34;lambda_request&#34;]
headers = event[&#34;headers&#34;]
headers[&#34;x-slack-bolt-lazy-only&#34;] = &#34;1&#34; # not an array
headers[
&#34;x-slack-bolt-lazy-function-name&#34;
] = request.lazy_function_name # not an array
headers[&#34;x-slack-bolt-lazy-function-name&#34;] = request.lazy_function_name # not an array
event[&#34;method&#34;] = &#34;NONE&#34;
invocation = self.lambda_client.invoke(
FunctionName=request.context[&#34;aws_lambda_function_name&#34;],
FunctionName=request.context[&#34;aws_lambda_invoked_function_arn&#34;],
InvocationType=&#34;Event&#34;,
Payload=json.dumps(event),
)
Expand Down Expand Up @@ -91,12 +89,10 @@ <h2 class="section-title" id="header-classes">Classes</h2>
event: dict = request.context[&#34;lambda_request&#34;]
headers = event[&#34;headers&#34;]
headers[&#34;x-slack-bolt-lazy-only&#34;] = &#34;1&#34; # not an array
headers[
&#34;x-slack-bolt-lazy-function-name&#34;
] = request.lazy_function_name # not an array
headers[&#34;x-slack-bolt-lazy-function-name&#34;] = request.lazy_function_name # not an array
event[&#34;method&#34;] = &#34;NONE&#34;
invocation = self.lambda_client.invoke(
FunctionName=request.context[&#34;aws_lambda_function_name&#34;],
FunctionName=request.context[&#34;aws_lambda_invoked_function_arn&#34;],
InvocationType=&#34;Event&#34;,
Payload=json.dumps(event),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,7 @@ <h1 class="title">Module <code>slack_bolt.adapter.aws_lambda.local_lambda_client
Payload: str = &#34;{}&#34;,
) -&gt; InvokeResponse:
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
lambda_context = LambdaContext(
FunctionName, memory_size=scoped.lambda_memory_size
)
lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)

with self._patched_env_vars(scoped.environment_variables):
response = self._app(json.loads(Payload), lambda_context)
Expand Down Expand Up @@ -89,9 +87,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
Payload: str = &#34;{}&#34;,
) -&gt; InvokeResponse:
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
lambda_context = LambdaContext(
FunctionName, memory_size=scoped.lambda_memory_size
)
lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)

with self._patched_env_vars(scoped.environment_variables):
response = self._app(json.loads(Payload), lambda_context)
Expand Down Expand Up @@ -119,9 +115,7 @@ <h3>Methods</h3>
Payload: str = &#34;{}&#34;,
) -&gt; InvokeResponse:
scoped = self._config.scope(self._config.chalice_stage, FunctionName)
lambda_context = LambdaContext(
FunctionName, memory_size=scoped.lambda_memory_size
)
lambda_context = LambdaContext(FunctionName, memory_size=scoped.lambda_memory_size)

with self._patched_env_vars(scoped.environment_variables):
response = self._app(json.loads(Payload), lambda_context)
Expand Down
Loading

0 comments on commit 65e502d

Please sign in to comment.