Hsm.CatalogService.Client 1.0.0-alpha.3

This is a prerelease version of Hsm.CatalogService.Client.
dotnet add package Hsm.CatalogService.Client --version 1.0.0-alpha.3
                    
NuGet\Install-Package Hsm.CatalogService.Client -Version 1.0.0-alpha.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Hsm.CatalogService.Client" Version="1.0.0-alpha.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Hsm.CatalogService.Client" Version="1.0.0-alpha.3" />
                    
Directory.Packages.props
<PackageReference Include="Hsm.CatalogService.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Hsm.CatalogService.Client --version 1.0.0-alpha.3
                    
#r "nuget: Hsm.CatalogService.Client, 1.0.0-alpha.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Hsm.CatalogService.Client@1.0.0-alpha.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Hsm.CatalogService.Client&version=1.0.0-alpha.3&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Hsm.CatalogService.Client&version=1.0.0-alpha.3&prerelease
                    
Install as a Cake Tool

Hsm.CatalogService.Client

Interfaces:

  • 'ICatalogServiceCommonApi'
  • 'ICatalogServiceBrowseApiV3'

ExampleUsage:

services
    .AddGeneratedRestClient<ICatalogServiceCommonApi>(() => ServiceClientConfiguration)

Caching

Adds AddRecommendedMethods(). These can change over time and should be considered volatile. Does only cache. nothing about invalidation.

.AddCaching(
    config => config.AddRecommendedMethods(),
    sp => sp.GetRequiredService<IDistributedCache>())

Generic Client Documentation

Basic Usage

Example using the client IOperationalContextClientApiV1:

services
    .AddGeneratedRestClient<IOperationalContextClientApiV1>(() => ServiceClientConfiguration)
    .Register();

This registers the generated REST client with a configured base URL.

Full Example

services
.AddDistributedMemoryCache()
.AddGeneratedRestClient<IOperationalContextClientApiV1>(() => ServiceClientConfiguration)

    .AddStandardHttpResilience()

    .AddExceptionTransformation((_, exception) =>
        exception switch
        {
            OperationalContextApiException<ErrorContainer> typedError
                when typedError.Result.Error.Code == "NoOperationalContext"
                => new TestException("OperationalContext NotFound", exception),

            _ => exception,
        })

    .AddCaching(
        config => config.AddRecommendedMethods(),
        sp => sp.GetRequiredService<IDistributedCache>())

    .Register();

Features

Resilience

.AddStandardHttpResilience()

Adds default HTTP resilience (retries, timeouts, etc.). Optional overrides can be provided if needed.

Exception Transformation

.AddExceptionTransformation((method, exception) => ...)

Allows mapping API exceptions to domain-specific exceptions based on:

  • called method
  • returned error

Caching

Setup Caching Definitions

Caching is opt-in and method-based:

  • Only methods returning Task<T> can be cached
  • Each method maps to a CacheOptions (TTL, etc.)
  • Re-registering a method overwrites previous configuration

Selection

  • Add(...) → single method
  • AddWhere(...) → bulk selection by predicate
  • Remove(...) / RemoveWhere(...) → exclusions

⚠️ AddWhere(_ ⇒ true) will cache everything returning Task<T> (including POST-like calls)

Exceptions are never cached

.AddCaching(
    config => config
        .Add(client => client.GetSomethingAsync(id))                 // cache specific method
        .SetNewOptionsDefault(new CacheOptions(TimeSpan.FromHours(1))) // default TTL for all methods following
        .AddWhere(m => m.Name.StartsWith("Get"))                     // cache multiple methods
        .Remove(client => client.GetSomethingAsync(otherId)),        // remove if needed
    sp => sp.GetRequiredService<IDistributedCache>()                // backing cache
)
Invalidation

If caching is added automatically adds ICacheInvalidator<IOperationalContextClientApiV1>

await cacheInvalidator.InvalidateAsync(client => client.GetSomethingAsync(id), cancellationToken);

Invalidates exactly one method call (method + arguments). the arguments have to match exactly for the cache to be invalidated (ignoring CancellationTokens)

Health Checks

If the client supports it, you can register a health check:

Only works for clients implementing the required health interface inside the Client, otherwise, this call will fail at compile time.

services.AddRestClientHealthCheck<IOperationalContextClientApiV1>();

Order of Operations

TIClient (resolved from DI)
└── ExceptionTransformationDecorator (Optional)
    └── CacheDecorator (Optional)
        └── TClient (generated REST client)
            └── HttpClient
                ├── OAuth2 Token Handler (Optional)
                └── Resilience Handler (retries, timeouts, etc.) (Optional)

Notes

  • All features are optional and composable
  • Order of builder calls does not matter (eg ExcepiontTransformation and Caching will not change their order of operations)
  • Internally uses decorators to build the pipeline
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.3 52 5/28/2026
1.0.0-alpha.2 36 5/28/2026
1.0.0-alpha.1 47 5/22/2026
1.0.0-alpha.0 50 5/19/2026