From cc6bd77cab570c970edc8041bb8a0a0d2a076115 Mon Sep 17 00:00:00 2001 From: "D. Scott Boggs" Date: Wed, 4 Jan 2023 08:46:33 -0500 Subject: [PATCH] Publish NewStatus fields --- src/status_builder.rs | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/src/status_builder.rs b/src/status_builder.rs index a49e245..fb1b2eb 100644 --- a/src/status_builder.rs +++ b/src/status_builder.rs @@ -220,24 +220,43 @@ impl StatusBuilder { } /// Represents a post that can be sent to the POST /api/v1/status endpoint +/// +/// See also [the API documentation](https://docs.joinmastodon.org/methods/statuses/#form-data-parameters) #[derive(Debug, Default, Clone, Serialize, PartialEq, Eq)] pub struct NewStatus { + /// The text content of the status. If media_ids is provided, this becomes + /// optional. Attaching a poll is optional while status is provided. + /// + /// Note that this means there is at this time no check provided by this + /// type to ensure that this value is set when it is required by the API, + /// and an APIError should be expected from [`crate::Mastodon::new_status()`] + /// in this case. #[serde(skip_serializing_if = "Option::is_none")] - status: Option, + pub status: Option, + /// ID of the status being replied to, if status is a reply. #[serde(skip_serializing_if = "Option::is_none")] - in_reply_to_id: Option, + pub in_reply_to_id: Option, + /// Include Attachment IDs to be attached as media. If provided, status + /// becomes optional, and poll cannot be used. #[serde(skip_serializing_if = "Option::is_none")] - media_ids: Option>, + pub media_ids: Option>, + /// Mark status and attached media as sensitive? Defaults to false. #[serde(skip_serializing_if = "Option::is_none")] - sensitive: Option, + pub sensitive: Option, #[serde(skip_serializing_if = "Option::is_none")] - spoiler_text: Option, + /// Text to be shown as a warning or subject before the actual content. + /// Statuses are generally collapsed behind this field. + pub spoiler_text: Option, + /// Sets the visibility of the posted status to public, unlisted, private, direct. #[serde(skip_serializing_if = "Option::is_none")] - visibility: Option, + pub visibility: Option, + /// ISO 639 language code for this status. #[serde(skip_serializing_if = "Option::is_none")] - language: Option, + pub language: Option, + /// Ignored by Mastodon servers, sets the content type for the status. + /// Mastodon "toots" are always `text/plain`, regardless of this value. #[serde(skip_serializing_if = "Option::is_none")] - content_type: Option, + pub content_type: Option, } #[cfg(test)]