-use chrono::{DateTime,Utc};
-use serde::{Deserialize, Serialize};
-use serde_json::Result;
-use std::boxed::Box;
-use std::option::Option;
-
-#[derive(Serialize, Deserialize, Debug)]
-struct AccountField {
- name: String,
- value: String,
- verified_at: Option<DateTime<Utc>>,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-struct Account {
- id: String,
- username: String,
- acct: String,
- url: String,
- display_name: String,
- note: String,
- avatar: String,
- avatar_static: String,
- header: String,
- header_static: String,
- locked: bool,
- fields: Vec<AccountField>,
- // emojis: Vec<Emoji>,
- bot: bool,
- group: bool,
- discoverable: Option<bool>,
- noindex: Option<bool>,
- moved: Option<Box<Account>>,
- suspended: Option<bool>,
- limited: Option<bool>,
- created_at: DateTime<Utc>,
- last_status_at: Option<String>, // this lacks a timezone, so serde
- // can't deserialize it in the obvious way
- statuses_count: u64,
- followers_count: u64,
- following_count: u64,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-struct Application {
- name: String,
- website: Option<String>,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-enum Visibility {
- #[serde(rename = "public")] Public,
- #[serde(rename = "unlisted")] Unlisted,
- #[serde(rename = "private")] Private,
- #[serde(rename = "direct")] Direct,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-enum MediaType {
- #[serde(rename = "unknown")] Unknown,
- #[serde(rename = "image")] Image,
- #[serde(rename = "gifv")] GifV,
- #[serde(rename = "video")] Video,
- #[serde(rename = "audio")] Audio,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-struct MediaAttachment {
- id: String,
- #[serde(rename="type")] mediatype: MediaType,
- url: String,
- preview_url: String,
- remote_url: Option<String>,
- description: Option<String>,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-struct StatusMention {
- id: String,
- username: String,
- url: String,
- acct: String,
-}
-
-#[derive(Serialize, Deserialize, Debug)]
-struct Status {
- id: String,
- uri: String,
- created_at: DateTime<Utc>,
- account: Account,
- content: String,
- visibility: Visibility,
- sensitive: bool,
- spoiler_text: String,
- media_attachments: Vec<MediaAttachment>,
- application: Option<Application>,
- mentions: Vec<StatusMention>,
- // tags: Vec<Hashtag>,
- // emojis: Vec<Emoji>,
- reblogs_count: u64,
- favourites_count: u64,
- replies_count: u64,
- url: String,
- in_reply_to_id: Option<String>,
- in_reply_to_account_id: Option<String>,
- reblog: Option<Box<Status>>,
- // poll: Option<Poll>,
- // card: Option<PreviewCard>,
- language: Option<String>,
- text: Option<String>,
- edited_at: Option<DateTime<Utc>>,
- favourited: Option<bool>,
- reblogged: Option<bool>,
- muted: Option<bool>,
- bookmarked: Option<bool>,
- pinned: Option<bool>,
- filtered: Option<bool>,
-}
+use mastodonochrome::types::*;
fn main() {
let client = reqwest::blocking::Client::new();
--- /dev/null
+use chrono::{DateTime,Utc};
+use serde::{Deserialize, Serialize};
+use std::boxed::Box;
+use std::option::Option;
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct AccountField {
+ name: String,
+ value: String,
+ verified_at: Option<DateTime<Utc>>,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct Account {
+ id: String,
+ username: String,
+ acct: String,
+ url: String,
+ display_name: String,
+ note: String,
+ avatar: String,
+ avatar_static: String,
+ header: String,
+ header_static: String,
+ locked: bool,
+ fields: Vec<AccountField>,
+ // emojis: Vec<Emoji>,
+ bot: bool,
+ group: bool,
+ discoverable: Option<bool>,
+ noindex: Option<bool>,
+ moved: Option<Box<Account>>,
+ suspended: Option<bool>,
+ limited: Option<bool>,
+ created_at: DateTime<Utc>,
+ last_status_at: Option<String>, // this lacks a timezone, so serde
+ // can't deserialize it in the obvious way
+ statuses_count: u64,
+ followers_count: u64,
+ following_count: u64,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct Application {
+ name: String,
+ website: Option<String>,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub enum Visibility {
+ #[serde(rename = "public")] Public,
+ #[serde(rename = "unlisted")] Unlisted,
+ #[serde(rename = "private")] Private,
+ #[serde(rename = "direct")] Direct,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub enum MediaType {
+ #[serde(rename = "unknown")] Unknown,
+ #[serde(rename = "image")] Image,
+ #[serde(rename = "gifv")] GifV,
+ #[serde(rename = "video")] Video,
+ #[serde(rename = "audio")] Audio,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct MediaAttachment {
+ id: String,
+ #[serde(rename="type")] mediatype: MediaType,
+ url: String,
+ preview_url: String,
+ remote_url: Option<String>,
+ description: Option<String>,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct StatusMention {
+ id: String,
+ username: String,
+ url: String,
+ acct: String,
+}
+
+#[derive(Serialize, Deserialize, Debug)]
+pub struct Status {
+ id: String,
+ uri: String,
+ created_at: DateTime<Utc>,
+ account: Account,
+ content: String,
+ visibility: Visibility,
+ sensitive: bool,
+ spoiler_text: String,
+ media_attachments: Vec<MediaAttachment>,
+ application: Option<Application>,
+ mentions: Vec<StatusMention>,
+ // tags: Vec<Hashtag>,
+ // emojis: Vec<Emoji>,
+ reblogs_count: u64,
+ favourites_count: u64,
+ replies_count: u64,
+ url: String,
+ in_reply_to_id: Option<String>,
+ in_reply_to_account_id: Option<String>,
+ reblog: Option<Box<Status>>,
+ // poll: Option<Poll>,
+ // card: Option<PreviewCard>,
+ language: Option<String>,
+ text: Option<String>,
+ edited_at: Option<DateTime<Utc>>,
+ favourited: Option<bool>,
+ reblogged: Option<bool>,
+ muted: Option<bool>,
+ bookmarked: Option<bool>,
+ pinned: Option<bool>,
+ filtered: Option<bool>,
+}