Initial commit
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
use chrono::prelude::*;
|
||||
#[derive(Deserialize)]
|
||||
pub struct Account {
|
||||
pub id: u64,
|
||||
pub username: String,
|
||||
pub acct: String,
|
||||
pub display_name: String,
|
||||
pub note: String,
|
||||
pub url: String,
|
||||
pub avatar: String,
|
||||
pub header: String,
|
||||
pub locked: bool,
|
||||
pub created_at: DateTime<UTC>,
|
||||
pub followers_count: u64,
|
||||
pub following_count: u64,
|
||||
pub statuses_count: u64,
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
#[derive(Debug, Clone, Deserialize)]
|
||||
pub struct Attachment {
|
||||
pub id: u64,
|
||||
#[serde(rename="type")]
|
||||
pub media_type: MediaType,
|
||||
pub url: String,
|
||||
pub remote_url: String,
|
||||
pub preview_url: String,
|
||||
pub text_url: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Clone, Copy)]
|
||||
pub enum MediaType {
|
||||
#[serde(rename = "image")]
|
||||
Image,
|
||||
#[serde(rename = "video")]
|
||||
Video,
|
||||
#[serde(rename = "gifv")]
|
||||
Gifv,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#[derive(Deserialize)]
|
||||
pub struct Card {
|
||||
pub url: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub image: String,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
use super::status::Status;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Context {
|
||||
pub ancestors: Vec<Status>,
|
||||
pub descendants: Vec<Status>,
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
#[derive(Deserialize)]
|
||||
pub struct Instance {
|
||||
pub uri: String,
|
||||
pub title: String,
|
||||
pub description: String,
|
||||
pub email: String,
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
pub mod account;
|
||||
pub mod attachment;
|
||||
pub mod card;
|
||||
pub mod context;
|
||||
pub mod instance;
|
||||
pub mod notification;
|
||||
pub mod relationship;
|
||||
pub mod report;
|
||||
pub mod search_result;
|
||||
pub mod status;
|
||||
|
||||
/// An empty JSON object.
|
||||
#[derive(Deserialize)]
|
||||
pub struct Empty {}
|
||||
|
||||
pub mod prelude {
|
||||
pub use super::Empty;
|
||||
pub use super::account::Account;
|
||||
pub use super::attachment::{Attachment, MediaType};
|
||||
pub use super::card::Card;
|
||||
pub use super::context::Context;
|
||||
pub use super::instance::Instance;
|
||||
pub use super::notification::Notification;
|
||||
pub use super::relationship::Relationship;
|
||||
pub use super::report::Report;
|
||||
pub use super::search_result::SearchResult;
|
||||
pub use super::status::{Status, Application};
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
use chrono::prelude::*;
|
||||
use super::account::Account;
|
||||
use super::status::Status;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Notification {
|
||||
pub id: u64,
|
||||
pub notification_type: NotificationType,
|
||||
pub created_at: DateTime<UTC>,
|
||||
pub account: Account,
|
||||
pub status: Option<Status>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub enum NotificationType {
|
||||
Mention,
|
||||
Reblog,
|
||||
Favourite,
|
||||
Follow,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#[derive(Deserialize)]
|
||||
pub struct Relationship {
|
||||
pub following: bool,
|
||||
pub followed_by: bool,
|
||||
pub blocking: bool,
|
||||
pub muting: bool,
|
||||
pub requested: bool,
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
#[derive(Deserialize)]
|
||||
pub struct Report {
|
||||
pub id: u64,
|
||||
pub action_taken: String,
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
use super::prelude::{Account, Status};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct SearchResult {
|
||||
pub accounts: Vec<Account>,
|
||||
pub statuses: Vec<Status>,
|
||||
pub hashtags: Vec<String>,
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
use chrono::prelude::*;
|
||||
use super::prelude::*;
|
||||
use status_builder::Visibility;
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Status {
|
||||
pub id: i64,
|
||||
pub uri: String,
|
||||
pub url: String,
|
||||
pub account: Account,
|
||||
pub in_reply_to_id: Option<u64>,
|
||||
pub in_reply_to_account_id: Option<u64>,
|
||||
pub reblog: Option<Box<Status>>,
|
||||
pub content: String,
|
||||
pub created_at: DateTime<UTC>,
|
||||
pub reblogs_count: u64,
|
||||
pub favourites_count: u64,
|
||||
pub reblogged: bool,
|
||||
pub favourited: bool,
|
||||
pub sensitive: bool,
|
||||
pub spoiler_text: String,
|
||||
pub visibility: Visibility,
|
||||
pub media_attachments: Vec<Attachment>,
|
||||
pub mentions: Vec<Mention>,
|
||||
pub tags: Vec<Tag>,
|
||||
pub application: Application,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Mention {
|
||||
pub url: String,
|
||||
pub username: String,
|
||||
pub acct: String,
|
||||
pub id: u64,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Tag {
|
||||
pub name: String,
|
||||
pub url: String,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct Application {
|
||||
pub name: String,
|
||||
pub website: String,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user