Trait rawr::traits::Flairable
[−]
[src]
pub trait Flairable { fn get_flair_text(&self) -> Option<String>; fn get_flair_css(&self) -> Option<String>; fn flair_options(&self) -> Result<FlairList, APIError>; fn flair(&self, template: &str) -> Result<(), APIError>; }
An object that has a flair and can be given a flair by the creator or a moderator.
Required Methods
fn get_flair_text(&self) -> Option<String>
Gets the current flair text, if present.
fn get_flair_css(&self) -> Option<String>
Gets the current CSS class of the flair, if present.
fn flair_options(&self) -> Result<FlairList, APIError>
Tries to fetch the flair options for this item. If you do not have the privileges to add
a flair to this (i.e. not moderator or author), this will give an
APIError::HTTPError(Forbidden)
.
fn flair(&self, template: &str) -> Result<(), APIError>
Sets the flair for this post, if possible. The template
parameter is the
FlairChoice.flair_template_id
field. The template will also be returned if using
FlairList.find_text
. This may fail with APIError::HTTPError(Forbidden)
if you are
not authorized to do this.
Implementors
impl<'a> Flairable for Submission<'a>