[dependencies]
crossterm = "0.27.0"
html2text = "0.9.0"
-reqwest = "0.11.23"
+reqwest = { version = "0.11.23", features = ["blocking"] }
+serde = { version = "1.0.193", features = ["derive"] }
serde_json = "1.0.108"
unicode-width = "0.1.5"
+use serde::{Deserialize, Serialize};
+use serde_json::Result;
+
+#[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: optional bool,
+ // noindex: optional bool,
+ // moved: optional Account (!),
+ // suspended: optional bool,
+ // limited: optional bool,
+ created_at: String, // FIXME: sort out dates!
+ last_status_at: String,
+ statuses_count: u64,
+ followers_count: u64,
+ following_count: u64,
+}
+
fn main() {
- println!("Hello, world!");
+ let body = reqwest::blocking::get(
+ "https://hachyderm.io/api/v1/accounts/111096602447828617")
+ .unwrap().text().unwrap();
+ let acc: Account = serde_json::from_str(&body).unwrap();
+ dbg!(acc);
}