SocialPub/PrivaPub/Models/ActivityPub/ActivityPubActor.cs

80 lines
2.3 KiB
C#

using PrivaPub.Models.ActivityPub.Extra;
using System.Text.Json.Serialization;
namespace PrivaPub.Models.ActivityPub
{
[JsonSerializable(typeof(ActivityPubActor))]
public class ActivityPubActor : ActivityPubObject
{
[JsonPropertyName("type")]
public new ObjectType? Type => ObjectType.Person;
[JsonPropertyName("inbox")]
public string Inbox { get; set; }
[JsonPropertyName("outbox")]
public string Outbox { get; set; }
[JsonPropertyName("url")]
public string ProfileURL { get; set; }
[JsonPropertyName("preferredUsername")]
public string PreferredUsername { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("summary")]
public string Summary { get; set; }
[JsonPropertyName("icon")]
public ActivityPubIcon Icon { get; set; }
[JsonPropertyName("image")]
public ActivityPubIcon Thumbnail { get; set; }
[JsonPropertyName("manuallyApprovesFollowers")]
public bool ManuallyApprovesFollowers { get; set; } = false;
[JsonPropertyName("discoverable")]
public bool Discoverable { get; set; } = true;
[JsonPropertyName("publicKey")]
public ActivityPubPublicKey PublicKey { get; set; } = new();
[JsonPropertyName("endpoints")]
public ActivityPubActorEndpoints Endpoints { get; set; } = new();
[JsonPropertyName("attachment")]
public IEnumerable<ActivityPubAttachment> Attachment { get; set; } = Enumerable.Empty<ActivityPubAttachment>();
[JsonPropertyName("tag")]
public IEnumerable<string> Tags => Enumerable.Empty<string>();
}
public class ActivityPubAttachment
{
[JsonPropertyName("type")]
public string Type { get; set; }
[JsonPropertyName("name")]
public string Name { get; set; }
[JsonPropertyName("value")]
public string Value { get; set; }
}
public class ActivityPubActorEndpoints
{
[JsonPropertyName("sharedInbox")]
public string SharedInboxURL { get; set; }
[JsonPropertyName("oauthAuthorizationEndpoint")]
public string OAuthAuthorizationEndpoint { get; set; }
[JsonExtensionData]
public Dictionary<string, object> OtherData { get; set; }
}
public class ActivityPubPublicKey
{
[JsonPropertyName("id")]
public string Id { get; set; }
[JsonPropertyName("owner")]
public string Owner { get; set; }
[JsonPropertyName("publicKeyPem")]
public string PublicKeyPem { get; set; }
}
}