use alloc::string::String;
#[cfg(any(feature = "request", feature = "request_std"))]
use crate::method::Method;
#[cfg(any(feature = "request", feature = "request_std"))]
use crate::error::ProductOSRequestError;
#[cfg(any(feature = "request", feature = "request_std"))]
use crate::request::ProductOSRequest;
#[cfg(any(feature = "request", feature = "request_std"))]
use crate::response::ProductOSResponse;
#[cfg(any(feature = "request", feature = "request_std"))]
use crate::requester::ProductOSRequester;
#[cfg(any(feature = "request", feature = "request_std"))]
pub use product_os_http::Request;
#[cfg(any(feature = "request", feature = "request_std"))]
#[allow(async_fn_in_trait)]
pub trait ProductOSClient<DReq: product_os_http_body::Body, DRes: product_os_http_body::Body> {
fn build(&mut self, requester: &ProductOSRequester);
fn new_request(&self, method: Method, url: &str) -> ProductOSRequest<DReq>;
async fn request(
&self,
r: ProductOSRequest<DReq>,
) -> Result<ProductOSResponse<DRes>, ProductOSRequestError>;
#[cfg(any(feature = "stream_reqwest", feature = "stream_hyper"))]
async fn request_stream(
&self,
r: ProductOSRequest<DReq>,
) -> Result<ProductOSResponse<DRes>, ProductOSRequestError>;
async fn request_simple(
&self,
method: Method,
url: &str,
) -> Result<ProductOSResponse<DRes>, ProductOSRequestError>;
async fn request_raw(
&self,
r: Request<DReq>,
) -> Result<ProductOSResponse<DRes>, ProductOSRequestError>;
#[cfg(any(feature = "stream_reqwest", feature = "stream_hyper"))]
async fn request_stream_raw(
&self,
r: Request<DReq>,
) -> Result<ProductOSResponse<DRes>, ProductOSRequestError>;
#[cfg(feature = "json")]
async fn set_body_json(&self, r: &mut ProductOSRequest<DReq>, json: serde_json::Value);
#[cfg(feature = "form")]
async fn set_body_form(&self, r: &mut ProductOSRequest<DReq>, form: &str);
async fn text(&self, r: ProductOSResponse<DRes>) -> Result<String, ProductOSRequestError>;
#[cfg(feature = "json")]
async fn json(
&self,
r: ProductOSResponse<DRes>,
) -> Result<serde_json::Value, ProductOSRequestError>;
async fn bytes(
&self,
r: ProductOSResponse<DRes>,
) -> Result<bytes::Bytes, ProductOSRequestError>;
async fn next_bytes(
&self,
r: &mut ProductOSResponse<DRes>,
) -> Result<Option<bytes::Bytes>, ProductOSRequestError>;
fn to_stream(
&self,
r: ProductOSResponse<product_os_http_body::BodyBytes>,
) -> Result<
product_os_http_body::BodyDataStream<product_os_http_body::BodyBytes>,
ProductOSRequestError,
>;
}
#[cfg(all(feature = "request_std", any(feature = "std", feature = "std_reqwest")))]
mod reqwest_impl;
#[cfg(all(feature = "request_std", feature = "std_hyper"))]
mod hyper_impl;
#[cfg(all(feature = "request_std", any(feature = "std", feature = "std_reqwest")))]
pub use reqwest_impl::ProductOSReqwestClient;
#[cfg(all(feature = "request_std", feature = "std_hyper"))]
pub use hyper_impl::ProductOSHyperClient;
#[cfg(all(
feature = "request_std",
any(feature = "std", feature = "std_reqwest"),
not(feature = "std_hyper")
))]
pub type ProductOSRequestClient = ProductOSReqwestClient;
#[cfg(all(
feature = "request_std",
feature = "std_hyper",
not(feature = "std"),
not(feature = "std_reqwest")
))]
pub type ProductOSRequestClient = ProductOSHyperClient;
#[cfg(all(
feature = "request_std",
any(feature = "std", feature = "std_reqwest"),
feature = "std_hyper"
))]
pub type ProductOSRequestClient = ProductOSReqwestClient;