Interface IEndpoint
Endpoint, i.e. a remote HTTP resource.
public interface IEndpoint
Properties
ErrorHandler
Handles errors in responses.
IErrorHandler ErrorHandler { get; }
Property Value
HttpClient
The HTTP client used to communicate with the remote resource.
HttpClient HttpClient { get; }
Property Value
LinkExtractor
Extracts links from responses.
ILinkExtractor LinkExtractor { get; }
Property Value
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
Uri
The HTTP URI of the remote resource.
Uri Uri { get; }
Property Value
Methods
GetLinks(string)
Resolves all links with a specific relation type. Uses cached data from last response.
IReadOnlyList<(Uri uri, string? title)> GetLinks(string rel)
Parameters
rel
stringThe relation type of the links to look for.
Returns
- IReadOnlyList<(Uri uri, string title)>
Link(string)
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
stringThe relation type of the link to look for.
Returns
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
stringThe 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
stringThe relation type of the link template to look for.
variables
objectAn 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.