Skip to content

Commit

Permalink
add serializer readme.md files
Browse files Browse the repository at this point in the history
  • Loading branch information
aspriddell committed Dec 19, 2023
1 parent 9274a01 commit dab2d47
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<ItemGroup>
<ProjectReference Include="..\DragonFruit.Data\DragonFruit.Data.csproj"/>
</ItemGroup>

<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath="." Visible="false"/>
</ItemGroup>

<Import Project="..\res\DragonFruit.Data.Nuget.props"/>

Expand Down
41 changes: 41 additions & 0 deletions DragonFruit.Data.Serializers.Html/readme.md
Original file line number Diff line number Diff line change
@@ -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<ApiJsonSerializer>
{
UserAgent = "DataExample"
};

static Program()
{
// register html serializer defaults
HtmlSerializer.RegisterDefaults();
}

public static async Task Main(string[] args)
{
var html = await Client.PerformAsync<HtmlDocument>("https://example.com");

// html can now be manipulated as needed
}

}
```
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
<ProjectReference Include="..\DragonFruit.Data\DragonFruit.Data.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="readme.md" Pack="true" PackagePath="." Visible="false"/>
</ItemGroup>

<Import Project="..\res\DragonFruit.Data.Nuget.props"/>

</Project>
33 changes: 33 additions & 0 deletions DragonFruit.Data.Serializers.Newtonsoft/readme.md
Original file line number Diff line number Diff line change
@@ -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<NewtonsoftJsonSerializer>
{
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();
}
}
```

0 comments on commit dab2d47

Please sign in to comment.