DevOp.Toon.Client is a typed HTTP client for .NET that makes communicating with TOON-first APIs as straightforward as working with any other strongly typed client.
It wraps HttpClient and integrates with DevOp.Toon to handle TOON encoding of request bodies, TOON/JSON response negotiation, and per-request server-side formatting overrides — all configured in one place through dependency injection.
Version scope: Core 0.2.0, runtime 0.3.0, API 0.2.0, and Client 0.2.0.
Encoding defaults to official 4.4. Supply ToonEncodeOptions.ProtocolVersion with a concrete ToonProtocolVersion: V3_0, V4_0 through V4_4, CustomLegacy, or CustomV4_4. Decoding defaults to Auto; ambiguous version-dependent input needs an explicit ToonDecodeOptions.ProtocolVersion. Auto cannot be used for encoding or as a transport version.
Select CustomLegacy to retain the earlier custom wire profile. CustomV4_4 combines nested header groups with row/keyed spills. Custom profiles require compatible readers at both ends and default IgnoreNullOrEmpty and ExcludeEmptyArrays to true. Official profiles default both to false. Set both explicitly false when preserving null, empty-string, and empty-array distinctions matters. Explicit option overrides remain effective when changing versions. Columnar requires a custom protocol selection.
Encoder options and runtime DI encoding default to one-space indentation; decoder options default to two spaces. With explicit decode options, match the producer’s indentation or detect options using the supplied version hint. API registration aligns both widths at two spaces. Byte sequences default to Base64 strings; numeric-array output is an explicit policy choice.
Request X-Toon-Version labels the request body. Request X-Toon-Option-ProtocolVersion independently selects the response format. Response X-Toon-Version labels the actual TOON response. Concrete wire names are 3.0, 4.0 through 4.4, custom-legacy, and custom-4.4.
API 0.2.0 validates version headers and supplied X-Toon-Option-* headers before model binding/body consumption. Malformed, multiple, or conflicting body versions return 400; well-formed unsupported body versions return 415. Malformed response-version requests return 400; well-formed unsupported response versions return 406. Version validation errors use application/problem+json.
X-Toon-Option-Indent takes an integer width from 1 through 16; booleans and out-of-range widths return 400. This HTTP input limit is separate from trusted direct runtime configuration. API indentation defaults to two spaces when no override is supplied.
Client 0.2.0 changes ToonResponseEncodeOverrideOptions.Indent from bool? to int?. Use Indent = 2, or null to omit the override. EncodeOptions.ProtocolVersion controls outbound request bodies; ResponseEncodeOverrides.ProtocolVersion controls response selection. Invalid, unsupported, multiple, or conflicting response-version hints produce ToonClientException. An explicit decoder setting must agree with the response header. Without a header, configured decode options apply, defaulting to Auto.
IToonClient — a strongly typed HTTP client interface covering GET, POST, PUT, PATCH, and DELETEX-Toon-Option-*ToonClientException — status code, raw body, and Decode<T>() for typed error DTOsILogger<ToonClient>, resolved automatically from DIAddToonClient(...)Use DevOp.Toon.Client when:
application/toon or text/toonDevOp.Toon and want HTTP client integration to matchFor engineering readers: architecture notes, build configuration, and contributor guidance are in the development section below.
https://www.nuget.org/packages/DevOp.Toon.Client
Source usage reference: DevOp.Toon.Client README.