1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//! # Deboa Extras
//!
//! `deboa-extras` is an extension crate for the `deboa` HTTP client that provides additional
//! functionality and utilities for working with HTTP requests and responses.
//!
//! ## Features
//!
//! - **HTTP Utilities**: Additional HTTP-related functionality including:
//! - Server-Sent Events (SSE) support
//! - WebSocket client (when `websockets` feature is enabled)
//! - Enhanced serialization/deserialization
//! - **Compression**: Support for compressed request/response bodies (when `compression` feature is enabled)
//! - **Error Handling**: Extended error types and utilities
//! - **Catchers**: Pre-built error handlers for common scenarios
//!
//! ## Crate Features
//!
//! - `compression`: Enables compression support (gzip, deflate, brotli)
//! - `websockets`: Enables WebSocket client functionality
//! - `json`: Enables JSON serialization/deserialization
//! - `msgpack`: Enables MessagePack serialization/deserialization
//! - `xml`: Enables XML serialization/deserialization
//! - `yaml`: Enables YAML serialization/deserialization
//! - `flex`: Enables flexbuffers serialization/deserialization
//!
//! ## Examples
//!
//! ### Using Server-Sent Events (SSE)
//!
//! ```compile_fail
//! use deboa::{Client, Result};
//! use deboa_extras::http::sse::SseRequest;
//! use futures_util::StreamExt;
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let mut client = Client::default();
//! let response = client
//! .execute("https://sse.dev/test")
//! .await?
//! .into_event_stream();
//!
//! // Poll events, until the connection is closed
//! // please note that this is a blocking call
//! while let Some(event) = response.next().await {
//! println!("event: {}", event);
//! }
//!
//! println!("Connection closed");
//! Ok(())
//! }
//! ```
//!
//! ### Using WebSockets
//!
//! ```compile_fail
//! use deboa::{Client, Result};
//! use deboa_extras::ws::{
//! io::socket::DeboaWebSocket,
//! protocol::{self},
//! request::WebsocketRequestBuilder,
//! response::IntoWebSocket,
//! };
//!
//!
//! #[tokio::main]
//! async fn main() -> Result<()> {
//! let mut client = Client::default();
//! let websocket = WebsocketRequestBuilder::connect("wss://echo.websocket.org")
//! .send_with(&mut client)
//! .await?;
//!
//! // Send a message
//! websocket.send_text("Hello, WebSocket!".into()).await?;
//!
//! // Receive messages
//! while let Ok(Some(msg)) = websocket.read_message().await {
//! match msg {
//! protocol::Message::Text(text) => println!("Received text: {}", text),
//! protocol::Message::Binary(data) => println!("Received binary data: {} bytes", data.len()),
//! }
//! }
//! Ok(())
//! }
//! ```
//pub mod catcher;
//pub mod io;