C# Client Library
A C# Client Library for the AnalyzeRe REST API
|
Can be used to asynchronously poll a request until the result is ready. More...
Classes | |
class | OnCompletedEventArgs |
The OnPollEventHandler EventArgs. More... | |
class | OnErrorEventArgs |
The OnPollEventHandler EventArgs. More... | |
class | OnPollEventArgs |
The OnPollEventHandler EventArgs. More... | |
Public Member Functions | |
AsyncRequestMonitor (Func< T > functionThatMight503, PollingOptions pollingOptions=null) | |
Prepare this request monitor to executes the specified delegate request until it completes. | |
AsyncRequestMonitor (T resourceToMonitor, PollingOptions pollingOptions=null) | |
Prepare this request monitor to monitor the specified resource until it completes. | |
void | Dispose () |
Cancel the polling thread if running and dispose. | |
delegate void | OnCompletedEventHandler (object sender, OnCompletedEventArgs e) |
The request has returned with a successful code. | |
delegate void | OnErrorEventHandler (object sender, OnErrorEventArgs e) |
A request has failed in an unexpected way. | |
delegate void | OnPollEventHandler (object sender, OnPollEventArgs e) |
A request has returned with a 503 code and RetryAfter header. | |
void | Start () |
Begin polling the delegate asynchronously. | |
void | Stop () |
Cancel any pending requests and stop polling. | |
T | Wait () |
Join the polling thread and block further execution until the results is available to be returned on an error arises. | |
Properties | |
TimeSpan | Elapsed [get] |
The time taken between the first request and when polling ceased (either due to success or error). Includes the time taken executing any callbacks such as OnSuccess and OnError. | |
bool | IsPollingActive [get] |
Returns true if a thread is actively polling this delegate. | |
PollingOptions | PollingOptions [get, set] |
Controls the polling behaviour (how frequently the function is polled and for how long). Can only be changed while stopped. | |
T | Result [get] |
The result of the delegate after successfully returning. | |
Exception | ResultException [get] |
The error encountered in retrieving the result (if any). | |
Events | |
OnCompletedEventHandler | OnCompleted |
Event fired when the request has returned with a successful code. | |
OnErrorEventHandler | OnError |
Event fired when a request has failed in an unexpected way. | |
OnPollEventHandler | OnPoll |
Event fired when a request has returned with a 503 code and RetryAfter header. | |
Can be used to asynchronously poll a request until the result is ready.
Definition at line 13 of file AsyncRequestMonitor.cs.
|
inline |
Prepare this request monitor to executes the specified delegate request until it completes.
functionThatMight503 | A delegate function that returns the value you want but might also throw a 503 exception. |
pollingOptions | Controls the polling behaviour (how frequently the function is polled and for how long) |
Definition at line 142 of file AsyncRequestMonitor.cs.
|
inline |
Prepare this request monitor to monitor the specified resource until it completes.
resourceToMonitor | A IStoredAPIResource_WithStatus resource whose status should be monitored until it is ready. |
pollingOptions | Controls the polling behaviour (how frequently the function is polled and for how long) |
Definition at line 155 of file AsyncRequestMonitor.cs.
|
inline |
Cancel the polling thread if running and dispose.
Definition at line 169 of file AsyncRequestMonitor.cs.
delegate void AnalyzeRe.Utilities.AsyncRequestMonitor< T >.OnCompletedEventHandler | ( | object | sender, |
OnCompletedEventArgs | e | ||
) |
The request has returned with a successful code.
sender | The AsyncRequestMonitor firing the event. |
e | The OnCompletedEventHandler event args. |
delegate void AnalyzeRe.Utilities.AsyncRequestMonitor< T >.OnErrorEventHandler | ( | object | sender, |
OnErrorEventArgs | e | ||
) |
A request has failed in an unexpected way.
sender | The AsyncRequestMonitor firing the event. |
e | The OnErrorEventHandler event args. |
delegate void AnalyzeRe.Utilities.AsyncRequestMonitor< T >.OnPollEventHandler | ( | object | sender, |
OnPollEventArgs | e | ||
) |
A request has returned with a 503 code and RetryAfter header.
sender | The AsyncRequestMonitor firing the event. |
e | The polling event args. |
|
inline |
Begin polling the delegate asynchronously.
Definition at line 193 of file AsyncRequestMonitor.cs.
|
inline |
Cancel any pending requests and stop polling.
Definition at line 234 of file AsyncRequestMonitor.cs.
|
inline |
Join the polling thread and block further execution until the results is available to be returned on an error arises.
AggregateException | If the asynchronous success fails. |
Definition at line 247 of file AsyncRequestMonitor.cs.
|
get |
The time taken between the first request and when polling ceased (either due to success or error). Includes the time taken executing any callbacks such as OnSuccess and OnError.
Definition at line 32 of file AsyncRequestMonitor.cs.
|
get |
Returns true if a thread is actively polling this delegate.
Definition at line 21 of file AsyncRequestMonitor.cs.
Controls the polling behaviour (how frequently the function is polled and for how long). Can only be changed while stopped.
Definition at line 18 of file AsyncRequestMonitor.cs.
|
get |
The result of the delegate after successfully returning.
Definition at line 24 of file AsyncRequestMonitor.cs.
|
get |
The error encountered in retrieving the result (if any).
Definition at line 27 of file AsyncRequestMonitor.cs.
OnCompletedEventHandler AnalyzeRe.Utilities.AsyncRequestMonitor< T >.OnCompleted |
Event fired when the request has returned with a successful code.
Definition at line 69 of file AsyncRequestMonitor.cs.
Event fired when a request has failed in an unexpected way.
Definition at line 131 of file AsyncRequestMonitor.cs.
Event fired when a request has returned with a 503 code and RetryAfter header.
Definition at line 99 of file AsyncRequestMonitor.cs.