DevOp.Toon already gives you encoding and decoding APIs. DevOp.Toon.Client is what turns that runtime into a clean HTTP client story for calling TOON-first APIs.
Without this package, consuming a TOON API from .NET means:
IToonServiceContent-Type: application/toonAccept headers with the right priority orderContent-Type and branching between TOON and JSON deserializationX-Toon-Option-* headers when you want to influence the server's response shapeHttpClientHandlerDevOp.Toon.Client handles all of that in one registered client so application code stays focused on models and business logic.
Not every endpoint in a real system serves TOON. DevOp.Toon.Client negotiates via Accept headers and deserializes based on the actual response Content-Type — so the same client works against TOON-first and JSON-only endpoints without branching in application code.
Raw HttpClient gives you a status code and a stream. DevOp.Toon.Client gives you a ToonClientException with the response body, content type, status code, and a typed Decode<T>() method — so you can read a ProblemDetails or a custom error DTO directly from the catch block without writing any parsing code:
catch (ToonClientException ex) when (ex.StatusCode == HttpStatusCode.UnprocessableEntity)
{
var validationError = ex.Decode<ValidationProblemDetails>();
}
This works for both TOON and JSON error responses, using the same content-type detection the client applies to success responses.
Use it when:
If you only need to serialize or deserialize TOON data within your own process — not over HTTP — use DevOp.Toon directly. DevOp.Toon.Client is specifically for outbound HTTP calls.