Namespace TypedRest.Links
Handling links between HTTP resources.
Instead of hard-coding every URI into your client, you can follow the links a server advertises. See Link handling for the methods all endpoints provide for resolving links and for the supported sources: relative URIs, URI templates, HTTP Link headers and HAL.
Uri next = endpoint.Link("next");
Uri contact = endpoint.LinkTemplate("contact", new {id = "1337"});
Which of those sources are actually consulted is decided by the ILinkExtractor passed to the EntryEndpoint and inherited by all children. The default combines HeaderLinkExtractor and HalLinkExtractor via AggregateLinkExtractor. Supporting another hypermedia format means implementing ILinkExtractor and passing it in.
class MyClient(Uri uri) : EntryEndpoint(uri, linkExtractor: new MyLinkExtractor())
{
// ...
}
Classes
- AggregateLinkExtractor
Combines the results of multiple ILinkExtractors.
- HalLinkExtractor
Extracts links from JSON bodies according to the Hypertext Application Language (HAL) specification.
- HeaderLinkExtractor
Extracts links from HTTP headers.
- Link
Represents a link to another resource.
Interfaces
- ILinkExtractor
Extracts links from responses.