diff --git a/plume-models/src/users.rs b/plume-models/src/users.rs index 70e102c6..04241cd4 100644 --- a/plume-models/src/users.rs +++ b/plume-models/src/users.rs @@ -20,6 +20,7 @@ use activitystreams::{ OrderedCollection as OrderedCollection07, OrderedCollectionPage as OrderedCollectionPage07, }, iri_string::types::IriString, + markers::Activity as Activity07, object::{AsObject as _, Image as Image07, Tombstone as Tombstone07}, prelude::*, }; @@ -560,6 +561,23 @@ impl User { let next = json.get("next").map(|x| x.as_str().unwrap().to_owned()); Ok((items, next)) } + pub fn fetch_outbox_page07( + &self, + url: &str, + ) -> Result<(Vec, Option)> { + let mut res = get(url, Self::get_sender(), CONFIG.proxy().cloned())?; + let text = &res.text()?; + let json: serde_json::Value = serde_json::from_str(text)?; + let items = json["items"] + .as_array() + .unwrap_or(&vec![]) + .iter() + .filter_map(|j| serde_json::from_value(j.clone()).ok()) + .collect::>(); + + let next = json.get("next").map(|x| x.as_str().unwrap().to_owned()); + Ok((items, next)) + } pub fn fetch_outbox(&self) -> Result> { let mut res = get( &self.outbox_url[..],