Table of Contents

Interface IEndpoint

Namespace
TypedRest.Endpoints
Assembly
TypedRest.dll

Endpoint, i.e. a remote HTTP resource.

public interface IEndpoint

Properties

ErrorHandler

Handles errors in responses.

IErrorHandler ErrorHandler { get; }

Property Value

IErrorHandler

HttpClient

The HTTP client used to communicate with the remote resource.

HttpClient HttpClient { get; }

Property Value

HttpClient

LinkExtractor

Extracts links from responses.

ILinkExtractor LinkExtractor { get; }

Property Value

ILinkExtractor

Serializers

A list of serializers used for entities received from the server, sorted from most to least preferred. Always uses first for sending to the server.

IReadOnlyList<MediaTypeFormatter> Serializers { get; }

Property Value

IReadOnlyList<MediaTypeFormatter>

Uri

The HTTP URI of the remote resource.

Uri Uri { get; }

Property Value

Uri

Methods

Resolves all links with a specific relation type. Uses cached data from last response.

IReadOnlyList<(Uri uri, string? title)> GetLinks(string rel)

Parameters

rel string

The relation type of the links to look for.

Returns

IReadOnlyList<(Uri uri, string title)>

Resolves a single link with a specific relation type. Uses cached data from last response if possible. Tries lazy lookup with HTTP HEAD on cache miss.

Uri Link(string rel)

Parameters

rel string

The relation type of the link to look for.

Returns

Uri

Exceptions

KeyNotFoundException

No link with the specified rel could be found.

LinkTemplate(string, IDictionary<string, object>)

Resolves a link template with a specific relation type. Uses cached data from last response if possible. Tries lazy lookup with HTTP HEAD on cache miss.

Uri LinkTemplate(string rel, IDictionary<string, object> variables)

Parameters

rel string

The relation type of the link template to look for.

variables IDictionary<string, object>

Variables for resolving the template.

Returns

Uri

The href of the link resolved relative to this endpoint's URI.

Exceptions

KeyNotFoundException

No link template with the specified rel could be found.

LinkTemplate(string, object)

Resolves a link template with a specific relation type.

Uri LinkTemplate(string rel, object variables)

Parameters

rel string

The relation type of the link template to look for.

variables object

An object used to provide properties for resolving the template.

Returns

Uri

The href of the link resolved relative to this endpoint's URI.

Remarks

Uses cached data from last response if possible. Tries lazy lookup with HTTP HEAD on cache miss.

Exceptions

KeyNotFoundException

No link template with the specified rel could be found.