From e6316aaba215a9cd0e8e3651207352087ce30531 Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Sat, 15 Nov 2025 18:37:06 -0500 Subject: [PATCH] Small clean up --- Converters/BoolConverter.cs | 29 ++++++++++++++--------------- FeverClient.cs | 2 +- README.md | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/Converters/BoolConverter.cs b/Converters/BoolConverter.cs index b3e70d4..4d1fd91 100644 --- a/Converters/BoolConverter.cs +++ b/Converters/BoolConverter.cs @@ -1,25 +1,24 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace ChrisKaczor.FeverClient.Converters +namespace ChrisKaczor.FeverClient.Converters; + +public class BoolConverter : JsonConverter { - public class BoolTimestampConverter : JsonConverter + public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { - public override bool Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + if (reader.TokenType != JsonTokenType.Number) { - if (reader.TokenType != JsonTokenType.Number) - { - throw new JsonException("Expected a numeric boolean value"); - } - - var number = reader.GetInt64(); - return number == 1; + throw new JsonException("Expected a numeric boolean value"); } - public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) - { - var number = value ? 1 : 0; - writer.WriteNumberValue(number); - } + var number = reader.GetInt64(); + return number == 1; + } + + public override void Write(Utf8JsonWriter writer, bool value, JsonSerializerOptions options) + { + var number = value ? 1 : 0; + writer.WriteNumberValue(number); } } \ No newline at end of file diff --git a/FeverClient.cs b/FeverClient.cs index 0d92f30..40b1d55 100644 --- a/FeverClient.cs +++ b/FeverClient.cs @@ -15,7 +15,7 @@ public class FeverClient { _jsonSerializerOptions = new JsonSerializerOptions(); _jsonSerializerOptions.Converters.Add(new EpochConverter()); - _jsonSerializerOptions.Converters.Add(new BoolTimestampConverter()); + _jsonSerializerOptions.Converters.Add(new BoolConverter()); _jsonSerializerOptions.Converters.Add(new CommaSeparatedListConverter()); _restClient = new RestClient(url); diff --git a/README.md b/README.md index d925747..0e6ed44 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This library can be used to read RSS feeds via the Fever API in [Miniflux](https://miniflux.app/index.html) or other similar feed readers/servers. -Only tested with [Miniflux](https://miniflux.app/index.html) so far but works for my needs in [Feed Center](http://github.com/ckaczor/FeedCenter). +Not fully implemented (at least so far) and only tested with [Miniflux](https://miniflux.app/index.html) but works for my needs in [Feed Center](http://github.com/ckaczor/FeedCenter). ## Authors