BitzArt.Flux.Rest 0.5.0-Prerelease

Prefix Reserved
This is a prerelease version of BitzArt.Flux.Rest.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package BitzArt.Flux.Rest --version 0.5.0-Prerelease
                    
NuGet\Install-Package BitzArt.Flux.Rest -Version 0.5.0-Prerelease
                    
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="BitzArt.Flux.Rest" Version="0.5.0-Prerelease" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BitzArt.Flux.Rest" Version="0.5.0-Prerelease" />
                    
Directory.Packages.props
<PackageReference Include="BitzArt.Flux.Rest" />
                    
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 BitzArt.Flux.Rest --version 0.5.0-Prerelease
                    
#r "nuget: BitzArt.Flux.Rest, 0.5.0-Prerelease"
                    
#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 BitzArt.Flux.Rest@0.5.0-Prerelease
                    
#: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=BitzArt.Flux.Rest&version=0.5.0-Prerelease&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=BitzArt.Flux.Rest&version=0.5.0-Prerelease&prerelease
                    
Install as a Cake Tool

Flux.REST

Installation

To use a REST client in your project, add the nuget package (The package is currently prerelease)

dotnet add package BitzArt.Flux.REST --prerelease

Usage

Configure Flux

services.AddFlux(flux =>
{
    flux.AddService("service1")     // Give your external service a specific name
    .UsingRest("https://test.com")  // External service's base url
    .AddSet<YourModel>()            // Adds a Set for a specific model
        .WithEndpoint("model");     // Set endpoint : https://test.com/model
});

Use IFluxContext in your app

  1. Resolve IFluxContext from your DI container
serviceProvider.GetRequiredService<IFluxContext>();
  1. Get your set context
// Resolve the Set directly
var setContext = fluxContext.Set<YourModel>();

// Or specify the external service
var setContext = fluxContext.Service("service1").Set<YourModel>();

ℹ️ Selecting a specific service can be useful in situations where you have multiple external services configured with the same model types.

  1. Use the SetContext to interact with this Set:
var model = await setContext.GetAsync(1); // Will make an http request to https://test.com/model/1

var list = await setContext.GetAllAsync(); // Will make an http request to https://test.com/model

var page = await setContext.GetPageAsync(0, 10); // Will make an http request to https://test.com/model?offset=0&limit=10

Advanced scenarios

Configuring endpoints

WithEndpoint("your-set-endpoint") // Configures the REST endpoint, e.g. https://test.com/your-set-endpoint
WithIdEndpoint((key) => $"something/{key}") // Configures the ID endpoint, e.g. https://test.com/something/1
WithPageEndpoint("your-page-endpoint") // Configures the Page endpoint, e.g. https://test.com/your-page-endpoint

Custom variables

You can add custom variables to your endpoint configurations:

services.AddFlux(flux =>
{
    flux.AddService("service1")
    .UsingRest("https://test.com")
    .AddSet<YourModel>()
        .WithEndpoint("{a}/{b}");
});

Provide variable values when calling an appropriate method:

var a = "first";
var b = "second";
var result = await setContext.GetAsync(1, a, b); // Will make an http request to https://test.com/first/second/1

Custom Page endpoint with parent id example:

Flux configuration:

services.AddFlux(flux =>
{
    flux.AddService("service1")
    .UsingRest("https://test.com")
    .AddSet<Book>()
        .WithPageEndpoint("authors/{authorId}/books");
});

Usage:

var books = fluxContext.Set<Book>();

var authorId = 15;
var booksPage = await books.GetPage(0, 10, authorId); // https://test.com/authors/15/books?offset=0&limit=10
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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
0.13.2-v1.0rc6 73 5/20/2026
0.13.2-v1.0rc5 54 5/20/2026
0.13.2-v1.0rc4 58 5/20/2026
0.13.2-v1.0rc3 55 5/20/2026
0.13.2-v1.0rc2 47 5/20/2026
0.13.2-v1.0rc1 526 12/22/2025
0.13.1-v1.0rc8 545 11/25/2025
0.13.1-v1.0rc7 189 11/5/2025
0.13.1-v1.0rc6 184 10/28/2025
0.13.1-v1.0rc5 175 10/28/2025
0.13.1-v1.0rc4 168 10/28/2025
0.13.1-v1.0rc3 533 9/11/2025
0.13.1-v1.0rc2 1,559 6/10/2025
0.13.1-v1.0rc1 294 6/9/2025
0.13.0-v1.0rc9 164 6/2/2025
0.13.0-v1.0rc13 278 6/9/2025
0.13.0-v1.0rc12 219 6/8/2025
0.13.0-v1.0rc11 192 6/5/2025
0.13.0-v1.0rc10 165 6/5/2025
0.5.0-Prerelease 136 10/2/2023
Loading failed