From b3a7f0b9da80a58d054fdcdfd556228b1112fcd7 Mon Sep 17 00:00:00 2001
From: Jaquesy <20432486+PassiveModding@users.noreply.github.com>
Date: Sat, 2 Nov 2024 02:22:45 +1100
Subject: [PATCH] Update deprecated fields (#76)
---
samples/Jetstream/Program.cs | 2 +-
src/FishyFlip/Models/ATWebSocketCommit.cs | 14 ++++++++++----
src/FishyFlip/Models/ATWebSocketRecord.cs | 14 ++++++++++----
.../Tools/Json/ATWebSocketCommitTypeConverter.cs | 6 +++---
.../Tools/Json/ATWebSocketEventConverter.cs | 6 +++---
5 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/samples/Jetstream/Program.cs b/samples/Jetstream/Program.cs
index 78c0bf40..00d9280e 100644
--- a/samples/Jetstream/Program.cs
+++ b/samples/Jetstream/Program.cs
@@ -21,7 +21,7 @@
atWebProtocol.OnRecordReceived += (sender, args) =>
{
- Console.WriteLine($"Record Received: {args.Record.Type}");
+ Console.WriteLine($"Record Received: {args.Record.Kind}");
};
await atWebProtocol.ConnectAsync();
diff --git a/src/FishyFlip/Models/ATWebSocketCommit.cs b/src/FishyFlip/Models/ATWebSocketCommit.cs
index ef20cd2c..116e9eda 100644
--- a/src/FishyFlip/Models/ATWebSocketCommit.cs
+++ b/src/FishyFlip/Models/ATWebSocketCommit.cs
@@ -13,15 +13,15 @@ public class ATWebSocketCommit
/// Initializes a new instance of the class.
///
/// The revision identifier.
- /// The type of the WebSocket commit.
+ /// The type of the WebSocket commit.
/// The collection name.
/// The record key.
/// The record associated with the commit.
/// The CID associated with the commit.
- public ATWebSocketCommit(string? rev, ATWebSocketCommitType type, string? collection, string? rKey, ATRecord? record, ATCid? cid)
+ public ATWebSocketCommit(string? rev, ATWebSocketCommitType operation, string? collection, string? rKey, ATRecord? record, ATCid? cid)
{
this.Rev = rev;
- this.Type = type;
+ this.Operation = operation;
this.Collection = collection;
this.RKey = rKey;
this.Record = record;
@@ -36,7 +36,13 @@ public ATWebSocketCommit(string? rev, ATWebSocketCommitType type, string? collec
///
/// Gets the type of the WebSocket commit.
///
- public ATWebSocketCommitType Type { get; }
+ public ATWebSocketCommitType Operation { get; }
+
+ ///
+ /// Gets the type of the WebSocket commit.
+ ///
+ [Obsolete("Use Operation instead.")]
+ public ATWebSocketCommitType Type => this.Operation;
///
/// Gets the collection name.
diff --git a/src/FishyFlip/Models/ATWebSocketRecord.cs b/src/FishyFlip/Models/ATWebSocketRecord.cs
index db1d51fe..4a1c2550 100644
--- a/src/FishyFlip/Models/ATWebSocketRecord.cs
+++ b/src/FishyFlip/Models/ATWebSocketRecord.cs
@@ -12,15 +12,15 @@ public class ATWebSocketRecord
///
/// Initializes a new instance of the class.
///
- /// Type.
+ /// Type.
/// Did.
/// Commit.
/// Identity.
/// Account.
[JsonConstructor]
- public ATWebSocketRecord(ATWebSocketEvent type, ATDid? did, ATWebSocketCommit? commit, ActorIdentity? identity, ActorAccount? account)
+ public ATWebSocketRecord(ATWebSocketEvent kind, ATDid? did, ATWebSocketCommit? commit, ActorIdentity? identity, ActorAccount? account)
{
- this.Type = type;
+ this.Kind = kind;
this.Did = did;
this.Commit = commit;
this.Identity = identity;
@@ -30,7 +30,13 @@ public ATWebSocketRecord(ATWebSocketEvent type, ATDid? did, ATWebSocketCommit? c
///
/// Gets the Type.
///
- public ATWebSocketEvent Type { get; }
+ public ATWebSocketEvent Kind { get; }
+
+ ///
+ /// Gets the Type.
+ ///
+ [Obsolete("Use Kind instead.")]
+ public ATWebSocketEvent Type => this.Kind;
///
/// Gets the Commit.
diff --git a/src/FishyFlip/Tools/Json/ATWebSocketCommitTypeConverter.cs b/src/FishyFlip/Tools/Json/ATWebSocketCommitTypeConverter.cs
index da60151a..5e9205bb 100644
--- a/src/FishyFlip/Tools/Json/ATWebSocketCommitTypeConverter.cs
+++ b/src/FishyFlip/Tools/Json/ATWebSocketCommitTypeConverter.cs
@@ -20,11 +20,11 @@ public override ATWebSocketCommitType Read(ref Utf8JsonReader reader, Type typeT
switch (value)
{
- case "u":
+ case "update":
return ATWebSocketCommitType.Update;
- case "c":
+ case "create":
return ATWebSocketCommitType.Create;
- case "d":
+ case "delete":
return ATWebSocketCommitType.Delete;
default:
return ATWebSocketCommitType.Unknown;
diff --git a/src/FishyFlip/Tools/Json/ATWebSocketEventConverter.cs b/src/FishyFlip/Tools/Json/ATWebSocketEventConverter.cs
index 635bc2d6..ff56ca17 100644
--- a/src/FishyFlip/Tools/Json/ATWebSocketEventConverter.cs
+++ b/src/FishyFlip/Tools/Json/ATWebSocketEventConverter.cs
@@ -20,11 +20,11 @@ public override ATWebSocketEvent Read(ref Utf8JsonReader reader, Type typeToConv
switch (value)
{
- case "com":
+ case "commit":
return ATWebSocketEvent.Commit;
- case "acc":
+ case "account":
return ATWebSocketEvent.Account;
- case "id":
+ case "identity":
return ATWebSocketEvent.Identity;
default:
return ATWebSocketEvent.Unknown;