2024-03-19 07:38:48 +01:00
|
|
|
use crate::{activitystream::{Base, BaseType}, strenum};
|
|
|
|
|
|
|
|
use super::ObjectType;
|
2024-03-19 05:15:41 +01:00
|
|
|
|
|
|
|
strenum! {
|
|
|
|
pub enum ActorType {
|
|
|
|
Application,
|
|
|
|
Group,
|
|
|
|
Organization,
|
|
|
|
Person,
|
2024-03-19 22:47:52 +01:00
|
|
|
Object;
|
|
|
|
};
|
2024-03-19 05:15:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
pub trait Actor : super::Object {
|
|
|
|
fn actor_type(&self) -> Option<ActorType> { None }
|
|
|
|
}
|
|
|
|
|
2024-03-20 05:44:10 +01:00
|
|
|
pub trait ActorMut : super::ObjectMut {
|
|
|
|
fn set_actor_type(&mut self, val: Option<ActorType>) -> &mut Self;
|
|
|
|
}
|
|
|
|
|
2024-03-19 05:15:41 +01:00
|
|
|
impl Actor for serde_json::Value {
|
2024-03-19 07:38:48 +01:00
|
|
|
fn actor_type(&self) -> Option<ActorType> {
|
|
|
|
match self.base_type()? {
|
|
|
|
BaseType::Object(ObjectType::Actor(x)) => Some(x),
|
|
|
|
_ => None,
|
|
|
|
}
|
|
|
|
}
|
2024-03-19 05:15:41 +01:00
|
|
|
}
|