TypedRest helps you build type-safe fluent-style REST API clients.
$ dotnet add package TypedRest
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.
You can also take a look at our Sample project.
Adds support for streaming with ReactiveX (Rx) to TypedRest.
Provides an HttpClient DelegatingHandler for OAuth 2.0 / OpenID Connect authentication.
This can also be used independently of the other TypedRest packages.
The source code is in src/, config for building the API documentation is in doc/ and generated build artifacts are placed in artifacts/. The source code does not contain version numbers. Instead the version is determined during CI using GitVersion.
To build run .\build.ps1 or ./build.sh (.NET SDK is automatically downloaded if missing using 0install).
We welcome contributions to this project such as bug reports, recommendations and pull requests.
This repository contains an EditorConfig file. Please make sure to use an editor that supports it to ensure consistent code style, file encoding, etc.. For full tooling support for all style and naming conventions consider using JetBrains' ReSharper or Rider products.