fundaia 0.52.3

Command line for the Fundaia deployment platform: projects, services, variables, deployments, logs and metrics
use super::*;

impl ApiClient {
    pub async fn data_overview(&self, service_environment_id: &str) -> Result<DataOverview> {
        self.get(&format!(
            "/api/infra/services/{service_environment_id}/data"
        ))
        .await
    }

    pub async fn query_data(
        &self,
        service_environment_id: &str,
        sql: &str,
        limit: Option<u64>,
    ) -> Result<QueryOutcome> {
        self.post(
            &format!("/api/infra/services/{service_environment_id}/data/query"),
            &serde_json::json!({ "sql": sql, "limit": limit }),
        )
        .await
    }

    pub async fn execute_sql(
        &self,
        service_environment_id: &str,
        sql: &str,
        preview: bool,
    ) -> Result<ExecutionOutcome> {
        self.post(
            &format!("/api/infra/services/{service_environment_id}/data/execute"),
            &serde_json::json!({ "sql": sql, "preview": preview }),
        )
        .await
    }
}