Soenneker.Blazor.Consumers.Base 11.0.1250

Prefix Reserved
dotnet add package Soenneker.Blazor.Consumers.Base --version 11.0.1250
                    
NuGet\Install-Package Soenneker.Blazor.Consumers.Base -Version 11.0.1250
                    
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="Soenneker.Blazor.Consumers.Base" Version="11.0.1250" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Blazor.Consumers.Base" Version="11.0.1250" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Blazor.Consumers.Base" />
                    
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 Soenneker.Blazor.Consumers.Base --version 11.0.1250
                    
#r "nuget: Soenneker.Blazor.Consumers.Base, 11.0.1250"
                    
#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 Soenneker.Blazor.Consumers.Base@11.0.1250
                    
#: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=Soenneker.Blazor.Consumers.Base&version=11.0.1250
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Consumers.Base&version=11.0.1250
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

Soenneker.Blazor.Consumers.Base

A base class that sends common API requests through IApiClient and converts JSON success or problem-details responses into OperationResult<T>.

Use this package when one consumer needs different response types per operation. If every operation uses the same response type, Soenneker.Blazor.Consumer provides the typed Consumer<TResponse> layer.

Installation

dotnet add package Soenneker.Blazor.Consumers.Base

Define and register a consumer

BaseConsumer has a protected constructor, so derive an application-specific class and choose its URI prefix:

using Microsoft.Extensions.Logging;
using Soenneker.Blazor.ApiClient.Abstract;
using Soenneker.Blazor.Consumers.Base;

public sealed class CatalogConsumer : BaseConsumer
{
    public CatalogConsumer(
        IApiClient apiClient,
        ILogger<BaseConsumer> logger,
        IConfiguration configuration)
        : base(apiClient, logger, "catalog/products")
    {
        apiClient.Initialize(
            configuration["Api:BaseUrl"]!,
            requestResponseLogging: false);
    }
}
using Soenneker.Blazor.ApiClient.Registrars;

builder.Services.AddApiClientAsScoped();
builder.Services.AddScoped<CatalogConsumer>();

Send requests

The response type is selected on each call:

OperationResult<ProductDto> product = await catalog.Get<ProductDto>(
    "42",
    cancellationToken: cancellationToken);

OperationResult<PagedResult<ProductSummaryDto>> page =
    await catalog.GetAll<ProductSummaryDto>(
        requestDataOptions,
        cancellationToken: cancellationToken);

OperationResult<ProductDto> created = await catalog.Create<ProductDto>(
    new CreateProductRequest(name, price),
    cancellationToken: cancellationToken);

Without overrideUri, single-resource GET, PUT, DELETE, and upload calls append the supplied ID directly to the configured prefix. Collection GET and POST use the prefix itself. An upload appends /{id}/upload. overrideUri replaces that entire generated relative URI.

Use a RequestOptions overload when you already have the exact URI, payload, anonymity choice, and logging flags:

OperationResult<ProductDto> result = await catalog.Post<ProductDto>(
    new RequestOptions
    {
        Uri = "catalog/products/import",
        Object = request,
        AllowAnonymous = false,
        LogResponse = true
    },
    cancellationToken);

Results and failures

Successful JSON is deserialized into result.Value; a problem-details response is exposed through result.Problem, with Succeeded, Failed, and StatusCode available for branching. Empty successful responses produce a successful result with a null value. Invalid or unexpected response JSON produces a failed result; transport, authentication, and cancellation failures may throw.

The consumer owns and disposes the underlying HttpResponseMessage after conversion.

Uploads are always authenticated. Passing allowAnonymous: true or setting RequestUploadOptions.AllowAnonymous throws NotSupportedException. Upload content uses file and optional json multipart fields, and the supplied stream is disposed after the request.

Product Compatible and additional computed target framework versions.
.NET net11.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Soenneker.Blazor.Consumers.Base:

Package Downloads
Soenneker.Blazor.Consumer

A derivative of Soenneker.Blazor.Consumer.Base, providing instance-wide generic type setting.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
11.0.1250 0 11/15/2026
11.0.1249 0 11/15/2026
11.0.1248 0 11/14/2026
11.0.1246 43 11/14/2026
11.0.1245 118 11/12/2026
11.0.1244 83 11/12/2026
11.0.1243 83 11/12/2026
11.0.1242 84 11/11/2026
11.0.1241 77 11/11/2026
11.0.1239 99 11/11/2026
11.0.1238 85 11/11/2026
11.0.1237 92 11/11/2026
11.0.1235 96 11/11/2026
11.0.1234 84 11/11/2026
11.0.1233 91 11/11/2026
11.0.1232 95 11/11/2026
11.0.1230 82 11/11/2026
11.0.1228 91 11/11/2026
11.0.1226 87 11/11/2026
11.0.1224 94 11/11/2026
Loading failed

Update dependency Soenneker.Blazor.Consumers.Core to 11.0.818 (#1781)