pub struct BappApiClient {
pub host: String,
pub tenant: Option<String>,
pub app: String,
/* private fields */
}Expand description
BAPP Auto API client.
Fields§
§host: String§tenant: Option<String>§app: StringImplementations§
Source§impl BappApiClient
impl BappApiClient
Sourcepub fn with_bearer(self, token: &str) -> Self
pub fn with_bearer(self, token: &str) -> Self
Set Bearer token authentication.
Sourcepub fn with_token(self, token: &str) -> Self
pub fn with_token(self, token: &str) -> Self
Set Token-based authentication.
Sourcepub fn with_tenant(self, tenant: &str) -> Self
pub fn with_tenant(self, tenant: &str) -> Self
Set the default tenant ID.
Sourcepub async fn request_multipart(
&self,
method: Method,
path: &str,
fields: &[(&str, &str)],
files: &[(&str, &str)],
) -> Result<Option<Value>, Error>
pub async fn request_multipart( &self, method: Method, path: &str, fields: &[(&str, &str)], files: &[(&str, &str)], ) -> Result<Option<Value>, Error>
Send a multipart/form-data request. Use for file uploads.
fields are plain text fields, files are (field_name, file_path) pairs.
Sourcepub async fn get_app(&self, app_slug: &str) -> Result<Option<Value>, Error>
pub async fn get_app(&self, app_slug: &str) -> Result<Option<Value>, Error>
Get app configuration by slug.
Sourcepub async fn list_introspect(
&self,
content_type: &str,
) -> Result<Option<Value>, Error>
pub async fn list_introspect( &self, content_type: &str, ) -> Result<Option<Value>, Error>
Get entity list introspect for a content type.
Sourcepub async fn detail_introspect(
&self,
content_type: &str,
pk: Option<&str>,
) -> Result<Option<Value>, Error>
pub async fn detail_introspect( &self, content_type: &str, pk: Option<&str>, ) -> Result<Option<Value>, Error>
Get entity detail introspect for a content type.
Sourcepub async fn list(
&self,
content_type: &str,
filters: Option<&[(&str, &str)]>,
) -> Result<PagedList, Box<dyn Error>>
pub async fn list( &self, content_type: &str, filters: Option<&[(&str, &str)]>, ) -> Result<PagedList, Box<dyn Error>>
List entities of a content type. Returns a PagedList.
Sourcepub async fn get(
&self,
content_type: &str,
id: &str,
) -> Result<Option<Value>, Error>
pub async fn get( &self, content_type: &str, id: &str, ) -> Result<Option<Value>, Error>
Get a single entity by content type and ID.
Sourcepub async fn create(
&self,
content_type: &str,
data: Option<&Value>,
) -> Result<Option<Value>, Error>
pub async fn create( &self, content_type: &str, data: Option<&Value>, ) -> Result<Option<Value>, Error>
Create a new entity.
Sourcepub async fn update(
&self,
content_type: &str,
id: &str,
data: Option<&Value>,
) -> Result<Option<Value>, Error>
pub async fn update( &self, content_type: &str, id: &str, data: Option<&Value>, ) -> Result<Option<Value>, Error>
Full update of an entity.
Sourcepub async fn patch(
&self,
content_type: &str,
id: &str,
data: Option<&Value>,
) -> Result<Option<Value>, Error>
pub async fn patch( &self, content_type: &str, id: &str, data: Option<&Value>, ) -> Result<Option<Value>, Error>
Partial update of an entity.
Sourcepub async fn delete(
&self,
content_type: &str,
id: &str,
) -> Result<Option<Value>, Error>
pub async fn delete( &self, content_type: &str, id: &str, ) -> Result<Option<Value>, Error>
Delete an entity.
Sourcepub async fn detail_task(&self, code: &str) -> Result<Option<Value>, Error>
pub async fn detail_task(&self, code: &str) -> Result<Option<Value>, Error>
Get task configuration by code.
Sourcepub async fn run_task(
&self,
code: &str,
payload: Option<&Value>,
) -> Result<Option<Value>, Error>
pub async fn run_task( &self, code: &str, payload: Option<&Value>, ) -> Result<Option<Value>, Error>
Run a task. Uses GET when no payload, POST otherwise.
Sourcepub async fn run_task_async(
&self,
code: &str,
payload: Option<&Value>,
poll_interval: Option<Duration>,
timeout: Option<Duration>,
) -> Result<Value, Box<dyn Error>>
pub async fn run_task_async( &self, code: &str, payload: Option<&Value>, poll_interval: Option<Duration>, timeout: Option<Duration>, ) -> Result<Value, Box<dyn Error>>
Run a long-running task and poll until finished. Returns the final task data which includes “file” when the task produces a download.