Struct mz_metabase::Client
source · [−]pub struct Client { /* private fields */ }
Expand description
A Metabase API client.
Implementations
sourceimpl Client
impl Client
sourcepub fn new<U>(url: U) -> Result<Self, Error> where
U: IntoUrl,
pub fn new<U>(url: U) -> Result<Self, Error> where
U: IntoUrl,
Constructs a new Client
that will target a Metabase instance at url
.
url
must not contain a path nor be a cannot-be-a-base URL.
sourcepub fn set_session_id(&mut self, session_id: String)
pub fn set_session_id(&mut self, session_id: String)
Sets the session ID to include in future requests made by this client.
sourcepub async fn session_properties(
&self
) -> Result<SessionPropertiesResponse, Error>
pub async fn session_properties(
&self
) -> Result<SessionPropertiesResponse, Error>
Fetches public, global properties.
The underlying API call is GET /api/session/properties
.
sourcepub async fn login(
&self,
request: &LoginRequest
) -> Result<LoginResponse, Error>
pub async fn login(
&self,
request: &LoginRequest
) -> Result<LoginResponse, Error>
Requests a session ID for the username and password named in request
.
Note that usernames are typically email addresses. To authenticate
future requests with the returned session ID, call set_session_id
.
The underlying API call is POST /api/session
.
sourcepub async fn setup(
&self,
request: &SetupRequest
) -> Result<LoginResponse, Error>
pub async fn setup(
&self,
request: &SetupRequest
) -> Result<LoginResponse, Error>
Creates a user and database connection if the Metabase instance has not yet been set up.
The request must include the setup_token
from a
SessionPropertiesResponse
. If the setup token returned by
Client::session_properties
is None
, the cluster is already set up,
and this request will fail.
The underlying API call is POST /api/setup
.
sourcepub async fn databases(&self) -> Result<Vec<Database>, Error>
pub async fn databases(&self) -> Result<Vec<Database>, Error>
Fetches the list of databases known to Metabase.
The underlying API call is GET /database
.
sourcepub async fn database_metadata(
&self,
id: usize
) -> Result<DatabaseMetadata, Error>
pub async fn database_metadata(
&self,
id: usize
) -> Result<DatabaseMetadata, Error>
Fetches metadata about a particular database.
The underlying API call is GET /database/:id/metadata
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more