pub struct ApiStorageBackend { /* private fields */ }Expand description
API storage backend that communicates with HTTP API
Implementations§
Source§impl ApiStorageBackend
impl ApiStorageBackend
Sourcepub fn new(base_url: impl Into<String>, auth_token: Option<String>) -> Self
pub fn new(base_url: impl Into<String>, auth_token: Option<String>) -> Self
Create a new API storage backend
§Arguments
base_url- Base URL of the API server (e.g., “https://api.example.com/api/v1”)auth_token- Optional bearer token for authentication
§Example
use data_modelling_sdk::storage::api::ApiStorageBackend;
let backend = ApiStorageBackend::new(
"https://api.example.com/api/v1",
Some("bearer_token_here".to_string()),
);Sourcepub async fn get_workspace_info(&self) -> Result<WorkspaceInfo, StorageError>
pub async fn get_workspace_info(&self) -> Result<WorkspaceInfo, StorageError>
Sourcepub async fn load_tables(
&self,
domain: &str,
) -> Result<Vec<Value>, StorageError>
pub async fn load_tables( &self, domain: &str, ) -> Result<Vec<Value>, StorageError>
Sourcepub async fn load_relationships(
&self,
domain: &str,
) -> Result<Vec<Value>, StorageError>
pub async fn load_relationships( &self, domain: &str, ) -> Result<Vec<Value>, StorageError>
Load relationships from API
§Security
The domain parameter is validated to prevent injection attacks.
Trait Implementations§
Source§impl StorageBackend for ApiStorageBackend
impl StorageBackend for ApiStorageBackend
Source§fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
_dir: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_files<'life0, 'life1, 'async_trait>(
&'life0 self,
_dir: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List files in a directory.
§Note
This method is intentionally not supported in the API backend. The API uses a model-based approach where tables and relationships are accessed via dedicated endpoints rather than as files.
Use load_tables() and load_relationships() instead.
Source§fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn file_exists<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool, StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check if a file exists.
§Note
File existence checks are not meaningful in the API backend.
The API uses model endpoints - use load_tables() to check for tables.
Source§fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_file<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete a file.
§Note
This method is intentionally not supported in the API backend. Use the API’s table/relationship DELETE endpoints directly.
Source§fn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_dir<'life0, 'life1, 'async_trait>(
&'life0 self,
_path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create a directory.
§Note
Directory creation is not supported in the API backend. Workspaces and domains are created via dedicated API endpoints.