|
30 | 30 | //! |
31 | 31 | //! ```toml |
32 | 32 | //! [dependencies] |
33 | | -//! docusign = "0.8.0-rc.2" |
| 33 | +//! docusign = "0.9.0" |
34 | 34 | //! ``` |
35 | 35 | //! |
36 | 36 | //! ## Basic example |
@@ -2227,6 +2227,7 @@ pub enum ClientError { |
2227 | 2227 | /// Errors returned by reqwest::header |
2228 | 2228 | #[error(transparent)] |
2229 | 2229 | InvalidHeaderValue(#[from] reqwest::header::InvalidHeaderValue), |
| 2230 | + #[cfg(feature = "middleware")] |
2230 | 2231 | /// Errors returned by reqwest middleware |
2231 | 2232 | #[error(transparent)] |
2232 | 2233 | ReqwestMiddleWareError(#[from] reqwest_middleware::Error), |
@@ -2297,7 +2298,10 @@ pub struct Client { |
2297 | 2298 | redirect_uri: String, |
2298 | 2299 |
|
2299 | 2300 | auto_refresh: bool, |
| 2301 | + #[cfg(feature = "middleware")] |
2300 | 2302 | client: reqwest_middleware::ClientWithMiddleware, |
| 2303 | + #[cfg(not(feature = "middleware"))] |
| 2304 | + client: reqwest::Client, |
2301 | 2305 | } |
2302 | 2306 |
|
2303 | 2307 | use schemars::JsonSchema; |
@@ -2378,15 +2382,20 @@ impl Client { |
2378 | 2382 | .build(); |
2379 | 2383 | match client { |
2380 | 2384 | Ok(c) => { |
2381 | | - let client = reqwest_middleware::ClientBuilder::new(c) |
2382 | | - // Trace HTTP requests. See the tracing crate to make use of these traces. |
2383 | | - .with(reqwest_tracing::TracingMiddleware::default()) |
2384 | | - // Retry failed requests. |
2385 | | - .with(reqwest_conditional_middleware::ConditionalMiddleware::new( |
2386 | | - reqwest_retry::RetryTransientMiddleware::new_with_policy(retry_policy), |
2387 | | - |req: &reqwest::Request| req.try_clone().is_some(), |
2388 | | - )) |
2389 | | - .build(); |
| 2385 | + #[cfg(feature = "middleware")] |
| 2386 | + let client = { |
| 2387 | + reqwest_middleware::ClientBuilder::new(c) |
| 2388 | + // Trace HTTP requests. See the tracing crate to make use of these traces. |
| 2389 | + .with(reqwest_tracing::TracingMiddleware::default()) |
| 2390 | + // Retry failed requests. |
| 2391 | + .with(reqwest_conditional_middleware::ConditionalMiddleware::new( |
| 2392 | + reqwest_retry::RetryTransientMiddleware::new_with_policy(retry_policy), |
| 2393 | + |req: &reqwest::Request| req.try_clone().is_some(), |
| 2394 | + )) |
| 2395 | + .build() |
| 2396 | + }; |
| 2397 | + #[cfg(not(feature = "middleware"))] |
| 2398 | + let client = c; |
2390 | 2399 |
|
2391 | 2400 | let host = RootDefaultServer::default().default_url().to_string(); |
2392 | 2401 |
|
|
0 commit comments