dermesser / yup-oauth2

An oauth2 client implementation providing the Device, Installed, Service Account, and several more flows.
https://docs.rs/yup-oauth2/
Apache License 2.0
222 stars 114 forks source link

Consider exposing api dependencies in a module #89

Open tylerhawkes opened 5 years ago

tylerhawkes commented 5 years ago

Some of the public apis depend on a specific version of Hyper. I know that work is happening to fix that. I'm building a binary and just set all dependency versions to * (I know it's not recommended, but it's worked great since Cargo.lock is committed and we update every few weeks). The only exceptions to that are for hyper and subsequently hyper-rustls (I definitely use rustls over openssl whenever possible) and they have to line up with the yup-oauth2 dependencies.

I'll try to get a pull request together, but I think that something like

pub mod deps {
    pub mod hyper {
        pub use hyper::*;
    }
    pub mod hyper-rustls {
        pub use hyper_rustls::*;
    }
}

would work and then consumers would just do something like

    use yup_oauth2::deps::*;
    let key = yup_oauth2::ServiceAccountKey { ... }
    let authenticator = yup_oauth2::ServiceAccountAccess::new(
      key,
      hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
    );
    let storage = Storage::new(
      hyper::Client::with_connector(hyper::net::HttpsConnector::new(hyper_rustls::TlsClient::new())),
      authenticator,
    );

This wouldn't be a breaking change because the library already depends on these specific versions. It would reduce friction when using them.

dermesser commented 5 years ago

I'm in favor of doing something like this!