Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New release types #132

Open
wants to merge 6 commits into
base: v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions Mastonet.Entities/AccountWarning.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;

namespace Mastonet.Entities
{
public class AccountWarning
{
/// <summary>
/// The ID of the account warning in the database.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;

/// <summary>
/// Action taken against the account.
/// </summary>
[JsonPropertyName("action")]
public string Action { get; set; } = string.Empty;

/// <summary>
/// Message from the moderator to the target account.
/// </summary>
[JsonPropertyName("text")]
public string Text { get; set; } = string.Empty;

/// <summary>
/// List of status IDs that are relevant to the warning. When action is mark_statuses_as_sensitive or delete_statuses, those are the affected statuses.
/// </summary>
[JsonPropertyName("status_ids")]
public IEnumerable<string> StatusIds { get; set; } = Enumerable.Empty<string>();

/// <summary>
/// Account against which a moderation decision has been taken.
/// </summary>
[JsonPropertyName("target_account")]
public Account TargetAccount { get; set; } = new Account();

/// <summary>
/// Appeal submitted by the target account, if any.
/// </summary>
[JsonPropertyName("appeal")]
public Appeal? Appeal { get; set; }

/// <summary>
/// When the event took place.
/// </summary>
[JsonPropertyName("created_at")]
public string CreatedAt { get; set; } = string.Empty;
}
}
25 changes: 25 additions & 0 deletions Mastonet.Entities/Appeal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace Mastonet.Entities
{
public class Appeal
{
/// <summary>
/// Text of the appeal from the moderated account to the moderators.
/// </summary>
[JsonPropertyName("text")]
public string Text { get; set; } = string.Empty;

/// <summary>
/// State of the appeal. One of:
/// approved = The appeal has been approved by a moderator
/// rejected = The appeal has been rejected by a moderator
/// pending = The appeal has been submitted, but neither approved nor rejected yet
/// </summary>
[JsonPropertyName("state")]
public string State { get; set; } = string.Empty;
}
}
6 changes: 6 additions & 0 deletions Mastonet.Entities/Filter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ public class Filter
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;

/// <summary>
/// A title given by the user to name the filter.
/// </summary>
[JsonPropertyName("title")]
public string Title { get; set; } = string.Empty;

/// <summary>
/// The text to be filtered.
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions Mastonet.Entities/IdentityProof.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace Mastonet.Entities;
/// <summary>
/// Represents a proof from an external identity provider.
/// </summary>
[Obsolete("Identity proofs have been deprecated in Mastodon v3.5.0 and newer. Previously, the only proof provider was Keybase, but development on Keybase has stalled entirely since it was acquired by Zoom.")]
public class IdentityProof
{
/// <summary>
Expand Down
36 changes: 36 additions & 0 deletions Mastonet.Entities/InstanceV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ public class InstanceV2
[JsonPropertyName("thumbnail")]
public InstanceThumbnail Thumbnail { get; set; }= new InstanceThumbnail();

/// <summary>
/// The list of available size variants for this instance configured icon.
/// </summary>
[JsonPropertyName("icon")]
public IEnumerable<InstanceIcon> Icon { get; set; } = Enumerable.Empty<InstanceIcon>();

/// <summary>
/// Primary languages of the website and its staff.
/// </summary>
Expand All @@ -71,6 +77,12 @@ public class InstanceV2
[JsonPropertyName("registrations")]
public InstanceRegistrations Registrations { get; set; }= new InstanceRegistrations();

/// <summary>
/// Information about which version of the API is implemented by this server. It contains at least a mastodon attribute, and other implementations may have their own additional attributes.
/// </summary>
[JsonPropertyName("api_versions")]
public InstanceApiVersion InstanceApiVersion { get; set; } = new InstanceApiVersion();

/// <summary>
/// Hints related to contacting a representative of the website.
/// </summary>
Expand Down Expand Up @@ -159,6 +171,15 @@ public class InstanceRegistrations
public string? Message { get; set; }
}

public class InstanceApiVersion
{
/// <summary>
/// API version number that this server implements. Starting from Mastodon v4.3.0, API changes will come with a version number, which clients can check against this value.
/// </summary>
[JsonPropertyName("mastodon")]
public int Mastodon { get; set; }
}

public class InstanceContact
{
/// <summary>
Expand Down Expand Up @@ -187,4 +208,19 @@ public class InstanceRule
/// </summary>
[JsonPropertyName("text")]
public string Text { get; set; } = string.Empty;
}

public class InstanceIcon
{
/// <summary>
/// The URL of this icon.
/// </summary>
[JsonPropertyName("src")]
public string Source { get; set; } = string.Empty;

/// <summary>
/// The size of this icon.
/// </summary>
[JsonPropertyName("size")]
public string Size { get; set; } = string.Empty;
}
16 changes: 16 additions & 0 deletions Mastonet.Entities/InstanceV2Configuration.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text.Json.Serialization;

Expand Down Expand Up @@ -41,6 +42,12 @@ public class InstanceConfiguration
/// </summary>
[JsonPropertyName("translation")]
public InstanceConfigurationTranslation Translation { get; set; }= new InstanceConfigurationTranslation();

/// <summary>
/// The instances VAPID public key, used for push notifications, the same as WebPushSubscription#server_key.
/// </summary>
[JsonPropertyName("vapid")]
public InstanceConfigurationVapid Vapid { get; set; } = new InstanceConfigurationVapid();
}

public class InstanceConfigurationUrls
Expand Down Expand Up @@ -161,4 +168,13 @@ public class InstanceConfigurationTranslation
/// </summary>
[JsonPropertyName("enabled")]
public bool Enabled { get; set; }
}

public class InstanceConfigurationVapid
{
/// <summary>
/// The instances VAPID public key, used for push notifications, the same as WebPushSubscription#server_key.
/// </summary>
[JsonPropertyName("public_key")]
public string PublicKey { get; set; } = string.Empty;
}
26 changes: 23 additions & 3 deletions Mastonet.Entities/Notification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,25 @@ public class Notification

/// <summary>
/// The type of event that resulted in the notification. One of:
/// follow = Someone followed you
/// follow_request = Someone requested to follow you
/// mention = Someone mentioned you in their status
/// status = Someone you enabled notifications for has posted a status
/// reblog = Someone boosted one of your statuses
/// follow = Someone followed you
/// follow_request = Someone requested to follow you
/// favourite = Someone favourited one of your statuses
/// poll = A poll you have voted in or created has ended
/// status = Someone you enabled notifications for has posted a status
/// update = A status you interacted with has been edited
/// admin.sign_up = Someone signed up (optionally sent to admins)
/// admin.report = A new report has been filed
/// severed_relationships = Some of your follow relationships have been severed as a result of a moderation or block event
/// moderation_warning = A moderator has taken action against your account or has sent you a warning
/// </summary>
[JsonPropertyName("type")]
public string Type { get; set; } = string.Empty;

[JsonPropertyName("group_key")]
public string GroupKey { get; set; } = string.Empty;

/// <summary>
/// The timestamp of the notification.
/// </summary>
Expand All @@ -46,4 +54,16 @@ public class Notification
/// </summary>
[JsonPropertyName("status")]
public Status? Status { get; set; }

/// <summary>
/// Summary of the event that caused follow relationships to be severed. Attached when type of the notification is severed_relationships.
/// </summary>
[JsonPropertyName("relationship_severance_event")]
public RelationshipSeveranceEvent RelationshipSeveranceEvent { get; set; } = new RelationshipSeveranceEvent();

/// <summary>
/// Moderation warning that caused the notification. Attached when type of the notification is moderation_warning.
/// </summary>
[JsonPropertyName("moderation_warning")]
public AccountWarning ModerationWarning { get; set; } = new AccountWarning();
}
61 changes: 61 additions & 0 deletions Mastonet.Entities/NotificationPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace Mastonet.Entities
{
public class NotificationPolicy
{
/// <summary>
/// Whether to accept, filter or drop notifications from accounts the user is not following. drop will prevent creation of the notification object altogether (without preventing the underlying activity), filter will cause it to be marked as filtered, and accept will not affect its processing.
/// </summary>
[JsonPropertyName("for_not_following\r\n")]
public string ForNotFollowing { get; set; } = string.Empty;

/// <summary>
/// Whether to accept, filter or drop notifications from accounts that are not following the user. drop will prevent creation of the notification object altogether (without preventing the underlying activity), filter will cause it to be marked as filtered, and accept will not affect its processing.
/// </summary>
[JsonPropertyName("for_not_followers")]
public string ForNotFollowers { get; set; } = string.Empty;

/// <summary>
/// Whether to accept, filter or drop notifications from accounts created in the past 30 days. drop will prevent creation of the notification object altogether (without preventing the underlying activity), filter will cause it to be marked as filtered, and accept will not affect its processing.
/// </summary>
[JsonPropertyName("for_new_accounts")]
public string ForNewAccounts { get; set; } = string.Empty;

/// <summary>
/// Whether to accept, filter or drop notifications from private mentions. drop will prevent creation of the notification object altogether (without preventing the underlying activity), filter will cause it to be marked as filtered, and accept will not affect its processing. Replies to private mentions initiated by the user, as well as accounts the user follows, are always allowed, regardless of this value.
/// </summary>
[JsonPropertyName("for_private_mentions")]
public string ForPrivateMentions { get; set; } = string.Empty;

/// <summary>
/// Whether to accept, filter or drop notifications from accounts that were limited by a moderator. drop will prevent creation of the notification object altogether (without preventing the underlying activity), filter will cause it to be marked as filtered, and accept will not affect its processing.
/// </summary>
[JsonPropertyName("for_limited_accounts")]
public string ForLimitedAccounts { get; set; } = string.Empty;

/// <summary>
/// Summary of the filtered notifications
/// </summary>
[JsonPropertyName("summary")]
public Summary Summary { get; set; } = new Summary();
}

public class Summary
{
/// <summary>
/// Number of different accounts from which the user has non-dismissed filtered notifications. Capped at 100.
/// </summary>
[JsonPropertyName("pending_requests_count")]
public int PendingRequestsCount { get; set; }

/// <summary>
/// Number of total non-dismissed filtered notifications. May be inaccurate.
/// </summary>
[JsonPropertyName("pending_notifications_count")]
public int PendingNotificationsCount { get; set; }
}
}
46 changes: 46 additions & 0 deletions Mastonet.Entities/NotificationRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.Json.Serialization;

namespace Mastonet.Entities
{
public class NotificationRequest
{
/// <summary>
/// The id of the notification request in the database.
/// </summary>
[JsonPropertyName("id")]
public string Id { get; set; } = string.Empty;

/// <summary>
/// The timestamp of the notification request, i.e. when the first filtered notification from that user was created.
/// </summary>
[JsonPropertyName("created_at")]
public string CreatedAt { get; set; } = string.Empty;

/// <summary>
/// The timestamp of when the notification request was last updated.
/// </summary>
[JsonPropertyName("updated_at")]
public string UpdatedAt { get; set; } = string.Empty;

/// <summary>
/// The account that performed the action that generated the filtered notifications.
/// </summary>
[JsonPropertyName("account")]
public Account Account { get; set; } = new Account();

/// <summary>
/// How many of this account’s notifications were filtered.
/// </summary>
[JsonPropertyName("notifications_count")]
public string NotificationsCount { get; set; } = string.Empty;

/// <summary>
/// Most recent status associated with a filtered notification from that account.
/// </summary>
[JsonPropertyName("last_status")]
public string LastStatus { get; set; } = string.Empty;
}
}
6 changes: 6 additions & 0 deletions Mastonet.Entities/Relationship.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public class Relationship
[JsonPropertyName("requested")]
public bool Requested { get; set; }

/// <summary>
/// Has this user requested to follow you?
/// </summary>
[JsonPropertyName("requested_by")]
public bool RequestedBy { get; set; }

/// <summary>
/// Are you featuring this user on your profile?
/// </summary>
Expand Down
Loading