21 lines
848 B
C#
21 lines
848 B
C#
namespace Uwaa.Pleroma;
|
|
|
|
/// <summary>
|
|
/// Base class for ActivityStreams objects.
|
|
/// </summary>
|
|
public class ASObject
|
|
{
|
|
/// <summary>
|
|
/// Pleroma uses 128-bit ids as opposed to Mastodon's 64 bits. However just like Mastodon's ids they are lexically sortable strings
|
|
/// </summary>
|
|
[JsonPropertyName("id")]
|
|
public string ID { get; set; } = null!;
|
|
|
|
public override string ToString() => ID;
|
|
|
|
public override bool Equals(object? obj) => Equals(obj as ASObject);
|
|
public bool Equals(ASObject? other) => other is not null && ID == other.ID;
|
|
public static bool operator ==(ASObject? left, ASObject? right) => EqualityComparer<ASObject>.Default.Equals(left, right);
|
|
public static bool operator !=(ASObject? left, ASObject? right) => !(left == right);
|
|
public override int GetHashCode() => ID.GetHashCode();
|
|
}
|