pub struct BriefcaseClient { /* private fields */ }Expand description
Authenticated client for the Briefcase AI platform.
Created via BriefcaseClient::new or BriefcaseClient::with_config,
which validate the API key against the server before returning.
Implementations§
Source§impl BriefcaseClient
impl BriefcaseClient
Sourcepub async fn new(api_key: &str, server_url: &str) -> Result<Self, ClientError>
pub async fn new(api_key: &str, server_url: &str) -> Result<Self, ClientError>
Create a new client, validating the API key against the server.
Uses default configuration (30s timeout, 1h cache TTL, 3 retries).
Sourcepub async fn with_config(
api_key: &str,
server_url: &str,
config: ClientConfig,
) -> Result<Self, ClientError>
pub async fn with_config( api_key: &str, server_url: &str, config: ClientConfig, ) -> Result<Self, ClientError>
Create a new client with custom configuration.
Sourcepub fn permissions(&self) -> &[String]
pub fn permissions(&self) -> &[String]
Granted permissions.
Sourcepub fn has_permission(&self, perm: &str) -> bool
pub fn has_permission(&self, perm: &str) -> bool
Check whether this client has a specific permission.
Sourcepub async fn revalidate(&self) -> Result<ValidatedClient, ClientError>
pub async fn revalidate(&self) -> Result<ValidatedClient, ClientError>
Re-validate the API key, using the cache if still fresh.
Sourcepub fn invalidate_cache(&self)
pub fn invalidate_cache(&self)
Explicitly invalidate the validation cache.
Sourcepub fn with_storage(self, storage: Arc<dyn StorageBackend>) -> Self
pub fn with_storage(self, storage: Arc<dyn StorageBackend>) -> Self
Bind a storage backend for delegated operations.
Sourcepub async fn save_decision(
&self,
decision: &DecisionSnapshot,
) -> Result<String, ClientError>
pub async fn save_decision( &self, decision: &DecisionSnapshot, ) -> Result<String, ClientError>
Save a decision (requires “write” permission and a bound storage backend).
Sourcepub async fn load_decision(
&self,
decision_id: &str,
) -> Result<DecisionSnapshot, ClientError>
pub async fn load_decision( &self, decision_id: &str, ) -> Result<DecisionSnapshot, ClientError>
Load a decision by ID (requires “read” permission and a bound storage backend).
Sourcepub async fn query(
&self,
query: SnapshotQuery,
) -> Result<Vec<Snapshot>, ClientError>
pub async fn query( &self, query: SnapshotQuery, ) -> Result<Vec<Snapshot>, ClientError>
Query snapshots (requires “read” permission and a bound storage backend).