Dangl.RestClient
Changelog
Online Documentation
This project provides DanglHttpClient to easily interact with all Dangl web services.
To avoid TCP exhaustion, HttpClients and derived types should always be used as singletons.
ITokenHandler
The ITokenHandler is an interface that be be used to support the automatic
obtaining of Tokens and refreshing them. It can be configured to support either of
the functionalities or none at all. If none is supplied, by default a NoOpTokenHandler
is used that does not perform any operations.
It can be used, for example, in server backends that use the ClientCredentials grant.
If you want to act when a token is obtained or refreshed, you can use the EventHandler<TokenUpdateEventArgs> TokenUpdate
event on the ITokenHandler.
ITokenStorage
The ITokenStorage is an interface that is used to store and persist tokens, e.g.
it could use the local app storage on a mobile app or the database in a server application.
It is used so that only tokens and not the full user credentials need to be stored.
By default, there's an InMemoryTokenStorage for non-persisting use available.
DanglHttpClientAccessor
This is a simple class that only keeps a reference to an HttpClient. When the HttpClientFactory pattern
is used, this class can be specified as a dependency to be able to have easy access via dependency injection to
a correctly lifetime-managed HttpClient.
FallbackHandler
The FallbackHandler is a DelegatingHandler that can be configured with multiple baseUrls. If a request
is returning an error that can possibly be recovered from by pointing to a fallback, the request is sent again
to the next available fallback url.
AuthenticationHandler
The AuthenticationHandler internally uses ITokenHandler and ITokenStorage to append OAuth2 Bearer
authentication to whitelisted urls.
GzipHandler
The GzipHandler is an implementation of DelegatingHandler that sends requests gzip compressed.
DependencyInjection
The AddDanglHttpClient<T>() method can be used to register an HttpClient with both an AuthenticationHandler
and a FallbackHandler via the HttpClientFactory pattern.
Assembly Strong Naming & Usage in Signed Applications
This module produces strong named assemblies when compiled. When consumers of this package require strongly named assemblies, for example when they
themselves are signed, the outputs should work as-is.
The key file to create the strong name is adjacent to the csproj file in the root of the source project. Please note that this does not increase
security or provide tamper-proof binaries, as the key is available in the source code per
Microsoft guidelines
Build and Markdown documentation
Build automation uses Fallout with the .NET 10 SDK or newer. The bootstrap scripts use .fallout configuration and install .NET 10 when a compatible SDK is unavailable.
BuildDocumentation generates the HTML site in output/docs and native DocFX Markdown API documentation, articles and assets in output/docs-markdown, with an adjacent ZIP archive. Start at index.md; API reference directories follow the HTML documentation's project scopes.
Both metadata entries in docfx.json use the library project's target framework without overriding it.
DocFX invocations preserve the build process environment and add DOCFX_SOURCE_BRANCH_NAME, so NuGet and MSBuild retain their profile, package-cache and temporary-directory settings.
TestMarkdownDocumentation checks native API preservation, archive layout, article links, resource globs, exclusions and missing entry-point errors without publishing.
UploadDocumentation uses Dangl.Fallout.WebDocu to upload the Markdown archive after HTML for the same explicit version. Existing API keys, branch gates, downloadable assets and version-conflict policies are preserved. Markdown documentation is available to AI agents through the DanglDocu MCP server.