egg-mode-rs / egg-mode

a twitter api crate for rust
https://crates.io/crates/egg-mode
Mozilla Public License 2.0
372 stars 65 forks source link

Allow calling raw API #83

Closed kgtkr closed 4 years ago

kgtkr commented 4 years ago

Currently this library can only call fixed endpoints with fixed parameters. But this does not allow you to use hidden APIs and parameters So I want a function that returns the serde_json::Value by freely passing the URL and parameters

adwhit commented 4 years ago

I think this is reasonable. It probably amount to exposing the raw_request and request_with_json_response functions. https://github.com/QuietMisdreavus/twitter-rs/blob/master/src/common/response.rs#L92-L125

QuietMisdreavus commented 4 years ago

I would say this is tied to https://github.com/QuietMisdreavus/twitter-rs/issues/32, since exposing the raw authentication primitives would allow you to assemble "raw" requests like you want. I would probably want to have some kind of wrapper between auth::{get, post, post_json} and the response functions in common::response as the public "raw" API. Should we also expose all the URLs in the links module as well? That way people could use the existing URLs that we have if they aren't wrapping an unbound API.

QuietMisdreavus commented 4 years ago

Update: i've posted https://github.com/egg-mode-rs/egg-mode/pull/91 which exposes just enough internals to enable calling arbitrary endpoints. If you'd like, you can give it a look - hopefully this should serve your purposes.