|
|
@ -25,6 +25,7 @@ pub struct StatusBuilder { |
|
|
|
media_ids: Option<Vec<String>>, |
|
|
|
media_ids: Option<Vec<String>>, |
|
|
|
sensitive: Option<bool>, |
|
|
|
sensitive: Option<bool>, |
|
|
|
spoiler_text: Option<String>, |
|
|
|
spoiler_text: Option<String>, |
|
|
|
|
|
|
|
content_type: Option<String>, |
|
|
|
visibility: Option<Visibility>, |
|
|
|
visibility: Option<Visibility>, |
|
|
|
language: Option<Language>, |
|
|
|
language: Option<Language>, |
|
|
|
} |
|
|
|
} |
|
|
@ -150,6 +151,35 @@ impl StatusBuilder { |
|
|
|
self |
|
|
|
self |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Set the content type of the post
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// This is a Pleroma and Glitch-soc extension of the API.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Possible values
|
|
|
|
|
|
|
|
/// - `text/plain`
|
|
|
|
|
|
|
|
/// - `text/html`
|
|
|
|
|
|
|
|
/// - `text/markdown`
|
|
|
|
|
|
|
|
/// - `text/bbcode` (Pleroma only)
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// The set of supported content types may vary by server.
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// # Example
|
|
|
|
|
|
|
|
///
|
|
|
|
|
|
|
|
/// ```rust
|
|
|
|
|
|
|
|
/// # use elefren::prelude::*;
|
|
|
|
|
|
|
|
/// # fn main() -> Result<(), elefren::Error> {
|
|
|
|
|
|
|
|
/// let status = StatusBuilder::new()
|
|
|
|
|
|
|
|
/// .status("<b>thicc</b>")
|
|
|
|
|
|
|
|
/// .content_type("text/html")
|
|
|
|
|
|
|
|
/// .build()?;
|
|
|
|
|
|
|
|
/// # Ok(())
|
|
|
|
|
|
|
|
/// # }
|
|
|
|
|
|
|
|
/// ```
|
|
|
|
|
|
|
|
pub fn content_type<I: Into<String>>(&mut self, content_type: I) -> &mut Self { |
|
|
|
|
|
|
|
self.content_type = Some(content_type.into()); |
|
|
|
|
|
|
|
self |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Set the visibility for the post
|
|
|
|
/// Set the visibility for the post
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// # Example
|
|
|
|
/// # Example
|
|
|
@ -215,6 +245,7 @@ impl StatusBuilder { |
|
|
|
spoiler_text: self.spoiler_text.clone(), |
|
|
|
spoiler_text: self.spoiler_text.clone(), |
|
|
|
visibility: self.visibility.clone(), |
|
|
|
visibility: self.visibility.clone(), |
|
|
|
language: self.language.clone(), |
|
|
|
language: self.language.clone(), |
|
|
|
|
|
|
|
content_type: self.content_type.clone(), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -236,6 +267,8 @@ pub struct NewStatus { |
|
|
|
visibility: Option<Visibility>, |
|
|
|
visibility: Option<Visibility>, |
|
|
|
#[serde(skip_serializing_if = "Option::is_none")] |
|
|
|
#[serde(skip_serializing_if = "Option::is_none")] |
|
|
|
language: Option<Language>, |
|
|
|
language: Option<Language>, |
|
|
|
|
|
|
|
#[serde(skip_serializing_if = "Option::is_none")] |
|
|
|
|
|
|
|
content_type: Option<String>, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// The visibility of a status.
|
|
|
|
/// The visibility of a status.
|
|
|
@ -278,6 +311,7 @@ mod tests { |
|
|
|
spoiler_text: None, |
|
|
|
spoiler_text: None, |
|
|
|
visibility: None, |
|
|
|
visibility: None, |
|
|
|
language: None, |
|
|
|
language: None, |
|
|
|
|
|
|
|
content_type: None, |
|
|
|
}; |
|
|
|
}; |
|
|
|
assert_eq!(s, expected); |
|
|
|
assert_eq!(s, expected); |
|
|
|
} |
|
|
|
} |
|
|
|