Class PollingEndpoint<TEntity>
Endpoint for a resource that can be polled for state changes.
public class PollingEndpoint<TEntity> : ElementEndpoint<TEntity>, ICachingEndpoint, IPollingEndpoint<TEntity>, IElementEndpoint<TEntity>, IElementEndpoint, IEndpoint where TEntity : class
Type Parameters
TEntity
The type of entity the endpoint represents.
- Inheritance
-
ElementEndpoint<TEntity>PollingEndpoint<TEntity>
- Implements
-
IPollingEndpoint<TEntity>IElementEndpoint<TEntity>
- Inherited Members
Constructors
PollingEndpoint(IEndpoint, string, Predicate<TEntity>?)
Creates a new polling endpoint.
public PollingEndpoint(IEndpoint referrer, string relativeUri, Predicate<TEntity>? endCondition = null)
Parameters
referrer
IEndpointThe endpoint used to navigate to this one.
relativeUri
stringThe URI of this endpoint relative to the
referrer
's. Add a./
prefix here to imply a trailing slashreferrer
's URI.endCondition
Predicate<TEntity>A check to determine whether the entity has reached its final state an no further polling is required.
PollingEndpoint(IEndpoint, Uri, Predicate<TEntity>?)
Creates a new polling endpoint.
public PollingEndpoint(IEndpoint referrer, Uri relativeUri, Predicate<TEntity>? endCondition = null)
Parameters
referrer
IEndpointThe endpoint used to navigate to this one.
relativeUri
UriThe URI of this endpoint relative to the
referrer
's.endCondition
Predicate<TEntity>A check to determine whether the entity has reached its final state an no further polling is required.
Properties
PollingInterval
The interval in which to send requests to the server. The server can modify this value using the "Retry-After" header.
public TimeSpan PollingInterval { get; set; }
Property Value
Methods
GetObservable()
Provides an observable stream of entity states. Compares entities using Equals(object) to detect changes.
public IObservable<TEntity> GetObservable()
Returns
- IObservable<TEntity>
HandleAsync(Func<Task<HttpResponseMessage>>, string)
Handles various cross-cutting concerns regarding a response message such as discovering links and handling errors.
protected override Task<HttpResponseMessage> HandleAsync(Func<Task<HttpResponseMessage>> request, string caller = "unknown")
Parameters
request
Func<Task<HttpResponseMessage>>A callback that performs the actual HTTP request.
caller
stringThe name of the method calling this method.
Returns
- Task<HttpResponseMessage>
The HTTP response.