use uuid::Uuid;
use ironflow_types::ApiResponse;
use crate::client::IronflowClient;
use crate::error::Error;
use crate::types;
impl IronflowClient {
pub async fn list_schedules(&self) -> Result<ApiResponse<Vec<types::ScheduleResponse>>, Error> {
self.send_envelope(self.get("/api/v1/schedules")).await
}
pub async fn create_schedule(
&self,
request: &types::CreateScheduleRequest,
) -> Result<ApiResponse<types::ScheduleResponse>, Error> {
self.send_envelope(self.post("/api/v1/schedules").json(request))
.await
}
pub async fn get_schedule(
&self,
id: Uuid,
) -> Result<ApiResponse<types::ScheduleResponse>, Error> {
self.send_envelope(self.get(&format!("/api/v1/schedules/{id}")))
.await
}
pub async fn delete_schedule(&self, id: Uuid) -> Result<(), Error> {
self.send_no_content(self.delete(&format!("/api/v1/schedules/{id}")))
.await
}
pub async fn pause_schedule(
&self,
id: Uuid,
) -> Result<ApiResponse<types::ScheduleResponse>, Error> {
self.send_envelope(self.post(&format!("/api/v1/schedules/{id}/pause")))
.await
}
pub async fn resume_schedule(
&self,
id: Uuid,
) -> Result<ApiResponse<types::ScheduleResponse>, Error> {
self.send_envelope(self.post(&format!("/api/v1/schedules/{id}/resume")))
.await
}
pub async fn trigger_schedule(
&self,
id: Uuid,
) -> Result<ApiResponse<types::ScheduleResponse>, Error> {
self.send_envelope(self.post(&format!("/api/v1/schedules/{id}/trigger")))
.await
}
}