diff --git a/DragonFruit.Data.Serializers.Html/DragonFruit.Data.Serializers.Html.csproj b/DragonFruit.Data.Serializers.Html/DragonFruit.Data.Serializers.Html.csproj index a1c0c5b..6d00d0d 100644 --- a/DragonFruit.Data.Serializers.Html/DragonFruit.Data.Serializers.Html.csproj +++ b/DragonFruit.Data.Serializers.Html/DragonFruit.Data.Serializers.Html.csproj @@ -17,6 +17,10 @@ + + + + diff --git a/DragonFruit.Data.Serializers.Html/readme.md b/DragonFruit.Data.Serializers.Html/readme.md new file mode 100644 index 0000000..72bf414 --- /dev/null +++ b/DragonFruit.Data.Serializers.Html/readme.md @@ -0,0 +1,41 @@ +# DragonFruit.Data.Serializers.Html +A serializer adding `HtmlDocument` support to DragonFruit.Data + +[![Latest Nuget](https://img.shields.io/nuget/v/DragonFruit.Data.Serializers.Html?label=DragonFruit.Data.Serializers.Html&logo=nuget)](https://nuget.org/packages/DragonFruit.Data.Serializers.Html) +[![DragonFruit Discord](https://img.shields.io/discord/482528405292843018?label=Discord&style=popout)](https://discord.gg/VA26u5Z) + +## Overview +DragonFruit.Data.Serializers.Html is a serializer for DragonFruit.Data that allows `HtmlDocument` to be used as a response type. +`HtmlDocument` functionality is provided by [HtmlAgilityPack](https://github.com/zzzprojects/html-agility-pack), an open-source, MIT-licensed HTML parser. + +## Usage/Getting Started +To get started install the [NuGet package](https://nuget.org/packages/DragonFruit.Data.Serializers.Html) alongside `DragonFruit.Data` and register it as a serializer. + +```csharp +using DragonFruit.Data; +using DragonFruit.Data.Serializers.Html; + +namespace DataExample; + +public static class Program +{ + internal static ApiClient Client = new ApiClient + { + UserAgent = "DataExample" + }; + + static Program() + { + // register html serializer defaults + HtmlSerializer.RegisterDefaults(); + } + + public static async Task Main(string[] args) + { + var html = await Client.PerformAsync("https://example.com"); + + // html can now be manipulated as needed + } + +} +``` \ No newline at end of file diff --git a/DragonFruit.Data.Serializers.Newtonsoft/DragonFruit.Data.Serializers.Newtonsoft.csproj b/DragonFruit.Data.Serializers.Newtonsoft/DragonFruit.Data.Serializers.Newtonsoft.csproj index c9217bb..0359aed 100644 --- a/DragonFruit.Data.Serializers.Newtonsoft/DragonFruit.Data.Serializers.Newtonsoft.csproj +++ b/DragonFruit.Data.Serializers.Newtonsoft/DragonFruit.Data.Serializers.Newtonsoft.csproj @@ -18,6 +18,10 @@ + + + + diff --git a/DragonFruit.Data.Serializers.Newtonsoft/readme.md b/DragonFruit.Data.Serializers.Newtonsoft/readme.md new file mode 100644 index 0000000..c414b0e --- /dev/null +++ b/DragonFruit.Data.Serializers.Newtonsoft/readme.md @@ -0,0 +1,33 @@ +# DragonFruit.Data.Serializers.Newtonsoft +A serializer adding `Newtonsoft.Json` support to DragonFruit.Data + +[![Latest Nuget](https://img.shields.io/nuget/v/DragonFruit.Data.Serializers.Newtonsoft?label=DragonFruit.Data.Serializers.Newtonsoft&logo=nuget)](https://nuget.org/packages/DragonFruit.Data.Serializers.Newtonsoft) +[![DragonFruit Discord](https://img.shields.io/discord/482528405292843018?label=Discord&style=popout)](https://discord.gg/VA26u5Z) + +## Overview +DragonFruit.Data.Serializers.Newtonsoft is a generic serializer for DragonFruit.Data that allows Newtonsoft.Json to be used as a generic JSON serializer. + +## Usage/Getting Started +To get started install the [NuGet package](https://nuget.org/packages/DragonFruit.Data.Serializers.Newtonsoft) and replace the default serializer with the Newtonsoft one. + +```csharp +using DragonFruit.Data; +using DragonFruit.Data.Serializers.Newtonsoft; + +namespace DataExample; + +public static class Program +{ + internal static ApiClient Client = new ApiClient + { + UserAgent = "DataExample" + }; + + static Program() + { + // optionally, register serializer defaults to always deserialize JObjects with Newtonsoft + // using this will allow for a different serializer to be used for other types, while not breaking JObject support. + NewtonsoftJsonSerializer.RegisterDefaults(); + } +} +``` \ No newline at end of file