llmrix_rust_sdk/resources/
cron.rs1use std::sync::Arc;
2use crate::{error::Result, model::*, transport::*};
3
4pub struct CronResource {
6 pub(crate) t: Arc<Transport>,
7}
8
9impl CronResource {
10 pub async fn list(&self) -> Result<Vec<CronTask>> {
12 self.t.get_unwrap(&path_cron_tasks(), "tasks").await
13 }
14
15 pub async fn create(&self, req: CronCreateRequest) -> Result<CronTask> {
17 self.t.post(&path_cron_tasks(), &req).await
18 }
19
20 pub async fn get(&self, task_id: &str) -> Result<CronTask> {
22 self.t.get(&path_cron_task(task_id)).await
23 }
24
25 pub async fn update(&self, task_id: &str, req: CronUpdateRequest) -> Result<CronTask> {
27 self.t.put(&path_cron_task(task_id), &req).await
28 }
29
30 pub async fn pause(&self, task_id: &str) -> Result<CronTask> {
32 self.t.post(&path_cron_pause(task_id), &serde_json::Value::Object(Default::default())).await
33 }
34
35 pub async fn resume(&self, task_id: &str) -> Result<CronTask> {
37 self.t.post(&path_cron_resume(task_id), &serde_json::Value::Object(Default::default())).await
38 }
39
40 pub async fn delete(&self, task_id: &str) -> Result<()> {
42 self.t.delete(&path_cron_task(task_id)).await
43 }
44}