TypedRest 1.6.6
dotnet add package TypedRest --version 1.6.6
NuGet\Install-Package TypedRest -Version 1.6.6
<PackageReference Include="TypedRest" Version="1.6.6" />
<PackageVersion Include="TypedRest" Version="1.6.6" />
<PackageReference Include="TypedRest" />
paket add TypedRest --version 1.6.6
#r "nuget: TypedRest, 1.6.6"
#:package TypedRest@1.6.6
#addin nuget:?package=TypedRest&version=1.6.6
#tool nuget:?package=TypedRest&version=1.6.6
for .NET
TypedRest helps you build type-safe, fluent-style REST API clients. Common REST patterns such as collections are represented as classes, allowing you to write more idiomatic code.
dotnet add package TypedRest
Describe your API by deriving from EntryEndpoint and exposing its resources as properties:
class MyClient(Uri uri) : EntryEndpoint(uri)
{
public CollectionEndpoint<Contact> Contacts => new(this, relativeUri: "./contacts");
}
The endpoint types then provide the methods that match each resource:
var client = new MyClient(new Uri("http://example.com/"));
// GET /contacts
List<Contact> contactList = await client.Contacts.ReadAllAsync();
// POST /contacts -> Location: /contacts/1337
ContactEndpoint smith = await client.Contacts.CreateAsync(new Contact {Name = "Smith"});
//ContactEndpoint smith = client.Contacts["1337"];
// GET /contacts/1337
Contact contact = await smith.ReadAsync();
// PUT /contacts/1337/note
await smith.Note.SetAsync(new Note {Content = "some note"});
// DELETE /contacts/1337
await smith.DeleteAsync();
Besides collections and elements there are endpoint types for RPC-style calls, binary blobs and uploads, and (with TypedRest.Reactive) push streams. See the endpoint types for the full list.
Dependency injection
In an ASP.NET Core service (or anything else using IServiceProvider), register your client with .AddTypedRest<MyClient>(uri). This wires it up with HttpClientFactory and returns an IHttpClientBuilder for further configuration, e.g. .AddBasicAuth(…) or .AddOAuthHandler(…).
Related packages
- TypedRest.Reactive adds support for streaming with ReactiveX (Rx).
- TypedRest.SystemTextJson adds support for serializing with System.Text.Json instead of Newtonsoft.Json.
- TypedRest.OAuth adds OAuth 2.0 / OpenID Connect authentication to HttpClient.
- TypedRest.CommandLine builds command-line interfaces for TypedRest clients.
Links
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. net9.0 is compatible. 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 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. 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.0
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Microsoft.AspNetCore.JsonPatch (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- MorseCode.ITask (>= 2.0.3)
- Newtonsoft.Json (>= 13.0.4)
- Resta.UriTemplates (>= 1.4.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Diagnostics.DiagnosticSource (>= 10.0.10)
-
.NETStandard 2.1
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Microsoft.AspNetCore.JsonPatch (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- MorseCode.ITask (>= 2.0.3)
- Newtonsoft.Json (>= 13.0.4)
- Resta.UriTemplates (>= 1.4.0)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Diagnostics.DiagnosticSource (>= 10.0.10)
-
net10.0
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Microsoft.AspNetCore.JsonPatch (>= 10.0.10)
- Microsoft.Extensions.Http (>= 10.0.10)
- MorseCode.ITask (>= 2.0.3)
- Newtonsoft.Json (>= 13.0.4)
- Resta.UriTemplates (>= 1.4.0)
- System.ComponentModel.Annotations (>= 5.0.0)
-
net8.0
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Microsoft.AspNetCore.JsonPatch (>= 8.0.29)
- Microsoft.Extensions.Http (>= 8.0.1)
- MorseCode.ITask (>= 2.0.3)
- Newtonsoft.Json (>= 13.0.4)
- Resta.UriTemplates (>= 1.4.0)
-
net9.0
- Microsoft.AspNet.WebApi.Client (>= 6.0.0)
- Microsoft.AspNetCore.JsonPatch (>= 9.0.18)
- Microsoft.Extensions.Http (>= 9.0.18)
- MorseCode.ITask (>= 2.0.3)
- Newtonsoft.Json (>= 13.0.4)
- Resta.UriTemplates (>= 1.4.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on TypedRest:
| Package | Downloads |
|---|---|
|
PowerDns.Client
Client library for the PowerDNS API |
|
|
TypedRest.Reactive
Adds support for streaming with ReactiveX (Rx) to TypedRest. Create endpoints using the types in the TypedRest.Endpoints.Reactive namespace. |
|
|
TypedRest.SystemTextJson
Adds support for serializing using System.Text.Json to TypedRest. Pass new SystemTextJsonSerializer() to the EntryEndpoint constructor. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.6.6 | 0 | 8/1/2026 |
| 1.6.5 | 552 | 5/17/2026 |
| 1.6.4 | 267 | 5/2/2026 |
| 1.6.3 | 411 | 2/15/2026 |
| 1.6.2 | 417 | 12/20/2025 |
| 1.6.1 | 504 | 9/8/2025 |
| 1.6.0 | 971 | 12/15/2024 |
| 1.5.4 | 800 | 9/8/2024 |
| 1.5.3 | 560 | 7/7/2024 |
| 1.5.2 | 1,337 | 12/27/2023 |
| 1.5.1 | 983 | 10/4/2023 |
| 1.5.0 | 464 | 10/3/2023 |
| 1.4.1 | 423 | 10/1/2023 |
| 1.4.0 | 431 | 9/30/2023 |
| 1.3.8 | 15,846 | 3/12/2023 |
| 1.3.7 | 1,748 | 11/28/2022 |
| 1.3.6 | 3,336 | 11/29/2021 |
| 1.3.5 | 1,282 | 9/5/2021 |
| 1.3.4 | 1,589 | 1/29/2021 |
| 1.3.3 | 13,369 | 11/30/2020 |