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
                    
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="Repost.Client.DependencyInjection" Version="1.0.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Repost.Client.DependencyInjection" Version="1.0.8" />
                    
Directory.Packages.props
<PackageReference Include="Repost.Client.DependencyInjection" />
                    
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 Repost.Client.DependencyInjection --version 1.0.8
                    
#r "nuget: Repost.Client.DependencyInjection, 1.0.8"
                    
#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 Repost.Client.DependencyInjection@1.0.8
                    
#: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=Repost.Client.DependencyInjection&version=1.0.8
                    
Install as a Cake Addin
#tool nuget:?package=Repost.Client.DependencyInjection&version=1.0.8
                    
Install as a Cake Tool

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 RepostClientOptions singleton, 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:

  1. Host.StopAsync stops hosted services, so producers quit enqueueing.
  2. Host.DisposeAsync disposes the container in reverse creation order: services that depend on the Repost client tear down first, then the client. IAsyncDisposable singletons (every generated client) are disposed asynchronously.
  3. RepostRuntime.DisposeAsync seals the runtime, terminalizes in-flight sends with RepostErrorCode.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 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. 
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.8 151 8/12/2026
1.0.6 102 8/12/2026