Skip to content

Commit

Permalink
Update deprecated fields (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
PassiveModding authored Nov 1, 2024
1 parent cbde50b commit b3a7f0b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
2 changes: 1 addition & 1 deletion samples/Jetstream/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
14 changes: 10 additions & 4 deletions src/FishyFlip/Models/ATWebSocketCommit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public class ATWebSocketCommit
/// Initializes a new instance of the <see cref="ATWebSocketCommit"/> class.
/// </summary>
/// <param name="rev">The revision identifier.</param>
/// <param name="type">The type of the WebSocket commit.</param>
/// <param name="operation">The type of the WebSocket commit.</param>
/// <param name="collection">The collection name.</param>
/// <param name="rKey">The record key.</param>
/// <param name="record">The record associated with the commit.</param>
/// <param name="cid">The CID associated with the commit.</param>
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;
Expand All @@ -36,7 +36,13 @@ public ATWebSocketCommit(string? rev, ATWebSocketCommitType type, string? collec
/// <summary>
/// Gets the type of the WebSocket commit.
/// </summary>
public ATWebSocketCommitType Type { get; }
public ATWebSocketCommitType Operation { get; }

/// <summary>
/// Gets the type of the WebSocket commit.
/// </summary>
[Obsolete("Use Operation instead.")]
public ATWebSocketCommitType Type => this.Operation;

/// <summary>
/// Gets the collection name.
Expand Down
14 changes: 10 additions & 4 deletions src/FishyFlip/Models/ATWebSocketRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ public class ATWebSocketRecord
/// <summary>
/// Initializes a new instance of the <see cref="ATWebSocketRecord"/> class.
/// </summary>
/// <param name="type">Type.</param>
/// <param name="kind">Type.</param>
/// <param name="did">Did.</param>
/// <param name="commit">Commit.</param>
/// <param name="identity">Identity.</param>
/// <param name="account">Account.</param>
[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;
Expand All @@ -30,7 +30,13 @@ public ATWebSocketRecord(ATWebSocketEvent type, ATDid? did, ATWebSocketCommit? c
/// <summary>
/// Gets the Type.
/// </summary>
public ATWebSocketEvent Type { get; }
public ATWebSocketEvent Kind { get; }

/// <summary>
/// Gets the Type.
/// </summary>
[Obsolete("Use Kind instead.")]
public ATWebSocketEvent Type => this.Kind;

/// <summary>
/// Gets the Commit.
Expand Down
6 changes: 3 additions & 3 deletions src/FishyFlip/Tools/Json/ATWebSocketCommitTypeConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/FishyFlip/Tools/Json/ATWebSocketEventConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b3a7f0b

Please sign in to comment.