systemprompt_models/oauth/
client.rs1use serde::{Deserialize, Serialize};
7use systemprompt_identifiers::ClientId;
8
9#[derive(Debug, Clone, Serialize, Deserialize)]
10pub struct OAuthClientConfig {
11 pub provider: String,
12 pub client_id: ClientId,
13 pub client_secret: Option<String>,
14 pub authorization_url: String,
15 pub token_url: String,
16 pub redirect_uri: Option<String>,
17 pub scopes: Vec<String>,
18}
19
20impl OAuthClientConfig {
21 pub fn new(
22 provider: impl Into<String>,
23 client_id: ClientId,
24 authorization_url: impl Into<String>,
25 token_url: impl Into<String>,
26 ) -> Self {
27 Self {
28 provider: provider.into(),
29 client_id,
30 client_secret: None,
31 authorization_url: authorization_url.into(),
32 token_url: token_url.into(),
33 redirect_uri: None,
34 scopes: Vec::new(),
35 }
36 }
37
38 pub fn with_secret(mut self, secret: impl Into<String>) -> Self {
39 self.client_secret = Some(secret.into());
40 self
41 }
42
43 pub fn with_redirect_uri(mut self, redirect_uri: impl Into<String>) -> Self {
44 self.redirect_uri = Some(redirect_uri.into());
45 self
46 }
47
48 pub fn with_scopes(mut self, scopes: Vec<String>) -> Self {
49 self.scopes = scopes;
50 self
51 }
52}