Exported API has no available client
I've been refactoring my code with recent changes to the library.
One change is that we no longer get our user's name or ID on on_connect(), so I'm trying to call slack::api::users::list to find that information.
The problem is the API calls all require a client implementing the SlackWebRequestSender trait. No such client is exposed either by slack or slack_api. The authentication token also needs to be passed to any function that might want to make an API call.
Would it make sense to have something analogous to the RtmClient that essentially wraps the reqwest::Client and an API token? It's what I would likely implement, but I guess my question is whether there's some other way to access a SlackWebRequestSender that I'm missing.
Once connected you can access the start response which contains a lot of the things previously on the client https://docs.rs/slack/0.17.1/slack/struct.RtmClient.html#method.start_response
Using the api is currently kind of standalone. You can use reqwest for the api client or impl your own. It was the same before i thought.
Docs.rs isn't linking to the type for some reason but it's here https://docs.rs/slack_api/0.16.1/slack_api/rtm/struct.StartResponse.html
Ah yes, I did see and then forget about that. Thanks.
That solves my particular issue, but I am still at a bit of a loss as to how to access API functions without rolling my own client. Is that possible?
@squidpickles
Took me quite a while to figure this out, but it seems that the SlackWebRequestSender impl for reqwest only works if the reqwest version in your Cargo.toml matches the one used by slack_api, so 0.4.0 currently.
Oh i did have the same problem with versions. If slack api re-exported its one rather than relying on versions matching it would work better i think
Oh yeah... version mismatch + traits... I have run into that several times before. I don't know why I still don't think to check that. An exported client would help a ton, yes.
Made a PR: slack-rs/slack-rs-api#42.
And another one with an example: #82.