Dosaic.Extensions.RestEase
1.2.4
See the version list below for details.
dotnet add package Dosaic.Extensions.RestEase --version 1.2.4
NuGet\Install-Package Dosaic.Extensions.RestEase -Version 1.2.4
<PackageReference Include="Dosaic.Extensions.RestEase" Version="1.2.4" />
<PackageVersion Include="Dosaic.Extensions.RestEase" Version="1.2.4" />
<PackageReference Include="Dosaic.Extensions.RestEase" />
paket add Dosaic.Extensions.RestEase --version 1.2.4
#r "nuget: Dosaic.Extensions.RestEase, 1.2.4"
#:package Dosaic.Extensions.RestEase@1.2.4
#addin nuget:?package=Dosaic.Extensions.RestEase&version=1.2.4
#tool nuget:?package=Dosaic.Extensions.RestEase&version=1.2.4
Dosaic.Extensions.RestEase
Dosaic.Extensions.RestEase is an extension library that simplifies HTTP API client creation using RestEase with built-in authentication and retry policies.
Installation
To install the nuget package follow these steps:
dotnet add package Dosaic.Extensions.RestEase
or add as package reference to your .csproj
<PackageReference Include="Dosaic.Extensions.RestEase" Version="" />
Usage
The extension provides a factory for creating typed API clients with minimal configuration.
Basic Client Creation
Create a simple API client interface:
using RestEase;
public interface IMyApi
{
[Get("users/{userId}")]
Task<User> GetUserAsync([Path] string userId);
[Post("users")]
Task<User> CreateUserAsync([Body] User user);
}
Then create a client instance:
using Dosaic.Extensions.RestEase;
IMyApi apiClient = RestClientFactory.Create<IMyApi>("https://api.example.com");
User user = await apiClient.GetUserAsync("123");
Authentication Support
Create a client with OAuth2 authentication:
using Dosaic.Extensions.RestEase;
using Dosaic.Extensions.RestEase.Authentication;
var authConfig = new AuthenticationConfig
{
Enabled = true,
BaseUrl = "https://auth.example.com",
TokenUrlPath = "oauth/token",
GrantType = GrantType.ClientCredentials,
ClientId = "myclientid",
ClientSecret = "myclientsecret"
};
IMyApi apiClient = RestClientFactory.Create<IMyApi>("https://api.example.com", authConfig);
Custom Retry Policy
You can specify a custom Polly retry policy:
using Dosaic.Extensions.RestEase;
using Polly;
using System.Net.Http;
var retryPolicy = Policy
.HandleResult<HttpResponseMessage>(r => !r.IsSuccessStatusCode)
.WaitAndRetryAsync(3, retry => TimeSpan.FromSeconds(Math.Pow(2, retry)));
IMyApi apiClient = RestClientFactory.Create<IMyApi>("https://api.example.com", retryPolicy);
Advanced Configuration
For complete customization, use all parameters:
using Dosaic.Extensions.RestEase;
using Dosaic.Extensions.RestEase.Authentication;
using Newtonsoft.Json;
using Polly;
var authConfig = new AuthenticationConfig
{
Enabled = true,
BaseUrl = "https://auth.example.com",
TokenUrlPath = "oauth/token",
GrantType = GrantType.Password,
Username = "myusername",
Password = "mypassword"
};
var retryPolicy = Policy
.HandleResult<HttpResponseMessage>(r => (int)r.StatusCode >= 500)
.RetryAsync(3);
var jsonSettings = new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
IMyApi apiClient = RestClientFactory.Create<IMyApi>(
"https://api.example.com",
authConfig,
retryPolicy,
jsonSettings
);
Authentication Types
The extension supports these OAuth2 grant types:
- Password - username and password authentication
- ClientCredentials - client ID and secret authentication
- Code - authorization code flow
// Password grant
var passwordAuth = new AuthenticationConfig
{
Enabled = true,
GrantType = GrantType.Password,
Username = "user",
Password = "pass"
};
// Client credentials
var clientAuth = new AuthenticationConfig
{
Enabled = true,
GrantType = GrantType.ClientCredentials,
ClientId = "client123",
ClientSecret = "secret456"
};
Default Behavior
By default, the extension uses:
- JSON serialization with string enum conversion
- A retry policy that retries 2 times for HTTP 5xx errors
- Automatic token refresh for authenticated requests
| Product | Versions 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. |
-
net10.0
- Microsoft.Extensions.Http.Polly (>= 10.0.2)
- RestEase (>= 1.6.4)
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 |
|---|---|---|
| 1.2.9 | 39 | 3/13/2026 |
| 1.2.8 | 88 | 3/9/2026 |
| 1.2.7 | 84 | 3/4/2026 |
| 1.2.6 | 110 | 2/19/2026 |
| 1.2.5 | 84 | 2/17/2026 |
| 1.2.4 | 120 | 2/13/2026 |
| 1.2.3 | 105 | 1/27/2026 |
| 1.2.2 | 298 | 12/16/2025 |
| 1.2.1 | 280 | 12/16/2025 |
| 1.2.0 | 438 | 12/11/2025 |
| 1.1.21 | 462 | 12/10/2025 |
| 1.1.20 | 423 | 11/18/2025 |
| 1.1.19 | 310 | 11/11/2025 |
| 1.1.18 | 214 | 10/14/2025 |
| 1.1.17 | 205 | 10/1/2025 |
| 1.1.16 | 207 | 9/25/2025 |
| 1.1.15 | 206 | 9/24/2025 |
| 1.1.14 | 204 | 9/24/2025 |
| 1.1.13 | 221 | 9/24/2025 |
| 1.1.12 | 333 | 9/16/2025 |