slack icon indicating copy to clipboard operation
slack copied to clipboard

Include GetOAuth* methods in Client's method set

Open vibridi opened this issue 5 years ago • 2 comments

Fixes #744 .

This PR moves the previously static GetOAuth* methods into Client's method set. This permits to use the configurable API endpoint instead of the global constant, and the existing HTTP client that is set on the Client.

This PR currently doesn't include unit tests, as no such tests existed before either. Please advise if you want me to add tests.

Note: this PR breaks backwards compatibility.

Verification please.

vibridi avatar Sep 22 '20 10:09 vibridi

Thank you for your PR.

I agree that the testability is low due to the dependency on APIURL constant value, but this function itself does not seem to be a feature that slack.Client should have 🤔 So, it would be nice to have some other ideas to solve this problem...

kanata2 avatar Sep 29 '20 21:09 kanata2

@kanata2 thanks for your feedback

does not seem to be a feature that slack.Client should have

why not? Even if this is the OAuth flow, it still belongs to the Slack API with the same base path, as usage of APIURL constant shows.

An alternative approach is to declare a different client, let's say slack.OAuthClient, and add these funcs to its method set, but that would require duplicating a bunch of code...

As a matter of fact, I'm not sure why you designed these OAuth funcs as static.

vibridi avatar Sep 30 '20 18:09 vibridi