Hsm.DataAnalysisService.Client
5.0.0
dotnet add package Hsm.DataAnalysisService.Client --version 5.0.0
NuGet\Install-Package Hsm.DataAnalysisService.Client -Version 5.0.0
<PackageReference Include="Hsm.DataAnalysisService.Client" Version="5.0.0" />
<PackageVersion Include="Hsm.DataAnalysisService.Client" Version="5.0.0" />
<PackageReference Include="Hsm.DataAnalysisService.Client" />
paket add Hsm.DataAnalysisService.Client --version 5.0.0
#r "nuget: Hsm.DataAnalysisService.Client, 5.0.0"
#:package Hsm.DataAnalysisService.Client@5.0.0
#addin nuget:?package=Hsm.DataAnalysisService.Client&version=5.0.0
#tool nuget:?package=Hsm.DataAnalysisService.Client&version=5.0.0
Hsm.DataAnalysisService.Client
Interfaces:
- 'IDataAnalysisServiceClientApiV1'
ExampleUsage:
services
.AddGeneratedRestClient<IDataAnalysisServiceClientApiV1>(() => 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>())
ExceptionTransformer
public class DataAnalysisExceptionTransformer : AbstractDataAnalysisServiceClientApiV1ExceptionTransformer
{
...
}
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()
.AddExceptionTransformer(new DigitalTwinExceptionTransformer())
.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
//create a instance of your exceptionTransformer
public class DigitalTwinExceptionTransformer : AbstractDigitalTwinServiceClientApiV2ExceptionTransformer
{
...
}
//register it
.AddExceptionTransformation(new DigitalTwinExceptionTransformer())
Allows mapping API exceptions to domain-specific exceptions based on:
- called method
- returned errorDto(s) (while providing fallback for incorrect swagger docs)
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
)
Initialization/setting with existent values
If caching is added automatically adds ICacheSetter<IOperationalContextClientApiV1>
If you have DTOs eg after you retreived pages or you want to set the value from a response you can explicitly set the cache while still respecting your caching options.
It will behave exactly the same for the method as defined in the Cacheoptions but the service-call will be replaced with a noop returning the response you defined.
await _cacheSetter.TrySetReturnValueAsync(
client => client.GetStringAsync(23), // the exact mathod will be cached => only with parameter 23 in this case
"newString", // with this response
cancellationToken);
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 | Versions 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. |
-
.NETStandard 2.0
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.9)
- Newtonsoft.Json (>= 13.0.4)
-
.NETStandard 2.1
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 10.0.12)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.9)
- Newtonsoft.Json (>= 13.0.4)
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 |
|---|---|---|
| 5.0.0 | 134 | 9/10/2026 |
| 4.1.1 | 913 | 9/8/2025 |
| 4.1.0 | 287 | 8/20/2025 |
| 4.0.1 | 404 | 7/1/2025 |
| 4.0.0 | 378 | 5/16/2025 |
| 3.0.1 | 263 | 3/21/2025 |
| 3.0.0 | 269 | 3/13/2025 |
| 2.0.1 | 1,838 | 6/17/2024 |
| 2.0.0 | 231 | 6/17/2024 |
| 1.4.0 | 6,546 | 11/14/2022 |
| 1.0.0 | 6,476 | 7/6/2021 |
| 0.4.0 | 1,544 | 6/1/2021 |
| 0.3.2 | 1,112 | 5/26/2021 |
| 0.1.0 | 1,120 | 4/29/2021 |
| 0.0.4 | 1,910 | 3/12/2021 |
| 0.0.3 | 1,100 | 3/12/2021 |
| 0.0.2 | 1,075 | 2/2/2021 |
| 0.0.1-beta.1 | 350 | 1/29/2021 |
| 0.0.1-beta.0 | 334 | 1/29/2021 |