dsc-rs 0.10.15

Discourse CLI tool for managing multiple Discourse forums: track installs, run upgrades over SSH, manage emojis, sync topics and categories as Markdown, and more.
Documentation
use anyhow::{Context, Result};
use serde_json::Value;

use super::client::DiscourseClient;
use super::error::http_error;

impl DiscourseClient {
    /// List installed plugins on the Discourse instance.
    pub fn list_plugins(&self) -> Result<Value> {
        let response = self.get("/admin/plugins.json")?;
        let status = response.status();
        let text = response.text().context("reading plugins response body")?;
        if !status.is_success() {
            return Err(http_error("plugins request", status, &text));
        }
        let value: Value = serde_json::from_str(&text).context("parsing plugins response")?;
        Ok(value)
    }
}