(self: &Arc<Self>, maintenance_id: i32)
| 1009 | } |
| 1010 | |
| 1011 | pub async fn get_maintenance(self: &Arc<Self>, maintenance_id: i32) -> Result<Maintenance> { |
| 1012 | let mut maintenance: Maintenance = self |
| 1013 | .call( |
| 1014 | "getMaintenance", |
| 1015 | vec![serde_json::to_value(maintenance_id.clone()).unwrap()], |
| 1016 | "/maintenance", |
| 1017 | true, |
| 1018 | ) |
| 1019 | .await |
| 1020 | .map_err(|e| match e { |
| 1021 | Error::ServerError(msg) if msg.contains("Cannot read properties of null") => { |
| 1022 | Error::IdNotFound("Maintenance".to_owned(), maintenance_id) |
| 1023 | } |
| 1024 | _ => e, |
| 1025 | })?; |
| 1026 | |
| 1027 | maintenance.common_mut().monitors = |
| 1028 | Some(self.get_maintenance_monitors(maintenance_id).await?); |
| 1029 | maintenance.common_mut().status_pages = |
| 1030 | Some(self.get_maintenance_status_pages(maintenance_id).await?); |
| 1031 | |
| 1032 | Ok(maintenance) |
| 1033 | } |
| 1034 | |
| 1035 | pub async fn edit_maintenance(self: &Arc<Self>, maintenance: &mut Maintenance) -> Result<()> { |
| 1036 | let id = self |
no test coverage detected