agent_sdk_store_supabase/
config.rs1use agent_sdk_core::AgentError;
2
3use crate::auth::SupabaseAuth;
4
5#[derive(Clone, Debug)]
6pub struct SupabaseStoreConfig {
8 project_url: String,
9 schema: String,
10 store_scope: String,
11 auth: SupabaseAuth,
12}
13
14impl SupabaseStoreConfig {
15 pub fn new(
17 project_url: impl Into<String>,
18 schema: impl Into<String>,
19 store_scope: impl Into<String>,
20 auth: SupabaseAuth,
21 ) -> Result<Self, AgentError> {
22 let project_url = project_url.into().trim_end_matches('/').to_string();
23 if project_url.is_empty() {
24 return Err(AgentError::missing_required_field("supabase.project_url"));
25 }
26 let schema = schema.into();
27 if schema.is_empty() {
28 return Err(AgentError::missing_required_field("supabase.schema"));
29 }
30 let store_scope = store_scope.into();
31 if store_scope.is_empty() {
32 return Err(AgentError::missing_required_field("supabase.store_scope"));
33 }
34 Ok(Self {
35 project_url,
36 schema,
37 store_scope,
38 auth,
39 })
40 }
41
42 pub fn project_url(&self) -> &str {
44 &self.project_url
45 }
46
47 pub fn schema(&self) -> &str {
49 &self.schema
50 }
51
52 pub fn store_scope(&self) -> &str {
54 &self.store_scope
55 }
56
57 pub fn auth(&self) -> &SupabaseAuth {
59 &self.auth
60 }
61}