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
httpClientHttpClientThe HTTP client used to communicate with the REST API.
serializersIReadOnlyList<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.
uriUriThe base URI of the REST API. Missing trailing slash will be appended automatically. BaseAddress is used if this is unset.
errorHandlerIErrorHandlerHandles errors in HTTP responses. Defaults to DefaultErrorHandler if unset.
linkExtractorILinkExtractorDetects 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
httpClientHttpClientThe HTTP client used to communicate with the REST API.
uriUriThe base URI of the REST API. Missing trailing slash will be appended automatically. BaseAddress is used if this is unset.
serializerMediaTypeFormatterThe serializer used for entities sent to and received from the server. Defaults to NewtonsoftJsonSerializer if unset.
errorHandlerIErrorHandlerHandles errors in HTTP responses. Defaults to DefaultErrorHandler if unset.
linkExtractorILinkExtractorDetects 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
uriUriThe base URI of the REST API.
credentialsNetworkCredentialOptional HTTP Basic authentication credentials used to authenticate against the REST API.
serializerMediaTypeFormatterThe serializer used for entities sent to and received from the server. Defaults to NewtonsoftJsonSerializer if unset.
errorHandlerIErrorHandlerHandles errors in HTTP responses. Leave unset for default implementation.
linkExtractorILinkExtractorDetects 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
cancellationTokenCancellationToken
Returns
Exceptions
- AuthenticationException
- UnauthorizedAccessException
- KeyNotFoundException
- HttpRequestException
Other non-success status code.