product-os-request 0.0.55

Product OS : Request provides a fully featured HTTP request library combining elements of reqwest and hyper for async requests with a series of helper methods to allow for easier usage depending upon your needs for one-time or repeat usage.
Documentation
//! Product OS : Request
//!
//! Product OS : Request provides a fully featured HTTP request library combining elements
//! of reqwest and hyper for async requests with a series of helper methods
//! to allow for easier usage depending upon your needs for one-time or repeat usage.
//!
//! ## Features
//!
//! - Default support for HTTPS / TLS using Rustls
//! - A requester concept for managing multiple requests
//! - One-time request support
//! - Async requests
//! - Custom Request and Response structs
//! - Helpers for managing conditions such as managing specific trusted certificates
//! - Helpers for defining redirect policies
//! - Requester build flows to ensure specific settings are defined
//! - Support no_std with alloc only environments
//! - Choice of HTTP backends: reqwest (`std_reqwest`) or hyper (`std_hyper`)
//!
//! ## Cargo Features
//!
//! No features are enabled by default. Choose an implementation explicitly.
//!
//! **Core (no\_std):** `uri`, `method`, `response`, `request`
//!
//! **Std:** `method_std`, `response_std`, `request_std`, `std_base`
//!
//! **Backends:** `std_reqwest`, `std_hyper`, `std` (deprecated alias for `std_reqwest`)
//!
//! **Hyper add-ons:** `hyper_timeout`, `hyper_compression`, `hyper_cookies`, `hyper_proxy`, `std_hyper_full`
//!
//! **Content:** `json`, `form`
//!
//! **Streaming:** `stream`, `stream_reqwest`, `stream_hyper`
//!
//! ## Usage
//!
//! Use `ProductOSRequestClient` for portable code that works with either backend:
//!
//! ```no_run
//! # #[cfg(all(feature = "request_std", feature = "std"))]
//! # {
//! use product_os_request::{Method, ProductOSRequestClient, ProductOSRequester, ProductOSClient};
//!
//! # async fn example() {
//! // Create a client (works with either reqwest or hyper backend)
//! let mut requester = ProductOSRequester::new();
//! requester.set_timeout(5000);
//!
//! let mut client = ProductOSRequestClient::new();
//! requester.build(&mut client);
//!
//! // Make a request
//! let mut request = client.new_request(Method::GET, "https://api.example.com/data");
//! request.add_header("User-Agent", "ProductOS-Request/0.0.55", false);
//! # }
//! # }
//! ```
//!
//! For explicit backend selection, use `ProductOSReqwestClient` or `ProductOSHyperClient` directly:
//!
//! ```no_run
//! # #[cfg(all(feature = "request_std", feature = "std_hyper"))]
//! # {
//! use product_os_request::{Method, ProductOSHyperClient, ProductOSRequester, ProductOSClient};
//!
//! # async fn example() {
//! let mut requester = ProductOSRequester::new();
//! let mut client = ProductOSHyperClient::new();
//! requester.build(&mut client);
//! # }
//! # }
//! ```

#![no_std]
#![warn(missing_docs)]
#![warn(clippy::unwrap_used)]
#![warn(clippy::expect_used)]
#![warn(clippy::panic)]
#![warn(clippy::todo)]
#![warn(clippy::unimplemented)]

extern crate alloc;

#[cfg(any(feature = "std_base", feature = "std_reqwest", feature = "std_hyper"))]
extern crate std;

#[cfg(all(feature = "request_std", feature = "std_hyper"))]
mod encode;

// Module declarations
#[cfg(any(feature = "method", feature = "method_std"))]
mod method;

#[cfg(any(feature = "request", feature = "request_std"))]
mod protocol;

#[cfg(any(feature = "request", feature = "request_std"))]
mod policy;

#[cfg(any(feature = "request", feature = "request_std"))]
mod error;

#[cfg(any(feature = "request", feature = "request_std"))]
mod body;

#[cfg(any(feature = "request", feature = "request_std"))]
mod request;

#[cfg(any(feature = "response", feature = "response_std"))]
mod response;

#[cfg(any(feature = "request", feature = "request_std"))]
mod requester;

#[cfg(any(feature = "request", feature = "request_std"))]
mod client;

// Re-exports from modules

#[cfg(any(feature = "method", feature = "method_std"))]
pub use method::{HttpMethod, Method};

#[cfg(any(feature = "request", feature = "request_std"))]
pub use protocol::{Protocol, Proxy};

#[cfg(any(feature = "request", feature = "request_std"))]
pub use policy::RedirectPolicy;

#[cfg(any(feature = "request", feature = "request_std"))]
pub use error::ProductOSRequestError;

#[cfg(any(feature = "request", feature = "request_std"))]
pub use body::BodyType;

#[cfg(any(feature = "request", feature = "request_std"))]
pub use request::ProductOSRequest;

#[cfg(any(feature = "response", feature = "response_std"))]
pub use response::ProductOSResponse;

#[cfg(any(feature = "request", feature = "request_std"))]
pub use requester::ProductOSRequester;

#[cfg(any(feature = "request", feature = "request_std"))]
pub use client::ProductOSClient;

// Concrete client exports
#[cfg(all(feature = "request_std", any(feature = "std", feature = "std_reqwest")))]
pub use client::ProductOSReqwestClient;

#[cfg(all(feature = "request_std", feature = "std_hyper"))]
pub use client::ProductOSHyperClient;

// Unified type alias - allows users to write portable code that works with either backend
#[cfg(all(
    feature = "request_std",
    any(feature = "std", feature = "std_reqwest", feature = "std_hyper")
))]
pub use client::ProductOSRequestClient;

// Re-export HTTP types from dependencies
#[cfg(any(
    feature = "request",
    feature = "response",
    feature = "request_std",
    feature = "response_std"
))]
pub use product_os_http::{
    header::{HeaderMap, HeaderName, HeaderValue},
    response::Parts,
    Request, Response, StatusCode,
};

#[cfg(any(
    feature = "uri",
    feature = "request",
    feature = "response",
    feature = "request_std",
    feature = "response_std"
))]
pub use product_os_http::Uri;

#[cfg(any(
    feature = "request",
    feature = "response",
    feature = "request_std",
    feature = "response_std"
))]
pub use product_os_http_body::*;