TypedRest 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.
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"});
// GET /contacts/1337/note
Note note = await smith.Note.ReadAsync();
// DELETE /contacts/1337
await smith.DeleteAsync();
Read a more detailed Introduction to TypedRest or jump right in with the Getting started guide.
Take a look at the TypedRest.Endpoints.Generic namespace to get an overview of the available functionality.
NuGet packages
TypedRest
The main TypedRest library.
TypedRest.Reactive
Adds support for streaming with ReactiveX (Rx) to TypedRest.
TypedRest.OAuth
Provides an HttpClient DelegatingHandler for OAuth 2.0 / OpenID Connect authentication.
This can also be used independently of the other TypedRest packages.
TypedRest.CommandLine
Build command-line interfaces for TypedRest clients.