2021-11-03 16:26:09 +00:00
|
|
|
use crate::{
|
|
|
|
objects::person::ApubPerson,
|
2021-11-06 13:25:34 +00:00
|
|
|
protocol::{objects::Endpoints, ImageObject, Source},
|
2021-11-03 16:26:09 +00:00
|
|
|
};
|
2021-11-06 13:25:34 +00:00
|
|
|
use activitystreams::{unparsed::Unparsed, url::Url};
|
2021-11-01 13:05:20 +00:00
|
|
|
use chrono::{DateTime, FixedOffset};
|
2021-11-05 00:24:10 +00:00
|
|
|
use lemmy_apub_lib::{object_id::ObjectId, signatures::PublicKey};
|
2021-11-01 13:05:20 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use serde_with::skip_serializing_none;
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, Deserialize, Serialize, PartialEq)]
|
|
|
|
pub enum UserTypes {
|
|
|
|
Person,
|
|
|
|
Service,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[skip_serializing_none]
|
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
pub struct Person {
|
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub(crate) kind: UserTypes,
|
2021-11-03 16:26:09 +00:00
|
|
|
pub(crate) id: ObjectId<ApubPerson>,
|
2021-11-01 13:05:20 +00:00
|
|
|
/// username, set at account creation and can never be changed
|
|
|
|
pub(crate) preferred_username: String,
|
|
|
|
/// displayname (can be changed at any time)
|
|
|
|
pub(crate) name: Option<String>,
|
|
|
|
pub(crate) summary: Option<String>,
|
|
|
|
pub(crate) source: Option<Source>,
|
|
|
|
/// user avatar
|
|
|
|
pub(crate) icon: Option<ImageObject>,
|
|
|
|
/// user banner
|
|
|
|
pub(crate) image: Option<ImageObject>,
|
|
|
|
pub(crate) matrix_user_id: Option<String>,
|
|
|
|
pub(crate) inbox: Url,
|
|
|
|
/// mandatory field in activitypub, currently empty in lemmy
|
|
|
|
pub(crate) outbox: Url,
|
2021-11-06 13:25:34 +00:00
|
|
|
pub(crate) endpoints: Endpoints,
|
2021-11-01 13:05:20 +00:00
|
|
|
pub(crate) public_key: PublicKey,
|
|
|
|
pub(crate) published: Option<DateTime<FixedOffset>>,
|
|
|
|
pub(crate) updated: Option<DateTime<FixedOffset>>,
|
|
|
|
#[serde(flatten)]
|
|
|
|
pub(crate) unparsed: Unparsed,
|
|
|
|
}
|