Table of Contents

Class PollingEndpoint<TEntity>

Namespace
TypedRest.Endpoints.Reactive
Assembly
TypedRest.Reactive.dll

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
PollingEndpoint<TEntity>
Implements
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 IEndpoint

The endpoint used to navigate to this one.

relativeUri string

The URI of this endpoint relative to the referrer's. Add a ./ prefix here to imply a trailing slash referrer'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 IEndpoint

The endpoint used to navigate to this one.

relativeUri Uri

The 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

TimeSpan

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 string

The name of the method calling this method.

Returns

Task<HttpResponseMessage>

The HTTP response.