2024-03-16 05:45:58 +01:00
|
|
|
pub mod object;
|
2023-12-30 05:08:05 +01:00
|
|
|
pub mod activity;
|
2024-03-23 05:01:45 +01:00
|
|
|
pub mod user;
|
|
|
|
pub mod config;
|
2024-03-22 05:34:08 +01:00
|
|
|
|
2024-03-22 02:29:37 +01:00
|
|
|
pub mod relation;
|
2024-03-24 04:05:09 +01:00
|
|
|
pub mod addressing;
|
2024-03-22 05:34:08 +01:00
|
|
|
pub mod share;
|
|
|
|
pub mod like;
|
2024-03-23 05:01:45 +01:00
|
|
|
pub mod credential;
|
2024-03-24 04:05:09 +01:00
|
|
|
pub mod session;
|
2024-03-25 05:07:58 +01:00
|
|
|
pub mod delivery;
|
2024-03-25 21:18:12 +01:00
|
|
|
pub mod application;
|
2024-03-22 02:29:37 +01:00
|
|
|
|
2024-03-21 20:36:28 +01:00
|
|
|
pub mod faker;
|
2024-03-16 05:45:58 +01:00
|
|
|
|
2024-03-16 20:09:06 +01:00
|
|
|
#[derive(Debug, Clone, thiserror::Error)]
|
|
|
|
#[error("missing required field: '{0}'")]
|
2024-03-19 01:00:44 +01:00
|
|
|
pub struct FieldError(pub &'static str);
|
2024-03-16 20:09:06 +01:00
|
|
|
|
2024-03-21 20:36:46 +01:00
|
|
|
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize, sea_orm::FromJsonQueryResult)]
|
|
|
|
pub struct Audience(pub Vec<String>);
|
|
|
|
|
|
|
|
use crate::activitystream::{Link, Node};
|
|
|
|
impl<T : Link> From<Node<T>> for Audience {
|
|
|
|
fn from(value: Node<T>) -> Self {
|
|
|
|
Audience(
|
|
|
|
match value {
|
|
|
|
Node::Empty => vec![],
|
|
|
|
Node::Link(l) => vec![l.href().to_string()],
|
|
|
|
Node::Object(o) => if let Some(id) = o.id() { vec![id.to_string()] } else { vec![] },
|
|
|
|
Node::Array(arr) => arr.into_iter().filter_map(|l| Some(l.id()?.to_string())).collect(),
|
|
|
|
}
|
|
|
|
)
|
2024-03-20 07:53:45 +01:00
|
|
|
}
|
2024-03-16 05:45:58 +01:00
|
|
|
}
|
2024-03-21 20:36:46 +01:00
|
|
|
|