rivet_client_api_chat/
config.rs1pub struct Config {
5 pub(crate) auth: Option<String>,
6 pub(crate) uri: String,
7}
8impl std::fmt::Debug for Config {
9 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10 let mut config = f.debug_struct("Config");
11 config.finish()
12 }
13}
14impl Config {
15 pub fn builder() -> Builder {
17 Builder::default()
18 }
19}
20#[derive(Default)]
22pub struct Builder {
23 pub(crate) auth: Option<String>,
24 pub(crate) uri: Option<String>,
25}
26impl Builder {
27 pub fn new() -> Self {
29 Self::default()
30 }
31 pub fn set_bearer_token(mut self, bearer_token: impl std::fmt::Display) -> Self {
33 self.auth = Some(format!("Bearer {}", bearer_token));
34 self
35 }
36 pub fn set_uri(mut self, uri: impl ToString) -> Self {
38 self.uri = Some(uri.to_string());
39 self
40 }
41 pub fn build(self) -> Config {
43 Config {
44 auth: self.auth,
45 uri: self.uri.expect("No URI"),
46 }
47 }
48}