// use mastodonochrome::types::*;
+use std::io::Read;
fn main() {
let auth = std::fs::read_to_string(
"/home/simon/.config/mastodonochrome/auth").unwrap();
- dbg!(&auth);
let auth: serde_json::Value = serde_json::from_str(&auth).unwrap();
- dbg!(&auth);
let auth = &auth["user_token"].as_str().unwrap();
- dbg!(&auth);
let client = reqwest::blocking::Client::new();
let mut req = client.get(
"https://hachyderm.io/api/v1/streaming/user")
.bearer_auth(auth)
.send().unwrap();
- req.copy_to(&mut std::io::stdout());
+
+ const BUFSIZE: usize = 4096;
+ let mut buf: [u8; BUFSIZE] = [0; BUFSIZE];
+ while let Ok(sz) = req.read(&mut buf) {
+ let read = &buf[..sz];
+ dbg!(read);
+ }
}