-
Notifications
You must be signed in to change notification settings - Fork 662
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
rtm-api: add support for custom webClient #1696
Conversation
- Update constructor to optionally allow for custom webClient
This reverts commit 9a842ee.
Thanks for the contribution! Before we can merge this, we need @ishangarg0 to sign the Salesforce Inc. Contributor License Agreement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @ishangarg0 🙇🏻
The addition of webClient
looks good to me and since rtm-api
doesn't have any tests, I don't think we need to add a test.
I'm going to loop in another maintainer to give the PR a second pair of 👀 eyes, in case there was a historical reason to not support custom webClients!
Thanks for the signing the CLA btw 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this new webClient
option interact with the slackApiUrl
that can be passed into the constructor, which sets the URL that the web client will interact with? If both webClient
and slackApiUrl
are set, what should this package do?
Assuming we can resolve that question, we should also expand the documentation/reference to describe this. In particular:
- the reference documentation in the file
docs/_reference/rtm-api.md
- the main package description in the file
docs/_packages/rtm_api.md
, which maps to what is seen on https://slack.dev/node-slack-sdk/rtm-api
The I'll update the documentation if everything looks good. |
Sounds good to me, let's just update the docs to reflect this fact. Thank you! |
- updated docs to reflect new custom webClient parameter for RTMClient constructor
Updated the docs, let me know if there are any details missing. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, left some minor formatting / linking / phrasing suggestions. Please ping me once updated and I can review once more and merge if ready.
Thanks a lot for doing this! <3
docs/_packages/rtm_api.md
Outdated
@@ -644,6 +644,30 @@ const rtm = new RTMClient(token, options); | |||
|
|||
--- | |||
|
|||
### Custom WebClient | |||
|
|||
In some cases, you might want flexibility with the WebClient construction beyond the provided RTMClient options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some cases, you might want flexibility with the WebClient construction beyond the provided RTMClient options | |
In some cases, you might want to customize the underlying component making HTTP requests to the Slack API, the [`WebClient`](reference/web-api#webclient), beyond the provided [`RTMClientOptions`](reference/rtm-api#rtmclientoptions). Note that overriding the [`WebClient`](reference/web-api#webclient) instance takes precedence over any other [`RTMClientOptions`](reference/rtm-api#rtmclientoptions) specified. |
docs/_packages/rtm_api.md
Outdated
const webClient = new WebClient(token, options); | ||
|
||
// Initialize a client using the configuration | ||
const rtm = new RTMClient(token, {webClient}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const rtm = new RTMClient(token, {webClient}); | |
const rtm = new RTMClient(token, { webClient }); |
docs/_reference/rtm-api.md
Outdated
@@ -31,6 +32,13 @@ slug: rtm-api | |||
<td align="center">✗</td> | |||
<td></td> | |||
</tr> | |||
<tr> | |||
<td align="center">webClient</td> | |||
<td align="center"><code><a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient" title="">WebClient</a></code></td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<td align="center"><code><a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient" title="">WebClient</a></code></td> | |
<td align="center"><code><a href="web-api#webclient" title="">WebClient</a></code></td> |
Link to hosted docs instead of github
docs/_reference/rtm-api.md
Outdated
<td align="center">webClient</td> | ||
<td align="center"><code><a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient" title="">WebClient</a></code></td> | ||
<td align="center">✗</td> | ||
<td align="center">An optional parameter to provide a customized <a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient">WebClient</a>. Any desired options for the custom client must be set in this parameter (<code>webClient</code>) as they will take precedence over other arguments passed into <code>RTMClient</code>.</td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<td align="center">An optional parameter to provide a customized <a href="https://github.com/slackapi/node-slack-sdk/blob/main/docs/_reference/web-api.md#webclient">WebClient</a>. Any desired options for the custom client must be set in this parameter (<code>webClient</code>) as they will take precedence over other arguments passed into <code>RTMClient</code>.</td> | |
<td align="center">An optional parameter to provide a customized <a href="web-api#webclient">WebClient</a>. Any desired options for the custom client must be set in this parameter (<code>webClient</code>) as they will take precedence over other arguments passed into <code>RTMClient</code>.</td> |
Link to hosted docs instead of github
- minor formatting, linking, and phrasing updates to rtm-api docs
@filmaj Thanks for the suggestions, I pushed the changes let me know how it looks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you! Gonna let the tests run and then will merge and release 😄
This is now live on [email protected] on npm and on GitHub. Thanks again for your contribution, @ishangarg0 ! |
Summary
Requirements (place an
x
in each[ ]
)