Big update. Replaced Newtonsoft with System.Text.Json where possible, removed Spectre, tried to suppress the pile of compiler warnings I get on the GUI project, and tried to correct an issue where sometimes the session token retrieved is not usable.

This commit is contained in:
barelyprofessional
2024-06-14 23:03:05 +08:00
parent 98f7b2b27e
commit cdad1d6549
21 changed files with 281 additions and 251 deletions

View File

@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using System.Text.Json.Serialization;
using KickWsClient.Converters;
namespace KickWsClient.Models;
@@ -9,17 +10,18 @@ public class PusherModels
/// <summary>
/// Name of the event
/// </summary>
[JsonProperty("event")]
[JsonPropertyName("event")]
public required string Event { get; set; }
/// <summary>
/// Stringified JSON payload
/// </summary>
[JsonProperty("data")]
[JsonPropertyName("data")]
[JsonConverter(typeof(StringOrObjectConverter<string>))]
public required string Data { get; set; }
/// <summary>
/// Channel where event originates. Only included events where a channel is applicable
/// </summary>
[JsonProperty("channel")]
[JsonPropertyName("channel")]
public string? Channel { get; set; }
}
@@ -28,12 +30,12 @@ public class PusherModels
/// <summary>
/// Name of the event
/// </summary>
[JsonProperty("event")]
[JsonPropertyName("event")]
public required string Event { get; set; }
/// <summary>
/// Data as object. It's only stringified for responses
/// </summary>
[JsonProperty("data")]
[JsonPropertyName("data")]
public required object Data { get; set; }
}
@@ -42,12 +44,12 @@ public class PusherModels
/// <summary>
/// Internal socket ID
/// </summary>
[JsonProperty("socket_id")]
[JsonPropertyName("socket_id")]
public required string SocketId { get; set; }
/// <summary>
/// Timeout on no activity in seconds
/// </summary>
[JsonProperty("activity_timeout")]
[JsonPropertyName("activity_timeout")]
public int ActivityTimeout { get; set; }
}
@@ -56,12 +58,12 @@ public class PusherModels
/// <summary>
/// Token to authenticate with, use an empty string for guest.
/// </summary>
[JsonProperty("auth")]
[JsonPropertyName("auth")]
public string Auth { get; set; } = "";
/// <summary>
/// Channel you wish to subscribe to. 'channel.2515504' for stream events. 'chatrooms.2515504.v2' for chat where 2515504 is the channel ID
/// </summary>
[JsonProperty("channel")]
[JsonPropertyName("channel")]
public required string Channel { get; set; }
}
@@ -70,7 +72,7 @@ public class PusherModels
/// <summary>
/// Channel you wish to unsubscribe from, e.g. 'channel.2515504'
/// </summary>
[JsonProperty("channel")]
[JsonPropertyName("channel")]
public required string Channel { get; set; }
}
}