-
Notifications
You must be signed in to change notification settings - Fork 5
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
Redesign: Separate data structures from HTTP client #8
Comments
That makes sense! I didn't think of it that way when I first made this crate. (Honestly I just wanted something to work with while creating a chatbot, so I just searched whatever was the most convenient HTTP client library to use, and reqwest popped up) If I'm understanding this correctly, we just need to make the Would you like to work on it and propose another pull request for it? I'd be willing to try and help, though I haven't touched Rust in a while and I'm a little unfamiliar with how site-specific, unofficial API libraries should actually be designed in practice here. Another concern I should share is that I'm blissfully unaware of how the versioning would change given a rather dramatic library redesign. Though perhaps you may know more about that than I do, so do let me know if at all possible! |
Yes, ideally it would be the best to convert to http::Request but it requires you specialize it with Body, which may not be always desirable.
Yes, it would imply that user would use request builder, then somehow create request for his library of choice.
Yes, since I'd like to use library instead of writing all the code myself, I'm planning to work on it.
In Rust world the basic rules are:
|
Yeah, I don't think we ever use the body in any of the requests made here. I don't know if it would cause a problem, but I could try playing around with it, see what's valid or not. I gotcha. Looking forward to it! And I'll have to check out yukikaze, it seems interesting! |
Could you please re-open issue? 😄 |
Whoops, my bad. There you go. |
As for current issue.
|
I think I'd like doing it the second way more. It seems like a more idiomatic design, I think. |
Yeah, let's go with it I guess. |
Currently, API is tied to
reqwest
as HTTP client so anyone who would want to use own HTTP Client would be unable to do it asPixiv
andPixivRequestBuilder
are tied to it.So what would be better if we could use
PixivRequestBuilder
to createPixivRequest
And then user would need to pass
PixivRequest
toPixiv
for execution.Pixiv
itself would be in a separate module and optional, only if user would not disable default feature that enablesreqwest
Most likely it would require to rename it.
Most likely ready to be send
PixivRequest
would its field to be public so that user could create request from it.As most existing HTTP clients use
http
crate for basic primitives it should be easy to use it with any other clientsP.s. Well I'd like to have this separation because I prefer my own HTTP client to
reqwest
The text was updated successfully, but these errors were encountered: