Mvp.Selections.Client 5.0.0

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

Sitecore MVP Selections API Client

▶️ Usage

Provide the configuration through an environment variable such as MvpSelectionsApiClient__BaseAddress: ${MVP_SELECTIONS_API} or by adding it into the local.settings.json.

Create a TokenProvider:

namespace Example.Providers
{
    public class HttpContextTokenProvider : ITokenProvider
    {
        private readonly IHttpContextAccessor _httpContextAccessor;

        public HttpContextTokenProvider(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }

        public async Task<string> GetTokenAsync()
        {
            string result = string.Empty;
            HttpContext context = _httpContextAccessor.HttpContext;
            if (context != null)
            {
                result = await context.GetTokenAsync("id_token");
            }

            return result;
        }
    }
}

Register the client and your tokenprovider on Startup:

using Example.Providers;
using Microsoft.Extensions.DependencyInjection;
using Mvp.Selections.Client.Extensions;
using Mvp.Selections.Client.Interfaces;

public void ConfigureServices(IServiceCollection services)
{
    services.AddScoped<ITokenProvider, HttpContextTokenProvider>();
    services.AddMvpSelectionsApiClient();
}

Using the client:

namespace Example.ViewComponents
{
    public class ExampleViewComponent : ViewComponent
    {
        private readonly MvpSelectionsApiClient _client;

        protected BaseViewComponent(MvpSelectionsApiClient client)
        {
            _client = client;
        }

        public override async Task<IViewComponentResult> InvokeAsync()
        {
            // This example tries to fetch the list of all users
            IViewComponentResult result;
            Response<IList<User>> usersResponse = await _client.GetUsersAsync(model.Page, model.PageSize);
            if (usersResponse.StatusCode == HttpStatusCode.OK && usersResponse.Result != null)
            {
                result = View(usersResponse.Result);
            }
            else
            {
                result = View();
            }

            return result;
        }
    }
}

🔨 Build

Package as a Nuget by running

dotnet pack -c Release -p:NuspecFile=Mvp.Selections.Client.nuspec

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
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
5.0.0 97 8/28/2026
4.25.2 346 2/12/2026
4.24.0 524 11/19/2025
4.22.0 620 4/15/2025
4.21.1 334 3/9/2025
4.21.0 295 3/9/2025
4.20.0 226 2/10/2025
4.19.0 333 1/26/2025
4.18.0 267 1/2/2025
4.17.0 244 12/9/2024
4.16.0 283 11/28/2024
4.14.0 435 6/27/2024
4.13.1 871 3/7/2024
4.12.1 731 2/12/2024
4.12.0 229 2/12/2024
4.10.1 713 12/4/2023
4.9.0 297 11/27/2023
4.8.0 200 11/27/2023
4.7.2 209 11/21/2023
4.7.0 181 11/21/2023
Loading failed

+ Upgraded to .NET 10.0