parent
87bcc139bb
commit
b445197381
@ -1,19 +1,39 @@ |
|||||||
|
//! A module containing everything relating to a account returned from the api.
|
||||||
|
|
||||||
use chrono::prelude::*; |
use chrono::prelude::*; |
||||||
|
|
||||||
|
/// A struct representing an Account.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Account { |
pub struct Account { |
||||||
pub id: u64, |
/// Equals `username` for local users, includes `@domain` for remote ones.
|
||||||
pub username: String, |
|
||||||
pub acct: String, |
pub acct: String, |
||||||
pub display_name: String, |
/// URL to the avatar image
|
||||||
pub note: String, |
|
||||||
pub url: String, |
|
||||||
pub avatar: String, |
pub avatar: String, |
||||||
|
/// URL to the avatar static image (gif)
|
||||||
pub avatar_static: String, |
pub avatar_static: String, |
||||||
pub header: String, |
/// The time the account was created.
|
||||||
pub header_static: String, |
|
||||||
pub locked: bool, |
|
||||||
pub created_at: DateTime<Utc>, |
pub created_at: DateTime<Utc>, |
||||||
|
/// The account's display name.
|
||||||
|
pub display_name: String, |
||||||
|
/// The number of followers for the account.
|
||||||
pub followers_count: u64, |
pub followers_count: u64, |
||||||
|
/// The number of accounts the given account is following.
|
||||||
pub following_count: u64, |
pub following_count: u64, |
||||||
|
/// URL to the header image.
|
||||||
|
pub header: String, |
||||||
|
/// URL to the header static image (gif).
|
||||||
|
pub header_static: String, |
||||||
|
/// The ID of the account.
|
||||||
|
pub id: u64, |
||||||
|
/// Boolean for when the account cannot be followed without waiting for
|
||||||
|
/// approval first.
|
||||||
|
pub locked: bool, |
||||||
|
/// Biography of user.
|
||||||
|
pub note: String, |
||||||
|
/// The number of statuses the account has made.
|
||||||
pub statuses_count: u64, |
pub statuses_count: u64, |
||||||
|
/// URL of the user's profile page (can be remote).
|
||||||
|
pub url: String, |
||||||
|
/// The username of the account.
|
||||||
|
pub username: String, |
||||||
} |
} |
||||||
|
@ -1,39 +1,64 @@ |
|||||||
|
//! Module containing everything related to media attachements.
|
||||||
|
|
||||||
|
/// A struct representing a media attachment.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Attachment { |
pub struct Attachment { |
||||||
|
/// ID of the attachment.
|
||||||
pub id: String, |
pub id: String, |
||||||
|
/// The media type of an attachment.
|
||||||
#[serde(rename="type")] |
#[serde(rename="type")] |
||||||
pub media_type: MediaType, |
pub media_type: MediaType, |
||||||
|
/// URL of the locally hosted version of the image.
|
||||||
pub url: String, |
pub url: String, |
||||||
|
/// For remote images, the remote URL of the original image.
|
||||||
pub remote_url: Option<String>, |
pub remote_url: Option<String>, |
||||||
|
/// URL of the preview image.
|
||||||
pub preview_url: String, |
pub preview_url: String, |
||||||
|
/// Shorter URL for the image, for insertion into text
|
||||||
|
/// (only present on local images)
|
||||||
pub text_url: Option<String>, |
pub text_url: Option<String>, |
||||||
|
/// Meta information about the attachment.
|
||||||
pub meta: Option<Meta>, |
pub meta: Option<Meta>, |
||||||
|
/// Noop will be removed.
|
||||||
pub description: Option<String>, |
pub description: Option<String>, |
||||||
} |
} |
||||||
|
|
||||||
|
/// Information about the attachment itself.
|
||||||
#[derive(Debug, Deserialize, Clone)] |
#[derive(Debug, Deserialize, Clone)] |
||||||
pub struct Meta { |
pub struct Meta { |
||||||
|
/// Original version.
|
||||||
original: ImageDetails, |
original: ImageDetails, |
||||||
|
/// Smaller version.
|
||||||
small: ImageDetails, |
small: ImageDetails, |
||||||
} |
} |
||||||
|
|
||||||
|
/// Dimensions of an attachement.
|
||||||
#[derive(Debug, Deserialize, Clone)] |
#[derive(Debug, Deserialize, Clone)] |
||||||
pub struct ImageDetails { |
pub struct ImageDetails { |
||||||
|
/// width of attachment.
|
||||||
width: u64, |
width: u64, |
||||||
|
/// height of attachment.
|
||||||
height: u64, |
height: u64, |
||||||
|
/// A string of `widthxheight`.
|
||||||
size: String, |
size: String, |
||||||
|
/// The aspect ratio of the attachment.
|
||||||
aspect: f64, |
aspect: f64, |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
|
/// The type of media attachment.
|
||||||
#[derive(Debug, Deserialize, Clone, Copy)] |
#[derive(Debug, Deserialize, Clone, Copy)] |
||||||
pub enum MediaType { |
pub enum MediaType { |
||||||
|
/// An image.
|
||||||
#[serde(rename = "image")] |
#[serde(rename = "image")] |
||||||
Image, |
Image, |
||||||
|
/// A video file.
|
||||||
#[serde(rename = "video")] |
#[serde(rename = "video")] |
||||||
Video, |
Video, |
||||||
|
/// A gifv format file.
|
||||||
#[serde(rename = "gifv")] |
#[serde(rename = "gifv")] |
||||||
Gifv, |
Gifv, |
||||||
|
/// Unknown format.
|
||||||
#[serde(rename = "unknown")] |
#[serde(rename = "unknown")] |
||||||
Unknown, |
Unknown, |
||||||
} |
} |
||||||
|
@ -1,7 +1,14 @@ |
|||||||
|
//! Module representing cards of statuses.
|
||||||
|
|
||||||
|
/// A card of a status.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Card { |
pub struct Card { |
||||||
|
/// The url associated with the card.
|
||||||
pub url: String, |
pub url: String, |
||||||
|
/// The title of the card.
|
||||||
pub title: String, |
pub title: String, |
||||||
|
/// The card description.
|
||||||
pub description: String, |
pub description: String, |
||||||
|
/// The image associated with the card, if any.
|
||||||
pub image: String, |
pub image: String, |
||||||
} |
} |
||||||
|
@ -1,7 +1,13 @@ |
|||||||
|
//! A module about contexts of statuses.
|
||||||
|
|
||||||
use super::status::Status; |
use super::status::Status; |
||||||
|
|
||||||
|
/// A context of a status returning a list of statuses it replied to and
|
||||||
|
/// statuses replied to it.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Context { |
pub struct Context { |
||||||
|
/// Statuses that were replied to.
|
||||||
pub ancestors: Vec<Status>, |
pub ancestors: Vec<Status>, |
||||||
|
/// Statuses that replied to this status.
|
||||||
pub descendants: Vec<Status>, |
pub descendants: Vec<Status>, |
||||||
} |
} |
||||||
|
@ -1,7 +1,15 @@ |
|||||||
|
//! Module containing everything related to an instance.
|
||||||
|
|
||||||
|
/// A struct containing info of an instance.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Instance { |
pub struct Instance { |
||||||
|
/// URI of the current instance
|
||||||
pub uri: String, |
pub uri: String, |
||||||
|
/// The instance's title.
|
||||||
pub title: String, |
pub title: String, |
||||||
|
/// A description for the instance.
|
||||||
pub description: String, |
pub description: String, |
||||||
|
/// An email address which can be used to contact the
|
||||||
|
/// instance administrator.
|
||||||
pub email: String, |
pub email: String, |
||||||
} |
} |
||||||
|
@ -1,25 +1,38 @@ |
|||||||
|
//! Module containing all info about notifications.
|
||||||
|
|
||||||
use chrono::prelude::*; |
use chrono::prelude::*; |
||||||
use super::account::Account; |
use super::account::Account; |
||||||
use super::status::Status; |
use super::status::Status; |
||||||
|
|
||||||
|
/// A struct containing info about a notification.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Notification { |
pub struct Notification { |
||||||
|
/// The notification ID.
|
||||||
pub id: u64, |
pub id: u64, |
||||||
|
/// The type of notification.
|
||||||
#[serde(rename = "type")] |
#[serde(rename = "type")] |
||||||
pub notification_type: NotificationType, |
pub notification_type: NotificationType, |
||||||
|
/// The time the notification was created.
|
||||||
pub created_at: DateTime<Utc>, |
pub created_at: DateTime<Utc>, |
||||||
|
/// The Account sending the notification to the user.
|
||||||
pub account: Account, |
pub account: Account, |
||||||
|
/// The Status associated with the notification, if applicable.
|
||||||
pub status: Option<Status>, |
pub status: Option<Status>, |
||||||
} |
} |
||||||
|
|
||||||
|
/// The type of notification.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub enum NotificationType { |
pub enum NotificationType { |
||||||
|
/// Someone mentioned the application client in another status.
|
||||||
#[serde(rename = "mention")] |
#[serde(rename = "mention")] |
||||||
Mention, |
Mention, |
||||||
|
/// Someone reblogged one of the application client's statuses.
|
||||||
#[serde(rename = "reblog")] |
#[serde(rename = "reblog")] |
||||||
Reblog, |
Reblog, |
||||||
|
/// Someone favourited one of the application client's statuses.
|
||||||
#[serde(rename = "favourite")] |
#[serde(rename = "favourite")] |
||||||
Favourite, |
Favourite, |
||||||
|
/// Someone followed the application client.
|
||||||
#[serde(rename = "follow")] |
#[serde(rename = "follow")] |
||||||
Follow, |
Follow, |
||||||
} |
} |
||||||
|
@ -1,8 +1,17 @@ |
|||||||
|
//! module containing everything relating to a relationship with
|
||||||
|
//! another account.
|
||||||
|
|
||||||
|
/// A struct containing information about a relationship with another account.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Relationship { |
pub struct Relationship { |
||||||
|
/// Whether the application client follows the account.
|
||||||
pub following: bool, |
pub following: bool, |
||||||
|
/// Whether the account follows the application client.
|
||||||
pub followed_by: bool, |
pub followed_by: bool, |
||||||
|
/// Whether the application client blocks the account.
|
||||||
pub blocking: bool, |
pub blocking: bool, |
||||||
|
/// Whether the application client blocks the account.
|
||||||
pub muting: bool, |
pub muting: bool, |
||||||
|
/// Whether the application client has requested to follow the account.
|
||||||
pub requested: bool, |
pub requested: bool, |
||||||
} |
} |
||||||
|
@ -1,5 +1,10 @@ |
|||||||
|
//! module containing information about a finished report of a user.
|
||||||
|
|
||||||
|
/// A struct containing info about a report.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Report { |
pub struct Report { |
||||||
|
/// The ID of the report.
|
||||||
pub id: u64, |
pub id: u64, |
||||||
|
/// The action taken in response to the report.
|
||||||
pub action_taken: String, |
pub action_taken: String, |
||||||
} |
} |
||||||
|
@ -1,8 +1,14 @@ |
|||||||
|
//! A module containing info relating to a search result.
|
||||||
|
|
||||||
use super::prelude::{Account, Status}; |
use super::prelude::{Account, Status}; |
||||||
|
|
||||||
|
/// A struct containing results of a search.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct SearchResult { |
pub struct SearchResult { |
||||||
|
/// An array of matched Accounts.
|
||||||
pub accounts: Vec<Account>, |
pub accounts: Vec<Account>, |
||||||
|
/// An array of matched Statuses.
|
||||||
pub statuses: Vec<Status>, |
pub statuses: Vec<Status>, |
||||||
|
/// An array of matched hashtags, as strings.
|
||||||
pub hashtags: Vec<String>, |
pub hashtags: Vec<String>, |
||||||
} |
} |
||||||
|
@ -1,47 +1,85 @@ |
|||||||
|
//! Module containing all info relating to a status.
|
||||||
|
|
||||||
use chrono::prelude::*; |
use chrono::prelude::*; |
||||||
use super::prelude::*; |
use super::prelude::*; |
||||||
use status_builder::Visibility; |
use status_builder::Visibility; |
||||||
|
|
||||||
|
/// A status from the instance.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Status { |
pub struct Status { |
||||||
|
/// The ID of the status.
|
||||||
pub id: i64, |
pub id: i64, |
||||||
|
/// A Fediverse-unique resource ID.
|
||||||
pub uri: String, |
pub uri: String, |
||||||
|
/// URL to the status page (can be remote)
|
||||||
pub url: String, |
pub url: String, |
||||||
|
/// The Account which posted the status.
|
||||||
pub account: Account, |
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<u64>, |
pub in_reply_to_id: Option<u64>, |
||||||
|
/// The ID of the account this status is replying to, if the status is
|
||||||
|
/// a reply.
|
||||||
pub in_reply_to_account_id: Option<u64>, |
pub in_reply_to_account_id: Option<u64>, |
||||||
|
/// If this status is a reblogged Status of another User.
|
||||||
pub reblog: Option<Box<Status>>, |
pub reblog: Option<Box<Status>>, |
||||||
|
/// Body of the status; this will contain HTML
|
||||||
|
/// (remote HTML already sanitized)
|
||||||
pub content: String, |
pub content: String, |
||||||
|
/// The time the status was created.
|
||||||
pub created_at: DateTime<Utc>, |
pub created_at: DateTime<Utc>, |
||||||
|
/// The number of reblogs for the status.
|
||||||
pub reblogs_count: u64, |
pub reblogs_count: u64, |
||||||
|
/// The number of favourites for the status.
|
||||||
pub favourites_count: u64, |
pub favourites_count: u64, |
||||||
|
/// Whether the application client has reblogged the status.
|
||||||
pub reblogged: Option<bool>, |
pub reblogged: Option<bool>, |
||||||
|
/// Whether the application client has favourited the status.
|
||||||
pub favourited: Option<bool>, |
pub favourited: Option<bool>, |
||||||
pub sensitive: 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.
|
||||||
pub spoiler_text: String, |
pub spoiler_text: String, |
||||||
|
/// The visibilty of the status.
|
||||||
pub visibility: Visibility, |
pub visibility: Visibility, |
||||||
|
/// An array of attachments.
|
||||||
pub media_attachments: Vec<Attachment>, |
pub media_attachments: Vec<Attachment>, |
||||||
|
/// An array of mentions.
|
||||||
pub mentions: Vec<Mention>, |
pub mentions: Vec<Mention>, |
||||||
|
/// An array of tags.
|
||||||
pub tags: Vec<Tag>, |
pub tags: Vec<Tag>, |
||||||
|
/// Name of application used to post status.
|
||||||
pub application: Option<Application>, |
pub application: Option<Application>, |
||||||
} |
} |
||||||
|
|
||||||
|
/// A mention of another user.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Mention { |
pub struct Mention { |
||||||
|
/// URL of user's profile (can be remote).
|
||||||
pub url: String, |
pub url: String, |
||||||
|
/// The username of the account.
|
||||||
pub username: String, |
pub username: String, |
||||||
|
/// Equals `username` for local users, includes `@domain` for remote ones.
|
||||||
pub acct: String, |
pub acct: String, |
||||||
|
/// Account ID.
|
||||||
pub id: u64, |
pub id: u64, |
||||||
} |
} |
||||||
|
|
||||||
|
/// Hashtags in the status.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Tag { |
pub struct Tag { |
||||||
|
/// The hashtag, not including the preceding `#`.
|
||||||
pub name: String, |
pub name: String, |
||||||
|
/// The URL of the hashtag.
|
||||||
pub url: String, |
pub url: String, |
||||||
} |
} |
||||||
|
|
||||||
|
/// Application details.
|
||||||
#[derive(Debug, Clone, Deserialize)] |
#[derive(Debug, Clone, Deserialize)] |
||||||
pub struct Application { |
pub struct Application { |
||||||
|
/// Name of the application.
|
||||||
pub name: String, |
pub name: String, |
||||||
|
/// Homepage URL of the application.
|
||||||
pub website: Option<String>, |
pub website: Option<String>, |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue