Class EntryEndpoint
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
EntryEndpoint(HttpClient, IReadOnlyList<MediaTypeFormatter>, Uri?, IErrorHandler?, ILinkExtractor?)
Creates a new entry endpoint.
protected EntryEndpoint(HttpClient httpClient, IReadOnlyList<MediaTypeFormatter> serializers, Uri? uri = null, IErrorHandler? errorHandler = null, ILinkExtractor? linkExtractor = null)
Parameters
httpClient
HttpClientThe 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
UriThe base URI of the REST API. Missing trailing slash will be appended automatically. BaseAddress is used if this is unset.
errorHandler
IErrorHandlerHandles errors in HTTP responses. Defaults to DefaultErrorHandler if unset.
linkExtractor
ILinkExtractorDetects links in HTTP responses. Combines HeaderLinkExtractor and HalLinkExtractor if unset.
EntryEndpoint(HttpClient, Uri?, MediaTypeFormatter?, IErrorHandler?, ILinkExtractor?)
Creates a new entry endpoint.
public EntryEndpoint(HttpClient httpClient, Uri? uri = null, MediaTypeFormatter? serializer = null, IErrorHandler? errorHandler = null, ILinkExtractor? linkExtractor = null)
Parameters
httpClient
HttpClientThe HTTP client used to communicate with the REST API.
uri
UriThe base URI of the REST API. Missing trailing slash will be appended automatically. BaseAddress is used if this is unset.
serializer
MediaTypeFormatterThe serializer used for entities sent to and received from the server. Defaults to NewtonsoftJsonSerializer if unset.
errorHandler
IErrorHandlerHandles errors in HTTP responses. Defaults to DefaultErrorHandler if unset.
linkExtractor
ILinkExtractorDetects links in HTTP responses. Combines HeaderLinkExtractor and HalLinkExtractor if unset.
EntryEndpoint(Uri, NetworkCredential?, MediaTypeFormatter?, IErrorHandler?, ILinkExtractor?)
Creates a new entry endpoint.
public EntryEndpoint(Uri uri, NetworkCredential? credentials = null, MediaTypeFormatter? serializer = null, IErrorHandler? errorHandler = null, ILinkExtractor? linkExtractor = null)
Parameters
uri
UriThe base URI of the REST API.
credentials
NetworkCredentialOptional HTTP Basic authentication credentials used to authenticate against the REST API.
serializer
MediaTypeFormatterThe serializer used for entities sent to and received from the server. Defaults to NewtonsoftJsonSerializer if unset.
errorHandler
IErrorHandlerHandles errors in HTTP responses. Leave unset for default implementation.
linkExtractor
ILinkExtractorDetects 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
Exceptions
- AuthenticationException
- UnauthorizedAccessException
- KeyNotFoundException
- HttpRequestException
Other non-success status code.