Table of Contents

Class EntryEndpoint

Namespace
TypedRest.Endpoints
Assembly
TypedRest.dll

Represent the top-level URI of an API. Derive from this class and add your own set of child-IEndpoints as properties.

public class EntryEndpoint : EndpointBase, IEndpoint
Inheritance
EntryEndpoint
Implements
Inherited Members

Constructors

Creates a new entry endpoint.

protected EntryEndpoint(HttpClient httpClient, IReadOnlyList<MediaTypeFormatter> serializers, Uri? uri = null, IErrorHandler? errorHandler = null, ILinkExtractor? linkExtractor = null)

Parameters

httpClient HttpClient

The HTTP client used to communicate with the REST API.

serializers IReadOnlyList<MediaTypeFormatter>

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.

uri Uri

The base URI of the REST API. Missing trailing slash will be appended automatically. BaseAddress is used if this is unset.

errorHandler IErrorHandler

Handles errors in HTTP responses. Defaults to DefaultErrorHandler if unset.

linkExtractor ILinkExtractor

Detects links in HTTP responses. Combines HeaderLinkExtractor and HalLinkExtractor if unset.

Creates a new entry endpoint.

public EntryEndpoint(HttpClient httpClient, Uri? uri = null, MediaTypeFormatter? serializer = null, IErrorHandler? errorHandler = null, ILinkExtractor? linkExtractor = null)

Parameters

httpClient HttpClient

The HTTP client used to communicate with the REST API.

uri Uri

The base URI of the REST API. Missing trailing slash will be appended automatically. BaseAddress is used if this is unset.

serializer MediaTypeFormatter

The serializer used for entities sent to and received from the server. Defaults to NewtonsoftJsonSerializer if unset.

errorHandler IErrorHandler

Handles errors in HTTP responses. Defaults to DefaultErrorHandler if unset.

linkExtractor ILinkExtractor

Detects links in HTTP responses. Combines HeaderLinkExtractor and HalLinkExtractor if unset.

Creates a new entry endpoint.

public EntryEndpoint(Uri uri, NetworkCredential? credentials = null, MediaTypeFormatter? serializer = null, IErrorHandler? errorHandler = null, ILinkExtractor? linkExtractor = null)

Parameters

uri Uri

The base URI of the REST API.

credentials NetworkCredential

Optional HTTP Basic authentication credentials used to authenticate against the REST API.

serializer MediaTypeFormatter

The serializer used for entities sent to and received from the server. Defaults to NewtonsoftJsonSerializer if unset.

errorHandler IErrorHandler

Handles errors in HTTP responses. Leave unset for default implementation.

linkExtractor ILinkExtractor

Detects links in HTTP responses. Leave unset for default implementation.

Methods

ReadMetaAsync(CancellationToken)

Fetches metadata such as links from the server.

public Task ReadMetaAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task

Exceptions

AuthenticationException

Unauthorized

UnauthorizedAccessException

Forbidden

KeyNotFoundException

NotFound or Gone

HttpRequestException

Other non-success status code.