use axum::{response::IntoResponse, Json}; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Actor { #[serde(rename = "@context")] pub jsonld_context: serde_json::Value, #[serde(rename = "type")] pub actor_type: String, pub id: String, pub name: Option, pub icon: Option, pub inbox: String, pub outbox: Option, pub endpoints: Option, #[serde(rename = "publicKey")] pub public_key: ActorPublicKey, #[serde(rename = "preferredUsername")] pub preferred_username: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ActorEndpoints { #[serde(rename = "sharedInbox")] pub shared_inbox: String, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ActorPublicKey { pub id: String, pub owner: Option, #[serde(rename = "publicKeyPem")] pub pem: String, } /// `ActivityPub` "activity" #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Action { #[serde(rename = "@context")] pub jsonld_context: serde_json::Value, #[serde(rename = "type")] pub action_type: String, pub id: String, pub actor: String, pub to: Option, pub object: Option, } impl IntoResponse for Actor { fn into_response(self) -> axum::response::Response { ([("content-type", "application/activity+json")], Json(self)).into_response() } } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Media { #[serde(rename = "type")] pub media_type: Option, #[serde(rename = "mediaType")] pub content_type: Option, pub url: String, }