| 631 | } |
| 632 | |
| 633 | pub fn unshare_session(&self, session_id: &str) -> anyhow::Result<bool> { |
| 634 | let url = format!("{}/session/{}/share", self.base_url, session_id); |
| 635 | let response = self.client.delete(&url).send()?; |
| 636 | if !response.status().is_success() { |
| 637 | let status = response.status(); |
| 638 | let text = response.text().unwrap_or_default(); |
| 639 | anyhow::bail!( |
| 640 | "Failed to unshare session `{}`: {} - {}", |
| 641 | session_id, |
| 642 | status, |
| 643 | text |
| 644 | ); |
| 645 | } |
| 646 | let value = response.json::<serde_json::Value>()?; |
| 647 | Ok(value |
| 648 | .get("success") |
| 649 | .and_then(|v| v.as_bool()) |
| 650 | .unwrap_or(true)) |
| 651 | } |
| 652 | |
| 653 | pub fn compact_session(&self, session_id: &str) -> anyhow::Result<CompactResponse> { |
| 654 | let url = format!("{}/session/{}/compact", self.base_url, session_id); |