ai_provider_sdk/
request_options.rs1use std::collections::HashMap;
4use std::time::Duration;
5
6use serde_json::Value;
7
8#[derive(Debug, Clone, Default)]
9pub struct RequestOptions {
13 pub extra_headers: HashMap<String, String>,
17 pub extra_query: HashMap<String, String>,
21 pub extra_body: Option<Value>,
26 pub timeout: Option<Duration>,
28}
29
30impl RequestOptions {
31 pub fn new() -> Self {
33 Self::default()
34 }
35
36 pub fn header(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
38 self.extra_headers.insert(key.into(), value.into());
39 self
40 }
41
42 pub fn query(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
44 self.extra_query.insert(key.into(), value.into());
45 self
46 }
47
48 pub fn extra_body(mut self, value: Value) -> Self {
50 self.extra_body = Some(value);
51 self
52 }
53
54 pub fn timeout(mut self, timeout: Duration) -> Self {
56 self.timeout = Some(timeout);
57 self
58 }
59}