mastodon API rust lib elefren, fixed and updated. and also all ASYNC! NB. most examples are now wrong.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
elefren-fork/src/entities/status.rs

86 lines
2.7 KiB

//! Module containing all info relating to a status.
8 years ago
use chrono::prelude::*;
use super::prelude::*;
use status_builder::Visibility;
/// A status from the instance.
#[derive(Debug, Clone, Deserialize)]
8 years ago
pub struct Status {
/// The ID of the status.
pub id: String,
/// A Fediverse-unique resource ID.
8 years ago
pub uri: String,
/// URL to the status page (can be remote)
pub url: Option<String>,
/// The Account which posted the status.
8 years ago
pub account: Account,
/// The ID of the status this status is replying to, if the status is
/// a reply.
pub in_reply_to_id: Option<String>,
/// The ID of the account this status is replying to, if the status is
/// a reply.
pub in_reply_to_account_id: Option<String>,
/// If this status is a reblogged Status of another User.
8 years ago
pub reblog: Option<Box<Status>>,
/// Body of the status; this will contain HTML
/// (remote HTML already sanitized)
8 years ago
pub content: String,
/// The time the status was created.
pub created_at: DateTime<Utc>,
/// The number of reblogs for the status.
8 years ago
pub reblogs_count: u64,
/// The number of favourites for the status.
8 years ago
pub favourites_count: u64,
/// Whether the application client has reblogged the status.
pub reblogged: Option<bool>,
/// Whether the application client has favourited the status.
pub favourited: Option<bool>,
/// Whether media attachments should be hidden by default.
pub sensitive: bool,
/// If not empty, warning text that should be displayed before the actual
/// content.
8 years ago
pub spoiler_text: String,
/// The visibilty of the status.
8 years ago
pub visibility: Visibility,
/// An array of attachments.
8 years ago
pub media_attachments: Vec<Attachment>,
/// An array of mentions.
8 years ago
pub mentions: Vec<Mention>,
/// An array of tags.
8 years ago
pub tags: Vec<Tag>,
/// Name of application used to post status.
pub application: Option<Application>,
8 years ago
}
/// A mention of another user.
#[derive(Debug, Clone, Deserialize)]
8 years ago
pub struct Mention {
/// URL of user's profile (can be remote).
8 years ago
pub url: String,
/// The username of the account.
8 years ago
pub username: String,
/// Equals `username` for local users, includes `@domain` for remote ones.
8 years ago
pub acct: String,
/// Account ID.
pub id: String,
8 years ago
}
/// Hashtags in the status.
#[derive(Debug, Clone, Deserialize)]
8 years ago
pub struct Tag {
/// The hashtag, not including the preceding `#`.
8 years ago
pub name: String,
/// The URL of the hashtag.
8 years ago
pub url: String,
}
/// Application details.
#[derive(Debug, Clone, Deserialize)]
8 years ago
pub struct Application {
/// Name of the application.
8 years ago
pub name: String,
/// Homepage URL of the application.
pub website: Option<String>,
8 years ago
}