pub struct DiscourseClient { /* private fields */ }Expand description
HTTP client for the Discourse API.
Implementations§
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn create_backup(&self) -> Result<()>
pub fn create_backup(&self) -> Result<()>
Trigger a backup on the Discourse instance.
Sourcepub fn list_backups(&self) -> Result<Value>
pub fn list_backups(&self) -> Result<Value>
List backups available on the Discourse instance.
Sourcepub fn restore_backup(&self, backup_path: &str) -> Result<()>
pub fn restore_backup(&self, backup_path: &str) -> Result<()>
Restore a backup by filename/path.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn fetch_category(&self, category_id: u64) -> Result<CategoryResponse>
pub fn fetch_category(&self, category_id: u64) -> Result<CategoryResponse>
Fetch a category by ID (topics list included).
Sourcepub fn fetch_categories(&self) -> Result<Vec<CategoryInfo>>
pub fn fetch_categories(&self) -> Result<Vec<CategoryInfo>>
Fetch all categories.
Sourcepub fn create_category(&self, category: &CategoryInfo) -> Result<u64>
pub fn create_category(&self, category: &CategoryInfo) -> Result<u64>
Create a category with basic fields copied from a source category.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn new(config: &DiscourseConfig) -> Result<Self>
pub fn new(config: &DiscourseConfig) -> Result<Self>
Create a new Discourse API client.
Sourcepub fn fetch_site_title(&self) -> Result<String>
pub fn fetch_site_title(&self) -> Result<String>
Fetch the Discourse site title.
Sourcepub fn fetch_version_info(&self) -> Result<VersionInfo>
pub fn fetch_version_info(&self) -> Result<VersionInfo>
Fetch the current Discourse version and commit hash.
Sourcepub fn fetch_version(&self) -> Result<Option<String>>
pub fn fetch_version(&self) -> Result<Option<String>>
Fetch the current Discourse version (best-effort).
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn upload_emoji(&self, emoji_path: &Path, emoji_name: &str) -> Result<()>
pub fn upload_emoji(&self, emoji_path: &Path, emoji_name: &str) -> Result<()>
Upload a custom emoji.
Sourcepub fn list_custom_emojis(&self) -> Result<Vec<CustomEmoji>>
pub fn list_custom_emojis(&self) -> Result<Vec<CustomEmoji>>
List custom emojis.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn fetch_groups(&self) -> Result<Vec<GroupSummary>>
pub fn fetch_groups(&self) -> Result<Vec<GroupSummary>>
Fetch all groups.
Sourcepub fn fetch_group_detail(
&self,
group_id: u64,
group_name: Option<&str>,
) -> Result<GroupDetail>
pub fn fetch_group_detail( &self, group_id: u64, group_name: Option<&str>, ) -> Result<GroupDetail>
Fetch group details by ID (fallbacks to name lookup if needed).
pub fn fetch_group_members( &self, group_id: u64, group_name: Option<&str>, ) -> Result<Vec<GroupMember>>
Sourcepub fn create_group(&self, group: &GroupDetail) -> Result<u64>
pub fn create_group(&self, group: &GroupDetail) -> Result<u64>
Create a group with detailed settings copied from a source group.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn list_color_schemes(&self) -> Result<Value>
pub fn list_color_schemes(&self) -> Result<Value>
List color schemes (palettes) available on the Discourse instance.
Sourcepub fn fetch_color_scheme(&self, scheme_id: u64) -> Result<Value>
pub fn fetch_color_scheme(&self, scheme_id: u64) -> Result<Value>
Fetch a color scheme (palette) by ID.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn list_plugins(&self) -> Result<Value>
pub fn list_plugins(&self) -> Result<Value>
List installed plugins on the Discourse instance.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn update_site_setting(&self, setting: &str, value: &str) -> Result<()>
pub fn update_site_setting(&self, setting: &str, value: &str) -> Result<()>
Update a site setting by name (admin only).
Sourcepub fn list_site_settings(&self) -> Result<Value>
pub fn list_site_settings(&self) -> Result<Value>
Fetch all site settings (admin only). Returns raw JSON value.
Sourcepub fn fetch_site_setting(&self, setting: &str) -> Result<String>
pub fn fetch_site_setting(&self, setting: &str) -> Result<String>
Fetch a single site setting by name (admin only). Returns the value as a string, or an error if not found.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn list_themes(&self) -> Result<Value>
pub fn list_themes(&self) -> Result<Value>
List installed themes on the Discourse instance.
Sourcepub fn fetch_theme(&self, theme_id: u64) -> Result<Value>
pub fn fetch_theme(&self, theme_id: u64) -> Result<Value>
Fetch a single theme by ID.
Sourcepub fn create_theme(&self, theme: &Value) -> Result<u64>
pub fn create_theme(&self, theme: &Value) -> Result<u64>
Create a new theme and return its ID.
Sourcepub fn delete_theme(&self, theme_id: u64) -> Result<()>
pub fn delete_theme(&self, theme_id: u64) -> Result<()>
Delete a theme by ID.
Source§impl DiscourseClient
impl DiscourseClient
Sourcepub fn fetch_topic(
&self,
topic_id: u64,
include_raw: bool,
) -> Result<TopicResponse>
pub fn fetch_topic( &self, topic_id: u64, include_raw: bool, ) -> Result<TopicResponse>
Fetch a topic by ID.
Sourcepub fn fetch_post_raw(&self, post_id: u64) -> Result<Option<String>>
pub fn fetch_post_raw(&self, post_id: u64) -> Result<Option<String>>
Fetch a post by ID and return its raw content.
Trait Implementations§
Source§impl Clone for DiscourseClient
impl Clone for DiscourseClient
Source§fn clone(&self) -> DiscourseClient
fn clone(&self) -> DiscourseClient
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more