This commit is contained in:
@@ -51,6 +51,17 @@ impl ApiClient {
|
||||
self.send_json("/v1/tasks", task)
|
||||
}
|
||||
|
||||
pub fn update_task(&self, id: i64, task: &CreateTask) -> Result<(), String> {
|
||||
let body = serde_json::to_string(task).map_err(|error| error.to_string())?;
|
||||
let response = self
|
||||
.authorize(minreq::put(self.url(&format!("/v1/tasks/{id}"))))
|
||||
.with_header("Content-Type", "application/json")
|
||||
.with_body(body)
|
||||
.send()
|
||||
.map_err(transport_error)?;
|
||||
check_status(response)
|
||||
}
|
||||
|
||||
pub fn create_routine(&self, routine: &CreateRoutine) -> Result<(), String> {
|
||||
self.send_json("/v1/routines", routine)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user