]> Untitled Git - lemmy.git/blob - crates/apub/src/protocol/collections/person_outbox.rs
Use doku(skip) for opentelemetry_url config value (ref #2085) (#2091)
[lemmy.git] / crates / apub / src / protocol / collections / person_outbox.rs
1 use crate::generate_outbox_url;
2 use activitystreams_kinds::collection::OrderedCollectionType;
3 use lemmy_db_schema::source::person::Person;
4 use lemmy_utils::LemmyError;
5 use serde::{Deserialize, Serialize};
6 use url::Url;
7
8 #[derive(Clone, Debug, Deserialize, Serialize)]
9 #[serde(rename_all = "camelCase")]
10 pub(crate) struct PersonOutbox {
11   r#type: OrderedCollectionType,
12   id: Url,
13   ordered_items: Vec<()>,
14   total_items: i32,
15 }
16
17 impl PersonOutbox {
18   pub(crate) async fn new(user: Person) -> Result<PersonOutbox, LemmyError> {
19     Ok(PersonOutbox {
20       r#type: OrderedCollectionType::OrderedCollection,
21       id: generate_outbox_url(&user.actor_id)?.into(),
22       ordered_items: vec![],
23       total_items: 0,
24     })
25   }
26 }