Organizing an API client library around reqwest::Client

I like that! it actually does what I was originally trying to achive. I tried it as a struct property rather than a tuple struct and ended up doing it this way trying to fight the borrow checker :rofl: I like the solution.

I was trying to get away from using a method to access the functions, but trying to deal with the lifetimes with the struct property puts lifetimes all over the code and I still can't get around the borrow checker.

One catch is that every API call will be creating that intermediary URL, but that's something that could be worked around if it was genuinely causing problems

That's not an issue and is better since most API methods have their own additions to the base anyway so I can move it into each method to build it's own endpoint and use the request to do whatever they need.

Code

It's a good solution because I don't need the Arc anymore, reqwest::Client has an internal Arc. If I am using the API in Tokio service for instance I will need to find a way to clone the internal reqwest::Client before I pass it to tokio::spawn(). I will probably need to implement clone for the client.

The next thing I want to do is error handling. Was going to first use thiserror, and then checkout anyhow if I needed it so thanks for saving me the time!!