Rystem.RepositoryFramework.Api.Client 4.1.25

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

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

What is Rystem?

Services extensions

You may add a repository client for your model. You may choose the domain (domain where the api is), and the custom path by default is "api", you may add custom configuration to the HttpClient and the service lifetime with singleton as default. The api url will be https://{domain}/{startingPath}/{ModelName}/{Type of Api (from Insert, Update, Delete, Batch, Get, Query, Exist, Operation)}

public static IRepositoryBuilder<T, TKey> AddRepositoryApiClient<T, TKey>(this IServiceCollection services,
    ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
    where TKey : notnull

You have the same client for CQRS, with command

 public static IRepositoryBuilder<T, TKey> AddCommandApiClient<T, TKey>(this IServiceCollection services,
    ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
    where TKey : notnull

and query

  public static IRepositoryBuilder<T, TKey> AddQueryApiClient<T, TKey>(this IServiceCollection services,
    ServiceLifetime serviceLifetime = ServiceLifetime.Scoped)
    where TKey : notnull

HttpClient to use your API (example)

You can add a client for a specific url

builder.Services.AddRepository<User, string>(settings =>
{
    settings
        .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>(settings =>
{
    settings
        .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>(settings => {
    settings
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});
services.AddQuery<User, string>(settings => {
    settings
        .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>(settings => {
    settings
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});
services.AddCommand<User, bool>(settings => {
    settings
        .WithApiClient()
        .WithHttpClient("localhost:7058");
});
services.AddQuery<User, bool>(settings => {
    settings
        .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(settings => {
    settings
        .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 54,073 11/16/2024
9.0.0-rc.1 80 10/18/2024
6.2.0 219,001 10/9/2024
6.1.1 121 10/9/2024
6.1.0 47,910 9/29/2024
6.0.24 150 9/11/2024
6.0.23 340,116 7/18/2024
6.0.21 141 6/18/2024
6.0.20 727,747 6/16/2024
6.0.19 30,381 6/14/2024
6.0.18 128 6/14/2024
6.0.17 131 6/14/2024
6.0.16 49,971 6/10/2024
6.0.15 132 6/9/2024
6.0.14 94,266 5/24/2024
6.0.13 145 5/23/2024
6.0.12 121 5/23/2024
6.0.11 150 5/20/2024
6.0.9 155 5/20/2024
6.0.7 138 5/18/2024
6.0.6 111 5/10/2024
6.0.5 114 5/10/2024
6.0.4 549,778 4/3/2024
6.0.3 166 3/25/2024
6.0.2 393,451 3/11/2024
6.0.0 1,170,075 11/21/2023
6.0.0-rc.6 118 10/25/2023
6.0.0-rc.5 89 10/25/2023
6.0.0-rc.4 74 10/23/2023
6.0.0-rc.3 74 10/19/2023
6.0.0-rc.2 84 10/18/2023
6.0.0-rc.1 76 10/16/2023
5.0.20 638,701 9/25/2023
5.0.19 338 9/10/2023
5.0.18 298 9/6/2023
5.0.17 251 9/6/2023
5.0.16 266 9/5/2023
5.0.15 246 9/5/2023
5.0.14 247 9/5/2023
5.0.13 265 9/1/2023
5.0.12 246 8/31/2023
5.0.11 228 8/30/2023
5.0.10 256 8/29/2023
5.0.9 288 8/24/2023
5.0.8 278 8/24/2023
5.0.7 449,734 8/23/2023
5.0.6 17,579 8/21/2023
5.0.5 4,368 8/21/2023
5.0.4 201 8/16/2023
5.0.3 212,497 8/2/2023
5.0.2 1,787 8/2/2023
5.0.1 11,588 8/1/2023
5.0.0 11,872 7/31/2023
4.1.26 140,707 7/20/2023
4.1.25 24,673 7/16/2023
4.1.24 397,856 6/13/2023
4.1.23 45,722 6/13/2023
4.1.22 129,105 5/30/2023
4.1.21 55,462 5/20/2023
4.1.20 404,599 4/19/2023
4.1.19 95,315 3/20/2023
4.1.18 298 3/20/2023
4.1.17 301 3/16/2023
4.1.16 285 3/16/2023
4.1.15 292 3/15/2023
4.1.14 875 3/9/2023
4.1.13 309 3/7/2023
4.1.12 388 2/10/2023
4.1.11 360 1/26/2023
4.1.10 373 1/22/2023
4.1.9 348 1/20/2023
4.1.8 387 1/18/2023
4.1.7 498 1/18/2023
4.1.6 352 1/17/2023
4.1.1 375 1/4/2023
4.1.0 358 1/1/2023
3.1.5 358 12/21/2022
3.1.3 393 12/12/2022
3.1.2 345 12/7/2022
3.1.1 361 12/7/2022
3.1.0 418 12/2/2022
3.0.29 397 12/1/2022
3.0.28 393 12/1/2022
3.0.27 584 11/23/2022
3.0.25 390 11/23/2022
3.0.24 434 11/18/2022
3.0.23 402 11/18/2022
3.0.22 429 11/15/2022
3.0.21 420 11/14/2022
3.0.20 435 11/13/2022
3.0.19 604 11/2/2022
3.0.18 456 11/2/2022
3.0.17 450 10/29/2022
3.0.16 476 10/29/2022
3.0.15 456 10/29/2022
3.0.14 491 10/24/2022
3.0.13 468 10/24/2022
3.0.12 545 10/17/2022
3.0.11 501 10/10/2022
3.0.10 512 10/6/2022
3.0.9 469 10/6/2022
3.0.8 449 10/6/2022
3.0.7 482 10/6/2022
3.0.6 476 10/5/2022
3.0.5 464 10/5/2022
3.0.4 486 10/5/2022
3.0.3 530 10/3/2022
3.0.2 491 9/30/2022
3.0.1 477 9/29/2022
2.0.17 508 9/29/2022
2.0.16 493 9/27/2022
2.0.15 557 9/27/2022
2.0.14 572 9/26/2022
2.0.13 562 9/26/2022
2.0.12 520 9/26/2022
2.0.11 513 9/25/2022
2.0.10 542 9/25/2022
2.0.9 521 9/22/2022
2.0.8 506 9/22/2022
2.0.6 524 9/20/2022
2.0.5 543 9/20/2022
2.0.4 517 9/20/2022
2.0.2 492 9/20/2022
2.0.1 549 9/13/2022
2.0.0 508 8/19/2022
1.1.24 536 7/30/2022
1.1.23 526 7/29/2022
1.1.22 532 7/29/2022
1.1.21 791 7/29/2022
1.1.20 541 7/29/2022
1.1.19 569 7/27/2022
1.1.17 537 7/27/2022
1.1.16 558 7/26/2022
1.1.15 529 7/25/2022
1.1.14 567 7/25/2022
1.1.13 544 7/22/2022
1.1.12 535 7/19/2022
1.1.11 521 7/19/2022
1.1.10 526 7/19/2022
1.1.9 566 7/19/2022
1.1.8 558 7/18/2022
1.1.7 574 7/18/2022
1.1.6 515 7/18/2022
1.1.5 516 7/17/2022
1.1.4 552 7/17/2022
1.1.3 559 7/17/2022
1.1.2 558 7/17/2022
1.1.0 541 7/17/2022
1.0.2 527 7/15/2022
1.0.1 539 7/15/2022
1.0.0 535 7/8/2022
0.10.7 537 7/7/2022
0.10.2 574 7/2/2022
0.10.1 539 7/1/2022
0.10.0 558 7/1/2022
0.9.12 573 6/29/2022
0.9.11 594 6/21/2022
0.9.10 538 6/20/2022
0.9.9 515 6/11/2022
0.9.7 522 6/9/2022
0.9.6 521 6/5/2022
0.9.5 499 6/3/2022
0.9.3 490 6/3/2022
0.9.2 522 5/31/2022
0.9.1 543 5/31/2022
0.9.0 512 5/31/2022