Repost.Client.DependencyInjection
1.0.8
dotnet add package Repost.Client.DependencyInjection --version 1.0.8
NuGet\Install-Package Repost.Client.DependencyInjection -Version 1.0.8
<PackageReference Include="Repost.Client.DependencyInjection" Version="1.0.8" />
<PackageVersion Include="Repost.Client.DependencyInjection" Version="1.0.8" />
<PackageReference Include="Repost.Client.DependencyInjection" />
paket add Repost.Client.DependencyInjection --version 1.0.8
#r "nuget: Repost.Client.DependencyInjection, 1.0.8"
#:package Repost.Client.DependencyInjection@1.0.8
#addin nuget:?package=Repost.Client.DependencyInjection&version=1.0.8
#tool nuget:?package=Repost.Client.DependencyInjection&version=1.0.8
Repost.Client.DependencyInjection
Microsoft.Extensions integration for the Repost
webhook publish client — the Spring-Boot-starter analog, consolidated
.NET-natively. One package serves ASP.NET Core, Worker Service, and Azure
Functions alike, because all three share the Microsoft.Extensions hosting,
options, and health-check abstractions.
The client publishes — it never receives. This package adds no inbound surface: options registration, one health check, and documented drain semantics.
Options registration
// From code:
services.AddRepostClient(options =>
{
options.ApiKey = Environment.GetEnvironmentVariable("REPOST_SEND_API_KEY");
options.BaseUri = "https://api.repost.sh";
});
// Or from configuration (keys map to RepostClientOptions properties by name):
services.AddRepostClient(configuration.GetSection("Repost"));
{
"Repost": {
"ApiKey": "rk_live_...",
"BaseUri": "https://api.repost.sh",
"ConnectTimeout": "00:00:10",
"AttemptTimeout": "00:00:30",
"OperationTimeout": "00:02:00",
"MaxAttempts": 4,
"MaxInFlightOperations": 256,
"MaxBufferedBytes": 67108864,
"RetryBaseDelay": "00:00:00.250",
"RetryMaxDelay": "00:01:00",
"UserAgentSuffix": "my-service/2.3.1",
"TelemetryEnabled": true,
"TraceParentPropagationEnabled": true
}
}
Timeouts bind from TimeSpan-parseable strings ("00:00:05",
"250ms"-style shorthand is not supported by the binder — use
TimeSpan syntax). Non-scalar options — Transport, Observer,
ApiKeyProvider, generators, TimeProvider, RetryEntropy — are code-only;
combine both calls and the configure action runs after binding:
services.AddRepostClient(configuration.GetSection("Repost"));
services.AddRepostClient(options => options.Observer = new MyObserver());
Both overloads register:
- the shared
RepostClientOptionssingleton, and - a
Func<RepostClientOptions>factory producing a fresh, fully configured instance per call — for consumers that tweak one client's options (a per-client observer, say) without mutating the shared instance.
Options validation stays with the runtime: an invalid value (out-of-range
MaxAttempts, a non-loopback http:// base URI) throws
RepostConfigurationException from the RepostRuntime constructor — i.e.
when the client below is resolved — not at registration time.
Registering the generated client
Generated client types live in your code, so this package cannot and does not register them. Register them yourself, as singletons (one runtime per client, disposed with the container):
services.AddSingleton(serviceProvider =>
new Acme.Repost.RepostClient(serviceProvider.GetRequiredService<RepostClientOptions>()));
Health check
RepostRuntimeHealthCheck reports the runtime's diagnostics snapshot:
Unhealthy when the runtime is disposed, Degraded when any isolation
counter moved (overload rejections, dropped observer events, observer
failures, telemetry failures), Healthy otherwise. Every detail value is a
credential-free bounded counter.
services.AddHealthChecks()
.AddRepostHealthCheck(
serviceProvider => serviceProvider
.GetRequiredService<Acme.Repost.RepostClient>().Runtime);
The registration defaults to name "repost" with tags repost and ready,
so a Kubernetes readiness probe can filter
/health/ready via HealthCheckOptions.Predicate. The runtime is resolved
once when the health-check service constructs the check, never on the probe
path; an instance overload (AddRepostHealthCheck(runtime)) exists for code
that already holds the RepostRuntime.
Drain on host shutdown
No helper is needed — the generic host already drains deterministically:
Host.StopAsyncstops hosted services, so producers quit enqueueing.Host.DisposeAsyncdisposes the container in reverse creation order: services that depend on the Repost client tear down first, then the client.IAsyncDisposablesingletons (every generated client) are disposed asynchronously.RepostRuntime.DisposeAsyncseals the runtime, terminalizes in-flight sends withRepostErrorCode.Closed, and drains the observer channel before returning.
Register the Repost client before the services that depend on it and
resolve both through the container; the ordering above then holds by
construction. This is covered by a host-level test in
tests/Repost.Client.DependencyInjection.Tests.
Target frameworks
netstandard2.0, net472, net8.0 — the runtime's full matrix. The
IConfiguration binding path uses the reflection-based configuration binder
(the standard Microsoft.Extensions.Options behavior); the configure-action
overload is reflection-free.
| 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 is compatible. 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 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. 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. |
-
.NETFramework 4.7.2
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Repost.Client (>= 1.0.8)
-
.NETStandard 2.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Repost.Client (>= 1.0.8)
-
net8.0
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Repost.Client (>= 1.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.