Rystem.RepositoryFramework.Api.Client 5.0.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.RepositoryFramework.Api.Client --version 5.0.5                
NuGet\Install-Package Rystem.RepositoryFramework.Api.Client -Version 5.0.5                
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="Rystem.RepositoryFramework.Api.Client" Version="5.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rystem.RepositoryFramework.Api.Client --version 5.0.5                
#r "nuget: Rystem.RepositoryFramework.Api.Client, 5.0.5"                
#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.
// Install Rystem.RepositoryFramework.Api.Client as a Cake Addin
#addin nuget:?package=Rystem.RepositoryFramework.Api.Client&version=5.0.5

// Install Rystem.RepositoryFramework.Api.Client as a Cake Tool
#tool nuget:?package=Rystem.RepositoryFramework.Api.Client&version=5.0.5                

What is Rystem?

Services extensions

HttpClient to use your API (example)

You can add a client for a specific url

builder.Services.AddRepository<User, string>(builder =>
{
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});

You may add a Polly policy to your api client for example:

var retryPolicy = HttpPolicyExtensions
  .HandleTransientHttpError()
  .Or<TimeoutRejectedException>()
  .RetryAsync(3);

builder.Services.AddRepository<User, string>(builder =>
{
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058")
            .ClientBuilder
        .AddPolicyHandler(retryPolicy);
});

and use it in DI with

IRepository<User, string> repository

Query and Command

In DI you install the services

services.AddCommand<User, string>(builder => {
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});
services.AddQuery<User, string>(builder => {
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});

And you may inject the objects

Please, use ICommand, IQuery and not ICommandPattern, IQueryPattern

ICommand<User, string> command
IQuery<User, string> command

With a non default key

In DI you install the services with a bool key for example.

services.AddRepository<User, bool>(builder => {
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});
services.AddCommand<User, bool>(builder => {
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});
services.AddQuery<User, bool>(builder => {
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});

And you may inject the objects

Please, use ICommand, IQuery, IRepository and not ICommandPattern, IQueryPattern, IRepositoryPattern

IRepository<User, string> repository
ICommand<User, string> command
IQuery<User, string> command

Interceptors

You may add a custom interceptor for every request for every model

public static IServiceCollection AddApiClientInterceptor<TInterceptor>(this IServiceCollection services,
    ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
    where TInterceptor : class, IRepositoryClientInterceptor

or a specific interceptor for each model

public static IServiceCollection AddApiClientInterceptor<TInterceptor>(this IServiceCollection services,
    ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
    where TInterceptor : class, IRepositoryClientInterceptor

or for a string as default TKey

 public static RepositorySettings<T, TKey> AddApiClientSpecificInterceptor<T, TKey, TInterceptor>(
    this RepositorySettings<T, TKey> settings,
    ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
    where TInterceptor : class, IRepositoryClientInterceptor<T>
    where TKey : notnull   

Maybe you can use it to add a token as JWT o another pre-request things.

Default interceptor for Authentication with JWT

You may use the default interceptor to deal with the identity manager in .Net DI.

builder.Services.AddDefaultAuthorizationInterceptorForApiHttpClient();

This line of code inject an interceptor that works with ITokenAcquisition, injected by the framework during OpenId integration (for example AAD integration). Automatically it adds the token to each request.

You may use the default identity interceptor not on all repositories, you can specificy them with

builder.Services.AddRepository(builder => {
    builder
        .WithApiClient()
        .WithHttpClient("localhost:7058")
        .AddCustomAuthorizationInterceptorForApiHttpClient<T, TKey>();
});
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Rystem.RepositoryFramework.Api.Client:

Package Downloads
Rystem.RepositoryFramework.Api.Client.Authentication.BlazorServer

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

Rystem.RepositoryFramework.Api.Client.Authentication.BlazorWasm

Rystem.RepositoryFramework allows you to use correctly concepts like repository pattern, CQRS and DDD. You have interfaces for your domains, auto-generated api, auto-generated HttpClient to simplify connection "api to front-end", a functionality for auto-population in memory of your models, a functionality to simulate exceptions and waiting time from external sources to improve your implementation/business test and load test.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.0 40 11/16/2024
9.0.0-rc.1 76 10/18/2024
6.2.0 218,986 10/9/2024
6.1.1 113 10/9/2024
6.1.0 47,906 9/29/2024
6.0.24 145 9/11/2024
6.0.23 340,111 7/18/2024
6.0.21 136 6/18/2024
6.0.20 727,742 6/16/2024
6.0.19 30,376 6/14/2024
6.0.18 123 6/14/2024
6.0.17 126 6/14/2024
6.0.16 49,965 6/10/2024
6.0.15 127 6/9/2024
6.0.14 94,261 5/24/2024
6.0.13 140 5/23/2024
6.0.12 116 5/23/2024
6.0.11 145 5/20/2024
6.0.9 150 5/20/2024
6.0.7 133 5/18/2024
6.0.6 106 5/10/2024
6.0.5 109 5/10/2024
6.0.4 549,771 4/3/2024
6.0.3 161 3/25/2024
6.0.2 393,446 3/11/2024
6.0.0 1,170,069 11/21/2023
6.0.0-rc.6 114 10/25/2023
6.0.0-rc.5 86 10/25/2023
6.0.0-rc.4 71 10/23/2023
6.0.0-rc.3 71 10/19/2023
6.0.0-rc.2 81 10/18/2023
6.0.0-rc.1 73 10/16/2023
5.0.20 638,696 9/25/2023
5.0.19 333 9/10/2023
5.0.18 293 9/6/2023
5.0.17 246 9/6/2023
5.0.16 261 9/5/2023
5.0.15 241 9/5/2023
5.0.14 240 9/5/2023
5.0.13 260 9/1/2023
5.0.12 239 8/31/2023
5.0.11 223 8/30/2023
5.0.10 251 8/29/2023
5.0.9 282 8/24/2023
5.0.8 273 8/24/2023
5.0.7 449,729 8/23/2023
5.0.6 17,574 8/21/2023
5.0.5 4,363 8/21/2023
5.0.4 195 8/16/2023
5.0.3 212,492 8/2/2023
5.0.2 1,782 8/2/2023
5.0.1 11,583 8/1/2023
5.0.0 11,867 7/31/2023
4.1.26 140,702 7/20/2023
4.1.25 24,668 7/16/2023
4.1.24 397,851 6/13/2023
4.1.23 45,717 6/13/2023
4.1.22 129,100 5/30/2023
4.1.21 55,457 5/20/2023
4.1.20 404,592 4/19/2023
4.1.19 95,310 3/20/2023
4.1.18 293 3/20/2023
4.1.17 296 3/16/2023
4.1.16 280 3/16/2023
4.1.15 287 3/15/2023
4.1.14 870 3/9/2023
4.1.13 304 3/7/2023
4.1.12 383 2/10/2023
4.1.11 355 1/26/2023
4.1.10 368 1/22/2023
4.1.9 343 1/20/2023
4.1.8 382 1/18/2023
4.1.7 492 1/18/2023
4.1.6 347 1/17/2023
4.1.1 370 1/4/2023
4.1.0 353 1/1/2023
3.1.5 353 12/21/2022
3.1.3 388 12/12/2022
3.1.2 340 12/7/2022
3.1.1 356 12/7/2022
3.1.0 413 12/2/2022
3.0.29 392 12/1/2022
3.0.28 388 12/1/2022
3.0.27 579 11/23/2022
3.0.25 384 11/23/2022
3.0.24 429 11/18/2022
3.0.23 397 11/18/2022
3.0.22 424 11/15/2022
3.0.21 415 11/14/2022
3.0.20 430 11/13/2022
3.0.19 599 11/2/2022
3.0.18 451 11/2/2022
3.0.17 445 10/29/2022
3.0.16 471 10/29/2022
3.0.15 451 10/29/2022
3.0.14 486 10/24/2022
3.0.13 463 10/24/2022
3.0.12 540 10/17/2022
3.0.11 496 10/10/2022
3.0.10 507 10/6/2022
3.0.9 464 10/6/2022
3.0.8 444 10/6/2022
3.0.7 477 10/6/2022
3.0.6 471 10/5/2022
3.0.5 459 10/5/2022
3.0.4 481 10/5/2022
3.0.3 525 10/3/2022
3.0.2 486 9/30/2022
3.0.1 472 9/29/2022
2.0.17 503 9/29/2022
2.0.16 488 9/27/2022
2.0.15 552 9/27/2022
2.0.14 567 9/26/2022
2.0.13 557 9/26/2022
2.0.12 515 9/26/2022
2.0.11 508 9/25/2022
2.0.10 537 9/25/2022
2.0.9 516 9/22/2022
2.0.8 501 9/22/2022
2.0.6 519 9/20/2022
2.0.5 538 9/20/2022
2.0.4 512 9/20/2022
2.0.2 487 9/20/2022
2.0.1 544 9/13/2022
2.0.0 500 8/19/2022
1.1.24 531 7/30/2022
1.1.23 521 7/29/2022
1.1.22 527 7/29/2022
1.1.21 783 7/29/2022
1.1.20 536 7/29/2022
1.1.19 564 7/27/2022
1.1.17 532 7/27/2022
1.1.16 553 7/26/2022
1.1.15 524 7/25/2022
1.1.14 560 7/25/2022
1.1.13 539 7/22/2022
1.1.12 528 7/19/2022
1.1.11 516 7/19/2022
1.1.10 521 7/19/2022
1.1.9 559 7/19/2022
1.1.8 551 7/18/2022
1.1.7 569 7/18/2022
1.1.6 510 7/18/2022
1.1.5 511 7/17/2022
1.1.4 547 7/17/2022
1.1.3 554 7/17/2022
1.1.2 553 7/17/2022
1.1.0 536 7/17/2022
1.0.2 522 7/15/2022
1.0.1 532 7/15/2022
1.0.0 530 7/8/2022
0.10.7 532 7/7/2022
0.10.2 569 7/2/2022
0.10.1 534 7/1/2022
0.10.0 553 7/1/2022
0.9.12 566 6/29/2022
0.9.11 589 6/21/2022
0.9.10 533 6/20/2022
0.9.9 510 6/11/2022
0.9.7 516 6/9/2022
0.9.6 515 6/5/2022
0.9.5 494 6/3/2022
0.9.3 483 6/3/2022
0.9.2 517 5/31/2022
0.9.1 538 5/31/2022
0.9.0 507 5/31/2022