Table of Contents

Interface IBatchAddressValidationService<TRequest>

Namespace
Visus.AddressValidation.Services
Assembly
Visus.AddressValidation.dll

Opt-in abstraction for an IAddressValidationService<TRequest> whose provider API natively supports batches of addresses in a single call.

public interface IBatchAddressValidationService<in TRequest> where TRequest : AbstractAddressValidationRequest

Type Parameters

TRequest

The type of the validation request. Must derive from AbstractAddressValidationRequest.

Methods

ValidateManyAsync(IReadOnlyList<TRequest>, CancellationToken)

Validates the specified requests asynchronously as a single batch call.

Task<IReadOnlyList<IAddressValidationResponse?>> ValidateManyAsync(IReadOnlyList<in TRequest> requests, CancellationToken cancellationToken = default)

Parameters

requests IReadOnlyList<TRequest>

The addresses to validate, listed in the order the response must preserve.

cancellationToken CancellationToken

A token that cancels the operation.

Returns

Task<IReadOnlyList<IAddressValidationResponse>>

A task that returns a list of IAddressValidationResponse (or null) items, positionally aligned with requests.

Remarks

The returned list has the same length and order as requests. An entry is an EmptyAddressValidationResponse when the corresponding request fails local validation, or when the provider cannot resolve that address. An entry is null only when the batch API call produces no response at all. This matches the "no response" semantics of ValidateAsync(TRequest, CancellationToken). A null entry can only occur at a position that held a locally-valid request.

Exceptions

ArgumentNullException

Thrown when requests is null.

ArgumentException

Thrown synchronously when requests contains more items than the provider's maximum supported batch size.

InvalidImplementationException

Thrown when the registered batch response validator returns a different number of results than the number of items sent to the provider.