Skip to content

Repository files navigation

HalKit - HAL API Client & Server Library for .NET

NuGet versionDownloadsHalKit - CI

HalKit is a lightweight library, targeting .NET 4.6.1 and above, that provides an easy way to interact with HAL hypermedia APIs.

Getting Started

HalKit is available on NuGet.

Install-Package HalKit

Usage

Create models for API resources.

publicclassRootResource:Resource{// Use RelAttribute to (de)serialize links[Rel("ea:orders")]publicLinkOrdersLink{get;set;}}publicclassOrdersResource:Resource{// Use the EmbeddedAttribute to (de)serialize embedded resources[Embedded("ea:order")]IList<OrderResource>Orders{get;set;}}publicclassOrderResource:Resource{publicstringStatus{get;set;}[Rel("ea:customer")]publicLinkCustomerLink{get;set;}}

Clients can use a HalClient to access resources.

varapi=newHalClient(newHalKitConfiguration("http://orders-api.com"));varroot=awaitapi.GetRootAsync<RootResource>();// Use the HalClient to follow hypermedia linksvarordersResource=awaitapi.GetAsync<OrdersResource>(root.OrdersLink);foreach(varorderinordersResource.Orders){Console.WriteLine(order.Status);}

Supported Platforms

  • .NET Core 3.1
  • .NET Framework 4.6.1
  • Mono 5.4
  • Xamarin.iOS 10.14
  • Xamarin.Mac 3.8
  • Xamarin.Android 7.5
  • Universal Windows Platform vNext

How to contribute

All submissions are welcome. Fork the repository, read the rest of this README file and make some changes. Once you're done with your changes send a pull request. Thanks!

Need Help? Found a bug?

Just [submit a issue][submitanissue] if you need any help. And, of course, feel free to submit pull requests with bug fixes or changes.

About

A lightweight .NET library for creating and consuming HAL hypermedia APIs

Resources

Stars

17 stars

Watchers

10 watching

Forks

Releases

Packages

Used by

Contributors

Languages