122 lines
3.9 KiB
C#
122 lines
3.9 KiB
C#
using System.Text.Json.Nodes;
|
|||
|
|
|
||
|
|
namespace decePubClient.Models.Mastodon;
|
||
|
|
|
||
|
|
/// <summary>/api/privapub/v1/instances: what PrivaPub stored about a server, and where it is.</summary>
|
||
|
|
public class InstanceDescription
|
||
|
|
{
|
||
|
|
public string Host { get; set; }
|
||
|
|
public string Software { get; set; }
|
||
|
|
public string Version { get; set; }
|
||
|
|
public string NodeName { get; set; }
|
||
|
|
public List<string> Protocols { get; set; } = [];
|
||
|
|
public bool? OpenRegistrations { get; set; }
|
||
|
|
public DateTime? DescribedAt { get; set; }
|
||
|
|
public string DescriptionError { get; set; }
|
||
|
|
public JsonNode NodeInfo { get; set; }
|
||
|
|
public InstanceDelivery Delivery { get; set; }
|
||
|
|
public InstanceLocation Geo { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public class InstanceDelivery
|
||
|
|
{
|
||
|
|
public int ConsecutiveFailures { get; set; }
|
||
|
|
public DateTime? UnavailableUntil { get; set; }
|
||
|
|
public DateTime? LastSuccessAt { get; set; }
|
||
|
|
public DateTime? LastFailureAt { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// The public projection of a server's place. Precision: city (coordinates to 0.1°, city and network), country (the
|
||
|
|
/// country only) or cdn (the CDN's name only).
|
||
|
|
/// </summary>
|
||
|
|
public class InstanceLocation
|
||
|
|
{
|
||
|
|
public string Precision { get; set; }
|
||
|
|
public string Country { get; set; }
|
||
|
|
public string City { get; set; }
|
||
|
|
public double? Latitude { get; set; }
|
||
|
|
public double? Longitude { get; set; }
|
||
|
|
public string Network { get; set; }
|
||
|
|
public string Cdn { get; set; }
|
||
|
|
public string Source { get; set; }
|
||
|
|
public DateTime? LocatedAt { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>/api/privapub/v1/statuses/{id}/provenance: how a remote post reached PrivaPub. Path is local for a local post.</summary>
|
||
|
|
public class Provenance
|
||
|
|
{
|
||
|
|
public string ObjectUri { get; set; }
|
||
|
|
public string ObjectType { get; set; }
|
||
|
|
public string Url { get; set; }
|
||
|
|
/// <summary>delivered, fetched, unrecorded or local.</summary>
|
||
|
|
public string Path { get; set; }
|
||
|
|
public bool Refetched { get; set; }
|
||
|
|
public ProvenanceActivity Activity { get; set; }
|
||
|
|
public string Inbox { get; set; }
|
||
|
|
public string FetchedBy { get; set; }
|
||
|
|
public ProvenanceSignature Signature { get; set; }
|
||
|
|
public DateTime? ReceivedAt { get; set; }
|
||
|
|
public DateTime? Published { get; set; }
|
||
|
|
public DateTime? Updated { get; set; }
|
||
|
|
public List<string> Extensions { get; set; } = [];
|
||
|
|
public List<string> ContextNamespaces { get; set; } = [];
|
||
|
|
public JsonNode Raw { get; set; }
|
||
|
|
public int RawBytes { get; set; }
|
||
|
|
public string RawHash { get; set; }
|
||
|
|
public bool RawTruncated { get; set; }
|
||
|
|
public List<ProvenanceRevision> Revisions { get; set; } = [];
|
||
|
|
public InstanceDescription Instance { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ProvenanceActivity
|
||
|
|
{
|
||
|
|
public string Id { get; set; }
|
||
|
|
public string Type { get; set; }
|
||
|
|
public string Actor { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ProvenanceSignature
|
||
|
|
{
|
||
|
|
public string Scheme { get; set; }
|
||
|
|
public string KeyId { get; set; }
|
||
|
|
public string Algorithm { get; set; }
|
||
|
|
public List<string> Headers { get; set; } = [];
|
||
|
|
}
|
||
|
|
|
||
|
|
public class ProvenanceRevision
|
||
|
|
{
|
||
|
|
public string ActivityId { get; set; }
|
||
|
|
public DateTime? Updated { get; set; }
|
||
|
|
public DateTime? ReceivedAt { get; set; }
|
||
|
|
public string RawHash { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>The answer of /oauth/token.</summary>
|
||
|
|
public class TokenResponse
|
||
|
|
{
|
||
|
|
public string AccessToken { get; set; }
|
||
|
|
public string TokenType { get; set; }
|
||
|
|
public string IssuedTokenType { get; set; }
|
||
|
|
public string Scope { get; set; }
|
||
|
|
public long CreatedAt { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>An error of the Mastodon API or of /oauth: {"error": ..., "error_description": ...}.</summary>
|
||
|
|
public class MastodonError
|
||
|
|
{
|
||
|
|
public string Error { get; set; }
|
||
|
|
public string ErrorDescription { get; set; }
|
||
|
|
}
|
||
|
|
|
||
|
|
/// <summary>POST /api/v1/statuses. The text is plain: the Mastodon API does not take Markdown.</summary>
|
||
|
|
public class PostStatusForm
|
||
|
|
{
|
||
|
|
public string Status { get; set; }
|
||
|
|
public List<string> MediaIds { get; set; } = [];
|
||
|
|
public string InReplyToId { get; set; }
|
||
|
|
public bool Sensitive { get; set; }
|
||
|
|
public string SpoilerText { get; set; }
|
||
|
|
public string Visibility { get; set; }
|
||
|
|
public string Language { get; set; }
|
||
|
|
}
|