1use serde::{Deserialize, Serialize};
4use std::collections::HashMap;
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
8pub struct HandlerContext {
9 pub method: String,
10 pub path: String,
11 pub headers: HashMap<String, String>,
12 pub query_params: HashMap<String, String>,
13 pub body: Option<String>,
14 pub environment: HashMap<String, String>,
15}
16
17#[derive(Debug, Clone, Serialize, Deserialize)]
19pub struct HandlerConfig {
20 pub timeout_ms: u64,
21 pub max_memory_mb: u64,
22 pub enable_caching: bool,
23 pub enable_logging: bool,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
28pub struct HandlerResult {
29 pub status_code: u16,
30 pub headers: HashMap<String, String>,
31 pub body: String,
32 pub execution_time_ms: u64,
33 pub memory_used_mb: f64,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct HandlerMetadata {
39 pub id: String,
40 pub name: String,
41 pub version: String,
42 pub description: String,
43 pub capabilities: Vec<String>,
44}
45
46#[cfg(feature = "websocket")]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49pub enum WebSocketMessage {
50 Text(String),
51 Binary(Vec<u8>),
52 Ping,
53 Pong,
54 Close,
55}
56
57#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
59pub enum ExecutionMode {
60 Sync,
61 Async,
62 Streaming,
63}
64
65#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct HandlerCapabilities {
68 pub supports_async: bool,
69 pub supports_streaming: bool,
70 pub supports_websocket: bool,
71 pub supports_file_upload: bool,
72 pub max_payload_size: u64,
73 pub supported_content_types: Vec<String>,
74}