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