Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default to CallbackOptions handler args #138

Merged
merged 1 commit into from
Nov 2, 2020

Conversation

seratch
Copy link
Member

@seratch seratch commented Nov 2, 2020

This pull request resolves #137 by providing the access to the DefaultCallbackOptions handlers in callback options. As mentioned in the issue #137, this arg is greatly useful for developers that would like to reuse redirect_uri_page_renderer and so on in callback_options handlers.

def success(args: SuccessArgs) -> BoltResponse:
    # Do anything here ...

    # Call the default handler to return HTTP response
    return args.default.success(args)

def failure(args: FailureArgs) -> BoltResponse:
    # Do anything here ...

    # Call the default handler to return HTTP response
    return args.default.failure(args)

app = App(
    oauth_settings=OAuthSettings(
        callback_options=CallbackOptions(success=success, failure=failure),
    ),
)

Category (place an x in each of the [ ])

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@seratch seratch added enhancement New feature or request area:async area:sync labels Nov 2, 2020
@seratch seratch added this to the 1.0.0 (GA) milestone Nov 2, 2020
@seratch seratch self-assigned this Nov 2, 2020
Copy link

@jensenbox jensenbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good and gets much closer. I think I may be asking another PR for adding additional data to the BoltRequest as well - there are things that the conversion from HttpRequest to a BoltRequest that gets lost that are needed for connecting to accounts on the application side but this gets much closer.

@seratch
Copy link
Member Author

seratch commented Nov 2, 2020

adding additional data to the BoltRequest as well - there are things that the conversion from HttpRequest to a BoltRequest

We are not planning to add any custom fields to BoltRequest. You can use request.context and it's a dict. So, you can set any additional fields to it.

@seratch seratch merged commit 31599be into slackapi:main Nov 2, 2020
@seratch seratch deleted the default-to-callback-options-args branch November 2, 2020 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document how to override the success handler on CallbackOptions
3 participants