Uwaa/Pleroma/Models/Attachment.cs
2024-12-18 09:56:02 +00:00

79 lines
No EOL
2.1 KiB
C#

namespace Uwaa.Pleroma;
public class Attachment
{
/// <summary>
/// The ID of the attachment in the database.
/// </summary>
[JsonPropertyName("id")]
public string ID { get; set; } = null!;
/// <summary>
/// Alternate text that describes what is in the media attachment, to be used for the visually impaired or when media attachments do not load
/// </summary>
[JsonPropertyName("description")]
public string? Description { get; set; }
/// <summary>
/// Additional pleroma-specific data.
/// </summary>
[JsonPropertyName("pleroma")]
public PleromaAttachmentData Pleroma { get; set; } = null!;
/// <summary>
/// The location of a scaled-down preview of the attachment
/// </summary>
[JsonPropertyName("preview_url")]
public string PreviewURL { get; set; } = null!;
/// <summary>
/// The location of the full-size original attachment on the remote website. String (URL), or null if the attachment is local
/// </summary>
[JsonPropertyName("remote_url")]
public string? RemoteURL { get; set; }
/// <summary>
/// A shorter URL for the attachment
/// </summary>
[JsonPropertyName("text_url")]
public string? TextURL { get; set; }
/// <summary>
/// The type of the attachment
/// </summary>
[JsonPropertyName("type")]
public AttachmentType Type { get; set; }
/// <summary>
/// The location of the original full-size attachment
/// </summary>
[JsonPropertyName("url")]
public string URL { get; set; } = null!;
}
[JsonConverter(typeof(EnumLowerCaseConverter<AttachmentType>))]
public enum AttachmentType
{
Unknown,
Image,
Video,
Audio,
}
/// <summary>
/// Additional pleroma-specific data for an <see cref="Attachment"/>.
/// </summary>
public class PleromaAttachmentData
{
/// <summary>
/// MIME type of the attachment
/// </summary>
[JsonPropertyName("mime_type")]
public string Content { get; set; } = null!;
/// <summary>
/// Name of the attachment, typically the filename
/// </summary>
[JsonPropertyName("name")]
public string Name { get; set; } = null!;
}