mirror of
https://github.com/OMGeeky/google-apis-rs.git
synced 2026-01-20 18:21:37 +01:00
Make yup-oauth2 optional
This commit is contained in:
@@ -24,11 +24,9 @@ serde_json = "^ 1.0"
|
||||
base64 = "0.13.0"
|
||||
chrono = { version = "0.4.22", features = ["serde"] }
|
||||
|
||||
## TODO: Make yup-oauth2 optional
|
||||
## yup-oauth2 = { version = "^ 7.0", optional = true }
|
||||
yup-oauth2 = "^ 7.0"
|
||||
yup-oauth2 = { version = "^ 7.0", optional = true }
|
||||
itertools = "^ 0.10"
|
||||
hyper = "^ 0.14"
|
||||
hyper = { version = "^ 0.14", features = ["client", "http2"] }
|
||||
http = "^0.2"
|
||||
tokio = "^1.0"
|
||||
tokio = { version = "^1.0", features = ["time"] }
|
||||
tower-service = "^0.3.1"
|
||||
|
||||
@@ -71,7 +71,6 @@
|
||||
use std::future::Future;
|
||||
use std::pin::Pin;
|
||||
|
||||
// TODO: Simplify this to Option<String>
|
||||
type TokenResult = Option<String>;
|
||||
|
||||
pub trait GetToken: GetTokenClone + Send + Sync {
|
||||
@@ -121,8 +120,7 @@ pub struct NoToken;
|
||||
|
||||
impl GetToken for NoToken {}
|
||||
|
||||
// TODO: Make this optional
|
||||
// #[cfg(feature = "yup-oauth2")]
|
||||
#[cfg(feature = "yup-oauth2")]
|
||||
mod yup_oauth2_impl {
|
||||
use core::future::Future;
|
||||
use core::pin::Pin;
|
||||
|
||||
@@ -29,6 +29,7 @@ pub use auth::{GetToken, NoToken};
|
||||
pub use chrono;
|
||||
pub use field_mask::FieldMask;
|
||||
pub use serde_with;
|
||||
#[cfg(feature = "yup-oauth2")]
|
||||
pub use yup_oauth2 as oauth2;
|
||||
|
||||
const LINE_ENDING: &str = "\r\n";
|
||||
|
||||
@@ -58,6 +58,8 @@ path = "../${api_name}"
|
||||
version = "${util.crate_version()}"
|
||||
% endif
|
||||
|
||||
## TODO: Make yup-oauth2 optional
|
||||
# [features]
|
||||
# default = ["yup-oauth2"]
|
||||
% if not cargo.get("is_executable", False):
|
||||
[features]
|
||||
yup-oauth2 = ["google-apis-common/yup-oauth2"]
|
||||
default = ["yup-oauth2"]
|
||||
% endif
|
||||
@@ -31,7 +31,7 @@ use tokio::time::sleep;
|
||||
use tower_service;
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
use crate::{client, client::GetToken, client::oauth2, client::serde_with};
|
||||
use crate::{client, client::GetToken, client::serde_with};
|
||||
|
||||
// ##############
|
||||
// UTILITIES ###
|
||||
|
||||
@@ -49,5 +49,8 @@ pub mod api;
|
||||
|
||||
// Re-export the hub type and some basic client structs
|
||||
pub use api::${hub_type};
|
||||
pub use client::{Result, Error, Delegate, FieldMask};
|
||||
|
||||
// Re-export the yup_oauth2 crate, that is required to call some methods of the hub and the client
|
||||
pub use client::{Result, Error, Delegate, oauth2, FieldMask};
|
||||
#[cfg(feature = "yup-oauth2")]
|
||||
pub use client::oauth2;
|
||||
Reference in New Issue
Block a user