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
TEntityThe 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
referrerIEndpointThe endpoint used to navigate to this one.
relativeUristringThe URI of this endpoint relative to the
referrer's. Add a./prefix here to imply a trailing slashreferrer's URI.endConditionPredicate<TEntity>A check to determine whether the entity has reached its final state and 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
referrerIEndpointThe endpoint used to navigate to this one.
relativeUriUriThe URI of this endpoint relative to the
referrer's.endConditionPredicate<TEntity>A check to determine whether the entity has reached its final state and 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
requestFunc<Task<HttpResponseMessage>>A callback that performs the actual HTTP request.
callerstringThe name of the method calling this method.
Returns
- Task<HttpResponseMessage>
The HTTP response.