Soenneker.Blazor.Consumers.Base 11.0.1268

Prefix Reserved
dotnet add package Soenneker.Blazor.Consumers.Base --version 11.0.1268
                    
NuGet\Install-Package Soenneker.Blazor.Consumers.Base -Version 11.0.1268
                    
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.1268" />
                    
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.1268" />
                    
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.1268
                    
#r "nuget: Soenneker.Blazor.Consumers.Base, 11.0.1268"
                    
#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.1268
                    
#: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.1268
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Blazor.Consumers.Base&version=11.0.1268
                    
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.1268 181 11/19/2026
11.0.1267 116 11/19/2026
11.0.1266 121 11/19/2026
11.0.1265 116 11/19/2026
11.0.1262 133 11/18/2026
11.0.1261 103 11/18/2026
11.0.1260 112 11/18/2026
11.0.1259 97 11/18/2026
11.0.1258 125 11/18/2026
11.0.1257 113 11/17/2026
11.0.1256 113 11/16/2026
11.0.1255 122 11/16/2026
11.0.1254 112 11/16/2026
11.0.1253 100 11/15/2026
11.0.1252 108 11/15/2026
11.0.1251 109 11/15/2026
11.0.1250 113 11/15/2026
11.0.1249 113 11/15/2026
11.0.1248 117 11/14/2026
11.0.1246 110 11/14/2026
Loading failed

Updated Soenneker.Blazor.Consumers.Core to 11.0.833