C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.APITypes.SubResource< T > Class Template Reference

Describes an additional sub-resource available off a resource which is not actually a property of that resource. Allows APIResources to quickly define additional endpoints off their URLs which in turn support GET. More...

Public Member Functions

 SubResource (IEndpoint owner, string relativePath)
 Defines a new sub-resource or endpoint off of some other endpoint.
 
T Get (IEnumerable< Parameter > parameters=null, int? timeout=null)
 Performs a GET request a at this endpoint.
 
IRestResponse GetStream (Action< Stream > consumeStream, IEnumerable< Parameter > parameters=null, int? timeout=null)
 Perform a GET on the supplied URL and provide an action for consuming the response stream rather than loading the whole response into memory.
 
IRestResponse Head (IEnumerable< Parameter > parameters=null, int? timeout=null)
 Performs a HEAD request at this endpoint.
 
void ValidateOwnerHasId ()
 Verifies the owner exists and has been POSTed, ensuring that it is safe to invoke actions on this SubResourceEndpoint.
 

Static Public Member Functions

static implicit operator T (SubResource< T > value)
 Allows implicit conversion of an instance of this class to its expected response return type.
 

Properties

intDefaultTimeout = null [get, set]
 Can be used to override the API.DefaultRequestTimeout with one that better suits this SubResource.
 
IEndpoint Owner [get]
 The endpoint off of which this sub-endpoint exists.
 
string Path [get]
 The relative path to this endpoint from the root server URL.
 
string RelativePathFromOwner [get]
 The relative path to this endpoint from its owner.
 

Detailed Description

Describes an additional sub-resource available off a resource which is not actually a property of that resource. Allows APIResources to quickly define additional endpoints off their URLs which in turn support GET.

Template Parameters
TThe type of data residing at this endpoint.

Definition at line 12 of file SubResource[T].cs.

Inheritance diagram for AnalyzeRe.APITypes.SubResource< T >:
AnalyzeRe.APITypes.SubResourceEndpoint AnalyzeRe.APITypes.IEndpoint

Constructor & Destructor Documentation

◆ SubResource()

AnalyzeRe.APITypes.SubResource< T >.SubResource ( IEndpoint  owner,
string  relativePath 
)
inline

Defines a new sub-resource or endpoint off of some other endpoint.

Parameters
ownerThe endpoint which owns this sub-resource.
relativePathThe relative path to this sub-resource from its owner.

Definition at line 22 of file SubResource[T].cs.

Member Function Documentation

◆ Get()

T AnalyzeRe.APITypes.SubResource< T >.Get ( IEnumerable< Parameter parameters = null,
int timeout = null 
)
inline

Performs a GET request a at this endpoint.

Parameters
parameters(Optional) Rest parameters to include with the GET request.
timeout(Optional) The timeout before the request fails.
Returns
The data previously uploaded to this endpoint.

Definition at line 51 of file SubResource[T].cs.

◆ GetStream()

IRestResponse AnalyzeRe.APITypes.SubResource< T >.GetStream ( Action< Stream consumeStream,
IEnumerable< Parameter parameters = null,
int timeout = null 
)
inline

Perform a GET on the supplied URL and provide an action for consuming the response stream rather than loading the whole response into memory.

Warning: The consumeStream action will always be invoked and handed the response body, even if the response status was an error. Your consumeStream action should be able to handle scenarios where the message body is an error message or otherwise contains unexpected content.

Parameters
consumeStreamThe action that will consume the response stream.
parametersAny additional parameters to include in the request.
timeoutOptional - The desired request response timeout (in milliseconds).
Returns
The IRestResponse returned after executing the request. This response object contains all the details about the request (whether it was successful or not) except for the raw data, which is handled by the user-supplied stream action.
Exceptions
APIRequestExceptionIf the request failed to reach the API.

Definition at line 72 of file SubResource[T].cs.

◆ Head()

IRestResponse AnalyzeRe.APITypes.SubResource< T >.Head ( IEnumerable< Parameter parameters = null,
int timeout = null 
)
inline

Performs a HEAD request at this endpoint.

Parameters
parameters(Optional) Rest parameters to include with the HEAD request.
timeout(Optional) The timeout before the request fails.
Returns
The response.

Definition at line 40 of file SubResource[T].cs.

◆ operator T()

Allows implicit conversion of an instance of this class to its expected response return type.

Definition at line 28 of file SubResource[T].cs.

◆ ValidateOwnerHasId()

void AnalyzeRe.APITypes.SubResourceEndpoint.ValidateOwnerHasId ( )
inlineinherited

Verifies the owner exists and has been POSTed, ensuring that it is safe to invoke actions on this SubResourceEndpoint.

Exceptions
ArgumentExceptionIf the resource's id is null or empty.

Definition at line 34 of file SubResourceEndpoint.cs.

Property Documentation

◆ DefaultTimeout

int? AnalyzeRe.APITypes.SubResource< T >.DefaultTimeout = null
getset

Can be used to override the API.DefaultRequestTimeout with one that better suits this SubResource.

Definition at line 16 of file SubResource[T].cs.

◆ Owner

IEndpoint AnalyzeRe.APITypes.SubResourceEndpoint.Owner
getinherited

The endpoint off of which this sub-endpoint exists.

Definition at line 12 of file SubResourceEndpoint.cs.

◆ Path

string AnalyzeRe.APITypes.SubResourceEndpoint.Path
getinherited

The relative path to this endpoint from the root server URL.

The relative path to this endpoint from the root URL.

Implements AnalyzeRe.APITypes.IEndpoint.

Definition at line 19 of file SubResourceEndpoint.cs.

◆ RelativePathFromOwner

string AnalyzeRe.APITypes.SubResourceEndpoint.RelativePathFromOwner
getinherited

The relative path to this endpoint from its owner.

Definition at line 15 of file SubResourceEndpoint.cs.


The documentation for this class was generated from the following file: