2022-11-23 23:40:47 +00:00
|
|
|
use crate::{fetcher::user_or_community::UserOrCommunity, objects::person::ApubPerson};
|
2023-06-06 22:33:38 +00:00
|
|
|
use activitypub_federation::{
|
2023-09-23 01:39:03 +00:00
|
|
|
fetch::object_id::ObjectId, kinds::activity::FollowType,
|
2023-06-06 22:33:38 +00:00
|
|
|
protocol::helpers::deserialize_skip_error,
|
|
|
|
};
|
2021-10-29 10:32:42 +00:00
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use url::Url;
|
|
|
|
|
2021-11-03 17:33:51 +00:00
|
|
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
2021-10-29 10:32:42 +00:00
|
|
|
#[serde(rename_all = "camelCase")]
|
2022-11-23 23:40:47 +00:00
|
|
|
pub struct Follow {
|
2021-10-29 10:32:42 +00:00
|
|
|
pub(crate) actor: ObjectId<ApubPerson>,
|
2023-04-24 21:19:08 +00:00
|
|
|
/// Optional, for compatibility with platforms that always expect recipient field
|
2023-06-06 22:33:38 +00:00
|
|
|
#[serde(deserialize_with = "deserialize_skip_error", default)]
|
2023-04-24 21:19:08 +00:00
|
|
|
pub(crate) to: Option<[ObjectId<UserOrCommunity>; 1]>,
|
2022-11-23 23:40:47 +00:00
|
|
|
pub(crate) object: ObjectId<UserOrCommunity>,
|
2021-10-29 10:32:42 +00:00
|
|
|
#[serde(rename = "type")]
|
|
|
|
pub(crate) kind: FollowType,
|
|
|
|
pub(crate) id: Url,
|
|
|
|
}
|