Table of Contents

Class MassiveServiceCollectionExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
MassiveDotNet.Extensions.DependencyInjection.dll

Registers the Massive REST client in a service collection, wired through IHttpClientFactory.

public static class MassiveServiceCollectionExtensions
Inheritance
MassiveServiceCollectionExtensions
Inherited Members

Fields

HttpClientName

The name of the HttpClient registration the SDK issues requests on. Use it to reach the same pipeline from IHttpClientFactory directly.

public const string HttpClientName = "MassiveDotNet"

Field Value

string

Methods

AddMassive(IServiceCollection, Action<MassiveClientOptions>)

Registers the Massive REST client from a full set of options.

public static IHttpClientBuilder AddMassive(this IServiceCollection services, Action<MassiveClientOptions> configure)

Parameters

services IServiceCollection

The service collection to add to.

configure Action<MassiveClientOptions>

Configures the client options.

Returns

IHttpClientBuilder

The builder for the underlying named HttpClient, so resilience, logging, or any other handler can be added to the same pipeline.

Remarks

There is deliberately no overload binding an IConfiguration section. Timeout is a NodaTime Duration, which the configuration binder cannot convert: a bound section compiles clean, raises no warning, and silently leaves the default in place. Read the values yourself instead — options.ApiKey = configuration["Massive:ApiKey"] — which is also free of reflection and so stays Native AOT clean (D27).

Calling this more than once layers an additional options delegate but builds the HTTP pipeline only on the first call, so the API key is never attached twice.

Unlike core's transport, the registered pipeline logs. The Authorization header's value is redacted unconditionally, so no consumer logging configuration can expose the key (rule 11). The default Bearer scheme keeps the key out of the request URI as well, which is the reason it is the default (D2).

Exceptions

ArgumentNullException

services or configure is null.

AddMassive(IServiceCollection, string)

Registers the Massive REST client authenticated with an API key.

public static IHttpClientBuilder AddMassive(this IServiceCollection services, string apiKey)

Parameters

services IServiceCollection

The service collection to add to.

apiKey string

The Massive API key.

Returns

IHttpClientBuilder

The builder for the underlying named HttpClient, so resilience, logging, or any other handler can be added to the same pipeline.

Exceptions

ArgumentNullException

services is null.

ArgumentException

apiKey is null or whitespace.