pub struct MetabaseClient { /* private fields */ }
Expand description
The main client for interacting with Metabase API
Implementations§
Source§impl MetabaseClient
impl MetabaseClient
Sourcepub fn is_authenticated(&self) -> bool
pub fn is_authenticated(&self) -> bool
Checks if the client is authenticated
Sourcepub fn is_cache_enabled(&self) -> bool
pub fn is_cache_enabled(&self) -> bool
Checks if cache is enabled (always false when cache feature is disabled)
Sourcepub fn set_cache_enabled(&mut self, _enabled: bool)
pub fn set_cache_enabled(&mut self, _enabled: bool)
Sets the cache enabled state (no-op when cache feature is disabled)
Sourcepub async fn authenticate(&mut self, credentials: Credentials) -> Result<()>
pub async fn authenticate(&mut self, credentials: Credentials) -> Result<()>
Authenticates with the Metabase API
Sourcepub async fn health_check(&self) -> Result<HealthStatus>
pub async fn health_check(&self) -> Result<HealthStatus>
Performs a health check on the Metabase API
Sourcepub async fn get_current_user(&self) -> Result<User>
pub async fn get_current_user(&self) -> Result<User>
Gets the current authenticated user
Sourcepub async fn list_cards(
&self,
params: Option<CardListParams>,
) -> Result<Vec<Card>>
pub async fn list_cards( &self, params: Option<CardListParams>, ) -> Result<Vec<Card>>
Lists all cards
Sourcepub async fn create_card(&self, card: Card) -> Result<Card>
pub async fn create_card(&self, card: Card) -> Result<Card>
Creates a new card
Sourcepub async fn update_card(&self, id: i64, updates: Value) -> Result<Card>
pub async fn update_card(&self, id: i64, updates: Value) -> Result<Card>
Updates an existing card
Sourcepub async fn delete_card(&self, id: i64) -> Result<()>
pub async fn delete_card(&self, id: i64) -> Result<()>
Deletes a card
Sourcepub async fn get_collection(&self, id: MetabaseId) -> Result<Collection>
pub async fn get_collection(&self, id: MetabaseId) -> Result<Collection>
Gets a collection by ID
Sourcepub async fn list_collections(&self) -> Result<Vec<Collection>>
pub async fn list_collections(&self) -> Result<Vec<Collection>>
Lists all collections
Sourcepub async fn create_collection(
&self,
collection: Collection,
) -> Result<Collection>
pub async fn create_collection( &self, collection: Collection, ) -> Result<Collection>
Creates a new collection
Sourcepub async fn update_collection(
&self,
id: MetabaseId,
updates: Value,
) -> Result<Collection>
pub async fn update_collection( &self, id: MetabaseId, updates: Value, ) -> Result<Collection>
Updates an existing collection
Sourcepub async fn archive_collection(&self, id: MetabaseId) -> Result<Collection>
pub async fn archive_collection(&self, id: MetabaseId) -> Result<Collection>
Archives a collection (Metabase doesn’t delete, only archives)
Sourcepub async fn get_dashboard(&self, id: MetabaseId) -> Result<Dashboard>
pub async fn get_dashboard(&self, id: MetabaseId) -> Result<Dashboard>
Gets a dashboard by ID
Sourcepub async fn list_dashboards(
&self,
pagination: Option<Pagination>,
) -> Result<Vec<Dashboard>>
pub async fn list_dashboards( &self, pagination: Option<Pagination>, ) -> Result<Vec<Dashboard>>
Lists all dashboards
Sourcepub async fn create_dashboard(&self, dashboard: Dashboard) -> Result<Dashboard>
pub async fn create_dashboard(&self, dashboard: Dashboard) -> Result<Dashboard>
Creates a new dashboard
Sourcepub async fn update_dashboard(
&self,
id: MetabaseId,
updates: Value,
) -> Result<Dashboard>
pub async fn update_dashboard( &self, id: MetabaseId, updates: Value, ) -> Result<Dashboard>
Updates an existing dashboard
Sourcepub async fn delete_dashboard(&self, id: MetabaseId) -> Result<()>
pub async fn delete_dashboard(&self, id: MetabaseId) -> Result<()>
Deletes a dashboard
Sourcepub async fn execute_query(&self, query: DatasetQuery) -> Result<QueryResult>
pub async fn execute_query(&self, query: DatasetQuery) -> Result<QueryResult>
Executes a dataset query
Sourcepub async fn execute_native_query(
&self,
database: MetabaseId,
native_query: NativeQuery,
) -> Result<QueryResult>
pub async fn execute_native_query( &self, database: MetabaseId, native_query: NativeQuery, ) -> Result<QueryResult>
Executes a native SQL query
Sourcepub async fn execute_card_query(
&self,
card_id: i64,
parameters: Option<Value>,
) -> Result<QueryResult>
pub async fn execute_card_query( &self, card_id: i64, parameters: Option<Value>, ) -> Result<QueryResult>
Execute a card’s query with optional parameters
Sourcepub async fn export_card_query(
&self,
card_id: i64,
format: ExportFormat,
parameters: Option<Value>,
) -> Result<Vec<u8>>
pub async fn export_card_query( &self, card_id: i64, format: ExportFormat, parameters: Option<Value>, ) -> Result<Vec<u8>>
Export card query results in specified format
Sourcepub async fn execute_card_pivot_query(
&self,
card_id: i64,
parameters: Option<Value>,
) -> Result<QueryResult>
pub async fn execute_card_pivot_query( &self, card_id: i64, parameters: Option<Value>, ) -> Result<QueryResult>
Execute a pivot query for a card
Sourcepub async fn get_database_metadata(
&self,
database_id: MetabaseId,
) -> Result<DatabaseMetadata>
pub async fn get_database_metadata( &self, database_id: MetabaseId, ) -> Result<DatabaseMetadata>
Get database metadata including tables and fields
Sourcepub async fn sync_database_schema(
&self,
database_id: MetabaseId,
) -> Result<SyncResult>
pub async fn sync_database_schema( &self, database_id: MetabaseId, ) -> Result<SyncResult>
Sync database schema
Sourcepub async fn get_database_fields(
&self,
database_id: MetabaseId,
) -> Result<Vec<Field>>
pub async fn get_database_fields( &self, database_id: MetabaseId, ) -> Result<Vec<Field>>
Get all fields for a database
Sourcepub async fn get_database_schemas(
&self,
database_id: MetabaseId,
) -> Result<Vec<String>>
pub async fn get_database_schemas( &self, database_id: MetabaseId, ) -> Result<Vec<String>>
Get all schemas for a database
Sourcepub async fn execute_dataset_query(&self, query: Value) -> Result<QueryResult>
pub async fn execute_dataset_query(&self, query: Value) -> Result<QueryResult>
Execute a dataset query with advanced options
Sourcepub async fn execute_dataset_native(&self, query: Value) -> Result<QueryResult>
pub async fn execute_dataset_native(&self, query: Value) -> Result<QueryResult>
Execute a native query through the dataset endpoint
Sourcepub async fn execute_dataset_pivot(&self, query: Value) -> Result<QueryResult>
pub async fn execute_dataset_pivot(&self, query: Value) -> Result<QueryResult>
Execute a pivot dataset query
Sourcepub async fn export_dataset(
&self,
format: ExportFormat,
query: Value,
) -> Result<Vec<u8>>
pub async fn export_dataset( &self, format: ExportFormat, query: Value, ) -> Result<Vec<u8>>
Export dataset query results
Sourcepub async fn execute_sql(
&self,
database_id: MetabaseId,
sql: &str,
) -> Result<QueryResult>
pub async fn execute_sql( &self, database_id: MetabaseId, sql: &str, ) -> Result<QueryResult>
Execute a simple SQL query
Sourcepub async fn execute_sql_with_params(
&self,
database_id: MetabaseId,
sql: &str,
params: HashMap<String, Value>,
) -> Result<QueryResult>
pub async fn execute_sql_with_params( &self, database_id: MetabaseId, sql: &str, params: HashMap<String, Value>, ) -> Result<QueryResult>
Execute a parameterized SQL query
Sourcepub async fn export_sql_query(
&self,
database_id: MetabaseId,
sql: &str,
format: ExportFormat,
) -> Result<Vec<u8>>
pub async fn export_sql_query( &self, database_id: MetabaseId, sql: &str, format: ExportFormat, ) -> Result<Vec<u8>>
Export SQL query results in specified format
Trait Implementations§
Source§impl Clone for MetabaseClient
impl Clone for MetabaseClient
Source§fn clone(&self) -> MetabaseClient
fn clone(&self) -> MetabaseClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more