Remora.Rest
3.4.0
Prefix Reserved
dotnet add package Remora.Rest --version 3.4.0
NuGet\Install-Package Remora.Rest -Version 3.4.0
<PackageReference Include="Remora.Rest" Version="3.4.0" />
paket add Remora.Rest --version 3.4.0
#r "nuget: Remora.Rest, 3.4.0"
// Install Remora.Rest as a Cake Addin #addin nuget:?package=Remora.Rest&version=3.4.0 // Install Remora.Rest as a Cake Tool #tool nuget:?package=Remora.Rest&version=3.4.0
Remora.Rest
Remora.Rest is a compact helper library for building REST API wrappers, giving you the tools you need to rapidly create robust, highly configurable wrappers of your own.
The library is somewhat opinionated, and it does target a single subset of REST API types - those whose payloads (error or otherwise) are JSON-serialized. For these use cases, however, the library is quite adept at what it does.
Quickstart
At its core, the library expects you to do two things - one, to access the REST
endpoints through a configured RestHttpClient<TError>
, and two, to define the
entities in the API model through an interface/implementation combination.
var services = new ServiceCollection();
var clientBuilder = services
.AddRestHttpClient<RestHttpClient<ErrorPayloadType>>();
// Perform HttpClient configuration (adding Polly policies, setting default
// request headers, etc)
clientBuilder...
// Configure API model types
services.Configure<JsonSerializerOptions>(clientBuilder.Name, options =>
{
options.AddDataObjectConverter<IModelType, ModelType>();
});
After you've set up your client and your types, you can then inject an instance
of RestHttpClient<TError>
into your actual API wrapper type (the instance is
transient, so you can treat it the same as any HttpClient you'd normally
inject).
public class MyWrapper
{
private readonly RestHttpClient<ErrorPayloadType> _restClient;
public MyWrapper(RestHttpClient<ErrorPayloadType> restClient)
{
_restClient = restClient;
}
}
More detailed documentation will hopefully be available in the future; in the meantime, check out Remora.Discord, for which this project was originally developed - it pushes all available functionality to its limits, and serves as a relatively comprehensive demonstration of what you can do with the library.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. 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 is compatible. 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. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- JsonDocumentPath (>= 1.0.3)
- Microsoft.Extensions.Http (>= 8.0.0)
- OneOf (>= 3.0.263)
- Remora.Rest.Core (>= 2.2.1)
- Remora.Results (>= 7.4.1)
- System.Text.Json (>= 8.0.3)
-
net6.0
- JsonDocumentPath (>= 1.0.3)
- Microsoft.Extensions.Http (>= 8.0.0)
- OneOf (>= 3.0.263)
- Remora.Rest.Core (>= 2.2.1)
- Remora.Results (>= 7.4.1)
- System.Text.Json (>= 8.0.3)
-
net7.0
- JsonDocumentPath (>= 1.0.3)
- Microsoft.Extensions.Http (>= 8.0.0)
- OneOf (>= 3.0.263)
- Remora.Rest.Core (>= 2.2.1)
- Remora.Results (>= 7.4.1)
- System.Text.Json (>= 8.0.3)
-
net8.0
- JsonDocumentPath (>= 1.0.3)
- Microsoft.Extensions.Http (>= 8.0.0)
- OneOf (>= 3.0.263)
- Remora.Rest.Core (>= 2.2.1)
- Remora.Results (>= 7.4.1)
- System.Text.Json (>= 8.0.3)
NuGet packages (5)
Showing the top 5 NuGet packages that depend on Remora.Rest:
Package | Downloads |
---|---|
Remora.Discord.API
Remora.Discord's implementation of Discord's API objects |
|
MyAnimeList.Net.Rest
Package Description |
|
MyAnimeList.Net.API.Abstractions
Package Description |
|
Remora.OAuth2
Remora.OAuth2's implementation of OAuth2's API objects |
|
XkcdSharp
A C# wrapper for easy interacting with https://xkcd.com/ |
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on Remora.Rest:
Repository | Stars |
---|---|
Remora/Remora.Discord
A data-oriented C# Discord library, focused on high-performance concurrency and robust design.
|
Version | Downloads | Last updated |
---|---|---|
3.4.0 | 28,893 | 3/31/2024 |
3.3.2 | 25,610 | 11/20/2023 |
3.3.1 | 46,916 | 11/14/2023 |
3.3.0 | 317 | 9/10/2023 |
3.2.1 | 32,706 | 7/14/2023 |
3.2.0 | 272 | 5/22/2023 |
3.1.3 | 22,170 | 2/26/2023 |
3.1.2 | 9,517 | 12/28/2022 |
3.1.1 | 6,472 | 11/20/2022 |
3.1.0 | 5,065 | 10/14/2022 |
3.0.1 | 21,643 | 8/26/2022 |
3.0.0 | 409 | 8/25/2022 |
2.0.6 | 5,197 | 8/19/2022 |
2.0.5 | 438 | 8/3/2022 |
2.0.4 | 36,194 | 6/19/2022 |
2.0.3 | 4,860 | 6/18/2022 |
2.0.2 | 9,008 | 6/8/2022 |
2.0.1 | 15,790 | 5/14/2022 |
2.0.0 | 415 | 5/14/2022 |
1.2.4 | 11,320 | 5/3/2022 |
1.2.3 | 8,483 | 4/19/2022 |
1.2.2 | 23,636 | 3/5/2022 |
1.2.1 | 428 | 2/20/2022 |
1.2.0 | 9,284 | 2/19/2022 |
1.1.3 | 5,902 | 2/13/2022 |
1.1.2 | 56,739 | 11/27/2021 |
1.1.1 | 3,750 | 11/26/2021 |
1.1.0 | 4,412 | 11/20/2021 |
1.0.0 | 325 | 11/14/2021 |
Update nuget packages and SDK.
Ensure Content is read if ContentLength Header is null
feat(json): Implement Read/WriteAsPropertyName for StringEnumConverter