C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.API Class Reference

API methods / requests made available to the user. More...

Classes

class  Parameters
 Parameters that can be added to your REST requests to access additional API features. More...
 
class  PollingOptions
 A duplicate of the AnalyzeRe.PollingOptions class. More...
 
class  PortfolioViewMarginals
 Represents the endpoint on the server for requesting marginal portfolios. More...
 

Public Types

enum  SearchType { Basic , Advanced }
 The search type determines the interpretation of the query string. More...
 

Public Member Functions

delegate void AuthenticationRequestedHandler (ref IAccessToken ToAuthenticate, string RequestedAuthentication)
 A handler that can respond to a AuthenticationRequestedHandler event.
 

Static Public Member Functions

static ICollectionResponse< IAPIResourceBatchGet (Type resourceType, IEnumerable< string > ids, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null)
 Get a collection of resources from the server that match the set of resource ids specified.
 
static ICollectionResponse< TBatchGet< T > (IEnumerable< string > ids, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null)
 Get a collection of resources from the server that match the set of resource ids specified.
 
static void ClearCachedAuthenticationCredentials (string server=null)
 The Analyze Re API .NET Client Library caches authentication tokens that have been validated via the AuthenticationRequested event. This means that all applications on the same machine using this library can be authenticated once the first application is authenticated. These credentials will automatically be forgotten if they are revoked by the server, but this method can be used to forget all cached credentials, or just the credentials for a specific server if one is specified.
 
static IRestResponse ExecuteRestRequest (string resource, Method method, IEnumerable< Parameter > requestParameters=null, int? timeout=null, bool returnRawResponse=false, Action< Stream > responseStreamReader=null)
 Perform a REST request on the server.
 
static object ExtractRestResponse (IRestResponse response, Type deserializeType)
 Attempts to deserialize an IRestResponse content to the specified run-time type.
 
static T ExtractRestResponse< T > (IRestResponse response)
 Attempts to deserialize an IRestResponse content to the specified type T.
 
static IAPIResource Get (Type resourceType, string id, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Get the selected resource by ID. The appropriate collection is automatically determined by the supplied runtime resource type. (Must derive from IAPIResource)
 
static T Get< T > (string id, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Get the selected resource by ID. The appropriate collection is automatically determined by the resource type. (Must derive from IAPIResource)
 
static AuthenticationStatus GetAuthenticationStatus (bool force_request=false)
 Determines whether we are currently authenticated against the server with the global default AuthenticationToken. If the current authentication status is unknown, Invokes a request to test the authentication status.
 
static string GetCollectionName (Type requestType)
 Gets the collection name for the given APIResource type, whether it's instantiable or not.
 
static string GetCollectionName (Type requestType, out Type declaringClassType, bool suppress_throw=false)
 Gets the collection name for the given APIResource type, whether it's instantiable or not.
 
static string GetCollectionName< T > ()
 Gets the collection name for the given APIResource type, whether it's instantiable or not.
 
static string GetCollectionName< T > (out Type declaringClassType)
 Gets the collection name for the given APIResource type, whether it's instantiable or not.
 
static string GetCollectionNameFromResourceHref (string href)
 Return the collection name implied by the href for a given resource assuming the URL is in the format: https://apiurl.net/collection_name/guid
 
static string GetCurrentAuthorizationString ()
 Return the Authorization header string formed by the current AuthenticationToken.
 
static ICollectionResponse< IAPIResourceGetResourceList (Type resourceType, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null)
 Get a collection of resources from the server.
 
static ICollectionResponse< TGetResourceList< T > (IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null)
 Get a collection of resources from the server.
 
static object GetUri (Type deserializeType, Uri href, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Perform a GET on an arbitrary resource by extracting the path and query parameters from a manually specified Uri.
 
static T GetUri< T > (Uri href, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Perform a GET on an arbitrary resource by extracting the path and query parameters from a manually specified Uri.
 
static bool IsAReServerActive (string checkServerURL, int? timeout=null)
 Determines if the provided URL is a valid running Analyze Re server.
 
static bool IsSuccessful (this IRestResponse response)
 Extension method that returns true if the restResponse was completed and contains a successful status code.
 
static void LoadSettings ()
 Reloads all shared client library settings from the current statically configured SharedSettingsProvider.GlobalSettingsLocation. If this method is not invoked, or settings are not individually set, settings are loaded automatically when the first request is made, but can be repeated manually if the external settings file is modified or the desired settings location is changed.
 
static OptionsResponse Options (IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Perform an OPTIONS request on the API, which returns a list of features supported for the current authenticated user.
 
static void PollUntil (Func< bool > request, AnalyzeRe.PollingOptions pollingOptions=null)
 Poll the specified request until it returns true.
 
static TResponse PollUntil< TResponse > (Func< TResponse > request, Func< TResponse, bool > isPollingComplete, AnalyzeRe.PollingOptions pollingOptions=null)
 Poll the requested resource until a desired state is attained.
 
static T PollUntilReady< T > (Func< T > functionThatMight503, AnalyzeRe.PollingOptions pollingOptions=null)
 Specialized polling that will executes the specified request delegate, but if a 503 retry-after APIRequestException is encountered, it blocks until the request returns successfully or the maximum polling time is exceeded.
 
static T PollUntilReady< T > (Func< T > functionThatMight503, double minPollInterval=0d, double maxPollInterval=Double.MaxValue, double maxPollTotalTime=Double.MaxValue)
 Obsolete.

See also
PollUntilReady<T>(Func<T>,AnalyzeRe.PollingOptions)

Executes the specified request delegate, but if a 503 retry-after APIRequestException is encountered, it blocks until the request returns successfully or the maximum polling time is exceeded.

 
static string PrettyPrint (this IRestRequest request)
 Extension method that generates a helpful string representation of an IRestRequest.
 
static string PrettyPrint (this IRestResponse response)
 Extension method that generates a helpful string representation of an IRestResponse.
 
static object RequestAndParse (Type deserializeType, string resource, Method method, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Perform a REST request on the server and serializes the response to the desired run-time type.
 
static T RequestAndParse< T > (string resource, Method method, IEnumerable< Parameter > requestParameters=null, int? timeout=null)
 Perform a REST request on the server and serializes the response to the desired compile-time type.
 
static ICollectionResponse< IAPIResourceSearchResourceList (Type resourceType, string searchTerms, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null, SearchType searchType=SearchType.Basic)
 Get a collection of resources from the server that match the specified search criteria.
 
static ICollectionResponse< TSearchResourceList< T > (string searchTerms, IEnumerable< Parameter > requestParameters=null, string collectionNameOverride=null, int? timeout=null, SearchType searchType=SearchType.Basic)
 Get a collection of resources from the server that match the specified search criteria.
 
static bool TryHandleAuthenticationErrors (IRestResponse response, int sequentialAttempts=0)
 Checks an IRestResponse object for authentication errors, then invokes configured authentication delegates if the response was an "unauthorized" error.
 
static void TryPromptForAuthentication ()
 Invoke the AuthenticationRequested event, which requests authentication credentials for the server. Note: this will have no effect if already authenticated or authentication is not required for this server.
 

Static Public Attributes

static readonly ResourceCollection< AgentAgents
 The collection of Agents on the server.
 
static readonly ResourceCollection< AnalysisAnalyses
 The collection of Analyses on the server.
 
static readonly ResourceCollection< AnalysisProfileAnalysisProfiles
 The collection of AnalysisProfiles on the server.
 
static readonly string AnalyzeReCustomServerHeader = "ARE-Server"
 The Custom Server Header returned by valid AnalyzeRe servers.
 
static readonly string AnalyzeReServerIdentity = "ARE-API"
 The Server identity returned by valid AnalyzeRe servers.
 
static readonly string DateTimeFormat = @"O"
 The format used when transmitting DateTime information to Analyze Re servers.
 
static readonly ResourceCollection< IDistributionDistributions
 The collection of Distributions on the server.
 
static readonly ResourceCollection< EventCatalogEventCatalogs
 The collection of EventCatalogs on the server.
 
static readonly ResourceCollection< ExchangeRateProfileExchangeRateProfiles
 The collection of ExchangeRateProfiles on the server.
 
static readonly ResourceCollection< ExchangeRateTableExchangeRateTables
 The collection of ExchangeRateTables on the server.
 
static readonly ResourceCollection< DataFileFiles
 The collection of Files on the server.
 
static readonly ResourceCollection< ILayerLayers
 The collection of Layers on the server.
 
static readonly ResourceCollection< ILayerViewLayerViews
 The collection of LayerViews on the server.
 
static readonly ResourceCollection< LossFilterLossFilters
 The collection of LossFilters on the server.
 
static readonly ResourceCollection< LossSetLossSets
 The collection of LossSets on the server.
 
static volatile int MaxRequestRetries = 3
 When a temporary communication failure occurs (such as a socket error or an authentication failure for which there is a handler) this property determines how many times the client will automatically retry the same request before returning the error.
 
static readonly ResourceCollection< MetricsFunctionMetricsFunctions
 The collection of optimization metrics functions on the server.
 
static readonly ResourceCollection< OptimizationViewOptimizationViews
 The collection of OptimizationViews on the server.
 
static readonly ResourceCollection< PortfolioPortfolios
 The collection of Portfolios on the server.
 
static readonly ResourceCollection< PortfolioViewPortfolioViews
 The collection of PortfolioViews on the server.
 
static readonly ResourceCollection< ProjectionFunctionProjectionFunctions
 The collection of optimization projection functions on the server.
 
static readonly ResourceCollection< SimulationSimulations
 The collection of Simulations on the server.
 

Properties

static IAccessToken AuthenticationToken [get, set]
 The AccessToken storing authentication information for requests made to the server.
 
static int DefaultRequestTimeout [get, set]
 The default timeout used for all simple server requests, in milliseconds.
 
static int DefaultRequestTimeoutCollections [get, set]
 The default timeout used when requesting a resource collection from the server, in milliseconds.
 
static string DefaultServerURL [get]
 The Default ServerURL the API is instantiated with, as configured in the settings.
 
static bool ManagedSettingsEnabled = true [get, set]
 By Default, the Analyze Re Client Library will automatically save and restore certain configured settings such as timeouts and credentials. Set this to false to disable these features (for instance if they cause issues for your application).
 
static int Parallelism [get, set]
 The maximum number of concurrent requests that can be made.
 
static string ServerURL [get, set]
 The default server URL to be used for all API requests. On change, voids the current cached authentication credentials.
 
static string UserAgent [get, set]
 The UserAgent identifying the requests made by this client. This can be changed if an application wishes to better identify itself to the server.
 

Events

static AuthenticationRequestedHandler AuthenticationRequested
 An event that fires whenever authentication is requested by the server. This event can be used to prompt a user or other external source for credentials as needed, rather than hard-coding them into the application.
 

Detailed Description

API methods / requests made available to the user.

Partial class containing the members tied to requesting marginal portfolios.

Definition at line 18 of file API.Authentication.cs.

Member Enumeration Documentation

◆ SearchType

The search type determines the interpretation of the query string.

Enumerator
Basic 

Search by keyword on predefined field.

Advanced 

Search by complex query on key-value metadata. See Parameters.AdvancedSearch for details about advanced searching.

Definition at line 309 of file API.Requests.cs.

Member Function Documentation

◆ AuthenticationRequestedHandler()

delegate void AnalyzeRe.API.AuthenticationRequestedHandler ( ref IAccessToken  ToAuthenticate,
string  RequestedAuthentication 
)

A handler that can respond to a AuthenticationRequestedHandler event.

Parameters
ToAuthenticateThe AccessToken to authenticate.
RequestedAuthenticationThe WWW-Authenticate header sent from the server.

◆ BatchGet()

static ICollectionResponse< IAPIResource > AnalyzeRe.API.BatchGet ( Type  resourceType,
IEnumerable< string ids,
IEnumerable< Parameter requestParameters = null,
string  collectionNameOverride = null,
int timeout = null 
)
inlinestatic

Get a collection of resources from the server that match the set of resource ids specified.

Parameters
resourceTypeThe runtime type of IAPIResource being retrieved.
idsThe list of resource ids to request from the server.
requestParametersOptional - Additional parameters to include in the request.
collectionNameOverrideOptional - The new name of the collection to search from the server (if not using the default collection for the specified resourceType )
timeoutOptional - The desired request timeout (in milliseconds).

This function will automatically set the "limit" parameter to match the number of ids requested, but the server may impose a hard limit on the number of ids that can be requested at one time. See Parameters.Ids for more details.

Returns
A list of APIResources of the matching the specified resourceType and ids.

Definition at line 426 of file API.Requests.cs.

◆ BatchGet< T >()

static ICollectionResponse< T > AnalyzeRe.API.BatchGet< T > ( IEnumerable< string ids,
IEnumerable< Parameter requestParameters = null,
string  collectionNameOverride = null,
int timeout = null 
)
inlinestatic

Get a collection of resources from the server that match the set of resource ids specified.

Template Parameters
TThe type of IAPIResource being retrieved.
Parameters
idsThe list of resource ids to request from the server.
requestParametersOptional - Additional parameters to include in the request.
collectionNameOverrideOptional - The new name of the collection to search from the server (if not using the default collection for the resource type T )
timeoutOptional - The desired request timeout (in milliseconds).

This function will automatically set the "limit" parameter to match the number of ids requested, but the server may impose a hard limit on the number of ids that can be requested at one time. See Parameters.Ids for more details.

Returns
A list of APIResources of type T matching specified ids.
Type Constraints
T :IAPIResource 

Definition at line 398 of file API.Requests.cs.

◆ ClearCachedAuthenticationCredentials()

static void AnalyzeRe.API.ClearCachedAuthenticationCredentials ( string  server = null)
inlinestatic

The Analyze Re API .NET Client Library caches authentication tokens that have been validated via the AuthenticationRequested event. This means that all applications on the same machine using this library can be authenticated once the first application is authenticated. These credentials will automatically be forgotten if they are revoked by the server, but this method can be used to forget all cached credentials, or just the credentials for a specific server if one is specified.

Parameters
server(Optional) A single server URL whose credentials should be forgotten.

Definition at line 438 of file API.Authentication.cs.

◆ ExecuteRestRequest()

static IRestResponse AnalyzeRe.API.ExecuteRestRequest ( string  resource,
Method  method,
IEnumerable< Parameter requestParameters = null,
int timeout = null,
bool  returnRawResponse = false,
Action< Stream responseStreamReader = null 
)
inlinestatic

Perform a REST request on the server.

Parameters
resourceThe path of the resource or request target, from the root server URL.
methodThe HTTP method to execute, as a Rest.Method enumeration value.
requestParametersThe data to include in the request, in the form of Rest parameters.
timeoutOptional - The desired request timeout (in milliseconds).
returnRawResponseOptional (Default False) - By default, this client library will look at the response returned from the server and handle a number of known errors and response failures (like 503-RetryAfter errors) and return a more meaningful error, in some cases automatically resolving the errors itself.

You can disable this and return the raw IRestResponse from the server. To do this you must set the return type (T) to IRestResponse and set "returnRawResponse" to true.

Parameters
responseStreamReader(Optional) If supplied, the response body will be returned as a stream to the supplied delegate, rather than in the response body of the IRestResponse.
Returns
The server response, as an IRestResponse.

Definition at line 513 of file API.Requests.cs.

◆ ExtractRestResponse()

static object AnalyzeRe.API.ExtractRestResponse ( IRestResponse  response,
Type  deserializeType 
)
inlinestatic

Attempts to deserialize an IRestResponse content to the specified run-time type.

Parameters
responseThe server response, as an IRestResponse.
deserializeTypeThe type to deserialize the JSON response to.
Returns
The string response content, or throws an exception if the response contains an error.

Definition at line 636 of file API.Requests.cs.

◆ ExtractRestResponse< T >()

static T AnalyzeRe.API.ExtractRestResponse< T > ( IRestResponse  response)
inlinestatic

Attempts to deserialize an IRestResponse content to the specified type T.

Template Parameters
TThe type to deserialize the JSON response to.
Parameters
responseThe server response, as an IRestResponse.
Returns
The string response content, or throws an exception if the response contains an error.

Definition at line 622 of file API.Requests.cs.

◆ Get()

static IAPIResource AnalyzeRe.API.Get ( Type  resourceType,
string  id,
IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Get the selected resource by ID. The appropriate collection is automatically determined by the supplied runtime resource type. (Must derive from IAPIResource)

Parameters
resourceTypeThe runtime type of the resource to retrieve.
idThe id of the resource on the server.
requestParametersOptional - Additional parameters to include in the request.
timeoutOptional - The desired request timeout (in milliseconds).

This method cannot be used to find a resource whose type is not known.

Returns
The resource retrieved, deserialized to the specified type T.

Definition at line 73 of file API.Requests.cs.

◆ Get< T >()

static T AnalyzeRe.API.Get< T > ( string  id,
IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Get the selected resource by ID. The appropriate collection is automatically determined by the resource type. (Must derive from IAPIResource)

Template Parameters
TThe type of resource to retrieve.
Parameters
idThe id of the resource on the server.
requestParametersOptional - Additional parameters to include in the request.
timeoutOptional - The desired request timeout (in milliseconds).

This method cannot be used to find a resource whose type is not known.

Returns
The resource retrieved, deserialized to the specified type T.
Type Constraints
T :IAPIResource 

Definition at line 52 of file API.Requests.cs.

◆ GetAuthenticationStatus()

static AuthenticationStatus AnalyzeRe.API.GetAuthenticationStatus ( bool  force_request = false)
inlinestatic

Determines whether we are currently authenticated against the server with the global default AuthenticationToken. If the current authentication status is unknown, Invokes a request to test the authentication status.

Parameters
force_requestSet to true to force a request to be made to the server regardless of the cached authentication status on the current authentication token.
Returns
The current authentication status as an enumeration value.

Definition at line 388 of file API.Authentication.cs.

◆ GetCollectionName() [1/2]

static string AnalyzeRe.API.GetCollectionName ( Type  requestType)
inlinestatic

Gets the collection name for the given APIResource type, whether it's instantiable or not.

Parameters
requestTypeThe type of resource for which to retrieve the collection name.
Returns
The collection name for the class. (i.e. The collection name for the Type 'CatXL' is "layers", and was defined by the class Type 'Layer')

Definition at line 256 of file API.Utilities.cs.

◆ GetCollectionName() [2/2]

static string AnalyzeRe.API.GetCollectionName ( Type  requestType,
out Type  declaringClassType,
bool  suppress_throw = false 
)
inlinestatic

Gets the collection name for the given APIResource type, whether it's instantiable or not.

Parameters
requestTypeThe type of resource for which to retrieve the collection name.
declaringClassTypeWill be set to the Type that declared the collection name.
suppress_throwAllows the caller to suppress raising an exception if the no collection name exists for the specified class and return null instead.
Returns
The collection name for the class. (i.e. The collection name for the Type 'CatXL' is "layers", and was defined by the class Type 'Layer')

Definition at line 277 of file API.Utilities.cs.

◆ GetCollectionName< T >() [1/2]

Gets the collection name for the given APIResource type, whether it's instantiable or not.

Template Parameters
TThe type of resource for which to retrieve the collection name.
Returns
The collection name for the class. (i.e. The collection name for the Type 'CatXL' is "layers", and was defined by the class Type 'Layer')
Type Constraints
T :IAPIResource 

Definition at line 233 of file API.Utilities.cs.

◆ GetCollectionName< T >() [2/2]

static string AnalyzeRe.API.GetCollectionName< T > ( out Type  declaringClassType)
inlinestatic

Gets the collection name for the given APIResource type, whether it's instantiable or not.

Template Parameters
TThe type of resource for which to retrieve the collection name.
Parameters
declaringClassTypeWill be set to the Type that declared the collection name.
Returns
The collection name for the class. (i.e. The collection name for the Type 'CatXL' is "layers", and was defined by the class Type 'Layer')
Type Constraints
T :IAPIResource 

Definition at line 245 of file API.Utilities.cs.

◆ GetCollectionNameFromResourceHref()

static string AnalyzeRe.API.GetCollectionNameFromResourceHref ( string  href)
inlinestatic

Return the collection name implied by the href for a given resource assuming the URL is in the format: https://apiurl.net/collection_name/guid

Parameters
hrefA resource URL.
Returns
The collection_name portion of the URL.

Definition at line 436 of file API.Utilities.cs.

◆ GetCurrentAuthorizationString()

static string AnalyzeRe.API.GetCurrentAuthorizationString ( )
inlinestatic

Return the Authorization header string formed by the current AuthenticationToken.

Returns
The string representation of the current AuthenticationToken.

Definition at line 53 of file API.Authentication.cs.

◆ GetResourceList()

static ICollectionResponse< IAPIResource > AnalyzeRe.API.GetResourceList ( Type  resourceType,
IEnumerable< Parameter requestParameters = null,
string  collectionNameOverride = null,
int timeout = null 
)
inlinestatic

Get a collection of resources from the server.

Parameters
resourceTypeThe type of resource (derived from IAPIResource).
requestParametersOptional - Additional parameters to include in the request.
collectionNameOverrideOptional - The new name of the collection to retrieve from the server (if not using the default collection for the resource type T)
timeoutOptional - The desired request timeout (in milliseconds).
Returns
A List of APIResources of the type T provided.

Definition at line 171 of file API.Requests.cs.

◆ GetResourceList< T >()

static ICollectionResponse< T > AnalyzeRe.API.GetResourceList< T > ( IEnumerable< Parameter requestParameters = null,
string  collectionNameOverride = null,
int timeout = null 
)
inlinestatic

Get a collection of resources from the server.

Template Parameters
TThe type of resource (derived from IAPIResource).
Parameters
requestParametersOptional - Additional parameters to include in the request.
collectionNameOverrideOptional - The new name of the collection to retrieve from the server (if not using the default collection for the resource type T)
timeoutOptional - The desired request timeout (in milliseconds).
Returns
A List of APIResources of the type T provided.
Type Constraints
T :IAPIResource 

Definition at line 142 of file API.Requests.cs.

◆ GetUri()

static object AnalyzeRe.API.GetUri ( Type  deserializeType,
Uri  href,
IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Perform a GET on an arbitrary resource by extracting the path and query parameters from a manually specified Uri.

Parameters
deserializeTypeThe expected type of the resource request response. Set to IRestResponse to skip deserializing the request.
hrefThe request Uri to use. Note that only the path and query will be used. This method is not intended to facilitate requests made to a host other than the one configured as the ServerURL.
requestParametersOptional - Additional parameters to include in the request.
timeoutOptional - The desired request timeout (in milliseconds).
Returns
The resource retrieved, deserialized to the specified type T.

Definition at line 122 of file API.Requests.cs.

◆ GetUri< T >()

static T AnalyzeRe.API.GetUri< T > ( Uri  href,
IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Perform a GET on an arbitrary resource by extracting the path and query parameters from a manually specified Uri.

Template Parameters
TThe expected type of the resource request response. Set to IRestResponse to skip deserializing the request.
Parameters
hrefThe request Uri to use. Note that only the path and query will be used. This method is not intended to facilitate requests made to a host other than the one configured as the ServerURL.
requestParametersOptional - Additional parameters to include in the request.
timeoutOptional - The desired request timeout (in milliseconds).
Returns
The resource retrieved, deserialized to the specified type T.

Definition at line 98 of file API.Requests.cs.

◆ IsAReServerActive()

static bool AnalyzeRe.API.IsAReServerActive ( string  checkServerURL,
int timeout = null 
)
inlinestatic

Determines if the provided URL is a valid running Analyze Re server.

Parameters
checkServerURLThe server URL to check.
timeoutOptional - The desired request timeout (in milliseconds).
Returns
Returns true if the provided URL is a valid running Analyze Re server.

Definition at line 34 of file API.Utilities.cs.

◆ IsSuccessful()

static bool AnalyzeRe.API.IsSuccessful ( this IRestResponse  response)
inlinestatic

Extension method that returns true if the restResponse was completed and contains a successful status code.

Parameters
responseThe response received from the server.
Returns
True if the response is successful

Definition at line 649 of file API.Utilities.cs.

◆ LoadSettings()

static void AnalyzeRe.API.LoadSettings ( )
static

Reloads all shared client library settings from the current statically configured SharedSettingsProvider.GlobalSettingsLocation. If this method is not invoked, or settings are not individually set, settings are loaded automatically when the first request is made, but can be repeated manually if the external settings file is modified or the desired settings location is changed.

Various default settings can be configured by modifying the appropriate Settings.Default attribute and saving changes.

◆ Options()

static OptionsResponse AnalyzeRe.API.Options ( IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Perform an OPTIONS request on the API, which returns a list of features supported for the current authenticated user.

Parameters
requestParametersOptional - Additional parameters to include in the request.
timeoutOptional - The desired request timeout (in milliseconds).
Returns
The Options response.

Definition at line 32 of file API.Requests.cs.

◆ PollUntil()

static void AnalyzeRe.API.PollUntil ( Func< bool request,
AnalyzeRe.PollingOptions  pollingOptions = null 
)
static

Poll the specified request until it returns true.

Parameters
requestA test condition that returns true or false.
pollingOptions(Optional) Polling options which determine the polling rates, total time, and allow for asynchronous cancellation.
Exceptions
NotWaitingExceptionIf the polling options max poll total time is exceeded and the request never returned true.
TaskCanceledExceptionIf the pollingOptions.CancellationToken enters the cancelled state.

◆ PollUntil< TResponse >()

static TResponse AnalyzeRe.API.PollUntil< TResponse > ( Func< TResponse request,
Func< TResponse, bool isPollingComplete,
AnalyzeRe::PollingOptions  pollingOptions = null 
)
inlinestatic

Poll the requested resource until a desired state is attained.

Template Parameters
TResponseThe type of response expected.
Parameters
requestThe delegate to invoke each time the resource is polled.
isPollingCompleteThe delegate which determines whether the response to the request is the desired state. This is evaluated after each request.
pollingOptions(Optional) Polling options which determine the polling rates, total time, and allow for asynchronous cancellation.
Returns
The last response returned after polling.
Exceptions
NotWaitingExceptionIf the polling options max poll total time is exceeded and the result is not yet available.
TaskCanceledExceptionIf the pollingOptions.CancellationToken enters the cancelled state.

TODO: In order to avoid exceeding the timeout, we may wish to invoke the request (which in theory might block forever) in a cancellable task with a timeout.

Definition at line 73 of file API.Utilities.cs.

◆ PollUntilReady< T >() [1/2]

static T AnalyzeRe.API.PollUntilReady< T > ( Func< T functionThatMight503,
AnalyzeRe::PollingOptions  pollingOptions = null 
)
inlinestatic

Specialized polling that will executes the specified request delegate, but if a 503 retry-after APIRequestException is encountered, it blocks until the request returns successfully or the maximum polling time is exceeded.

Template Parameters
TThe return type of the delegate function.
Parameters
functionThatMight503A request delegate function to be executed which may raise a 503 retry-after APIRequestException.
pollingOptions(Optional) Determines the behaviour of the API when automatically retrying a request whose result is not yet ready for retrieval.
Returns
The result of the delegate function if successful.
Exceptions
NotWaitingExceptionIf the polling options max poll total time is exceeded and the result is not yet available.
APIRequestExceptionThe server raises an exception other than one that indicates the user should retry the request.
TaskCanceledExceptionIf the pollingOptions.CancellationToken enters the cancelled state.

Definition at line 138 of file API.Utilities.cs.

◆ PollUntilReady< T >() [2/2]

static T AnalyzeRe.API.PollUntilReady< T > ( Func< T functionThatMight503,
double  minPollInterval = 0d,
double  maxPollInterval = Double::MaxValue,
double  maxPollTotalTime = Double::MaxValue 
)
inlinestatic

Obsolete.

See also
PollUntilReady<T>(Func<T>,AnalyzeRe.PollingOptions)

Executes the specified request delegate, but if a 503 retry-after APIRequestException is encountered, it blocks until the request returns successfully or the maximum polling time is exceeded.

Template Parameters
TThe return type of the delegate function.
Parameters
functionThatMight503A request delegate function to be executed which may raise a 503 retry-after APIRequestException.
minPollIntervalOptional (Default: 0) The minimum time (in seconds) to wait between retrying the request.
maxPollIntervalOptional (Default: double.MaxValue) The maximum time (in seconds) to wait between retrying the request.
maxPollTotalTimeOptional (Default: double.MaxValue) The maximum time (in seconds) to poll the request before raising a NotWaitingException.
Returns
The result of the delegate function if successful.
Exceptions
NotWaitingExceptionIf the max poll total time is exceeded and the result is not yet available.
APIRequestExceptionThe server raises an exception other than one that indicates the user should retry the request.
ArgumentOutOfRangeExceptionThe specified min and max polling intervals do not result in meaningful bounds.

TODO: Delete Deprecated Methods after phase-out period.

Definition at line 724 of file API.Utilities.cs.

◆ PrettyPrint() [1/2]

static string AnalyzeRe.API.PrettyPrint ( this IRestRequest  request)
inlinestatic

Extension method that generates a helpful string representation of an IRestRequest.

Parameters
requestThe IRestRequest to convert to string.
Returns
A helpful string representation of the IRestRequest.

Definition at line 568 of file API.Utilities.cs.

◆ PrettyPrint() [2/2]

static string AnalyzeRe.API.PrettyPrint ( this IRestResponse  response)
inlinestatic

Extension method that generates a helpful string representation of an IRestResponse.

Parameters
responseThe IRestResponse to convert to string.
Returns
A helpful string representation of the IRestResponse.

Definition at line 601 of file API.Utilities.cs.

◆ RequestAndParse()

static object AnalyzeRe.API.RequestAndParse ( Type  deserializeType,
string  resource,
Method  method,
IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Perform a REST request on the server and serializes the response to the desired run-time type.

Parameters
deserializeTypeThe type to deserialize the JSON response to. Set to IRestResponse to bypass deserializing the request from JSON and return the response directly.
resourceThe path of the resource or request target, from the root server URL.
methodThe HTTP method to execute, as a RestSharp.Method enumeration value.
requestParametersThe data to include in the request, in the form of Rest parameters.
timeoutOptional - The desired request timeout (in milliseconds).
Returns
The server response, deserialized to the requested type.

Definition at line 481 of file API.Requests.cs.

◆ RequestAndParse< T >()

static T AnalyzeRe.API.RequestAndParse< T > ( string  resource,
Method  method,
IEnumerable< Parameter requestParameters = null,
int timeout = null 
)
inlinestatic

Perform a REST request on the server and serializes the response to the desired compile-time type.

Template Parameters
TThe type to deserialize the JSON response to. Set to IRestResponse to bypass deserializing the request from JSON and return the response directly.
Parameters
resourceThe path of the resource or request target, from the root server URL.
methodThe HTTP method to execute, as a RestSharp.Method enumeration value.
requestParametersThe data to include in the request, in the form of Rest parameters.
timeoutOptional - The desired request timeout (in milliseconds).
Returns
The server response, deserialized to the requested type.

Definition at line 456 of file API.Requests.cs.

◆ SearchResourceList()

static ICollectionResponse< IAPIResource > AnalyzeRe.API.SearchResourceList ( Type  resourceType,
string  searchTerms,
IEnumerable< Parameter requestParameters = null,
string  collectionNameOverride = null,
int timeout = null,
SearchType  searchType = SearchType::Basic 
)
inlinestatic

Get a collection of resources from the server that match the specified search criteria.

Parameters
resourceTypeThe type of resource (derived from IAPIResource).
searchTermsThe search term to pass on to the server.
requestParametersOptional - Additional parameters to include in the request.
collectionNameOverrideOptional - The new name of the collection to search from the server (if not using the default collection for the resource type T)
timeoutOptional - The desired request timeout (in milliseconds).
searchTypeOptional - Indicates the type of search to perform, affecting search target and query interpretation. (default: SearchType.Basic)
Returns
A List of APIResources of the type T provided matching the search criteria.

Definition at line 367 of file API.Requests.cs.

◆ SearchResourceList< T >()

static ICollectionResponse< T > AnalyzeRe.API.SearchResourceList< T > ( string  searchTerms,
IEnumerable< Parameter requestParameters = null,
string  collectionNameOverride = null,
int timeout = null,
SearchType  searchType = SearchType::Basic 
)
inlinestatic

Get a collection of resources from the server that match the specified search criteria.

Template Parameters
TThe type of resource (derived from IAPIResource).
Parameters
searchTermsThe search term to pass on to the server.
requestParametersOptional - Additional parameters to include in the request.
collectionNameOverrideOptional - The new name of the collection to search from the server (if not using the default collection for the resource type T)
timeoutOptional - The desired request timeout (in milliseconds).
searchTypeOptional - Indicates the type of search to perform, affecting search target and query interpretation. (default: SearchType.Basic) See Parameters.AdvancedSearch for details about advanced searching.
Returns
A List of APIResources of the type T provided matching the search criteria.
Type Constraints
T :IAPIResource 

Definition at line 335 of file API.Requests.cs.

◆ TryHandleAuthenticationErrors()

static bool AnalyzeRe.API.TryHandleAuthenticationErrors ( IRestResponse  response,
int  sequentialAttempts = 0 
)
inlinestatic

Checks an IRestResponse object for authentication errors, then invokes configured authentication delegates if the response was an "unauthorized" error.

When the AuthenticationRequested event has been handled, standard requests made via this client library that fail due to an authentication error will raise the event so that the user or client application can be prompted for credentials. The client library will then take care of automatically retrying the request with the supplied credentials.

The API.MaxRetries configuration property controls how many times the user will be prompted before the request fails permanently.

Parameters
responseThe response to check for authentication errors.
sequentialAttemptsThe number of times this same request has been attempted (to compare against the maximum allowed authentication retries)
Exceptions
AuthenticationExceptionRaises an AuthenticationException if authentication is requested, but there is no delegate configured to handle the request, or there is some other problem with the Authentication request.
Returns
Returns TRUE if the request was initially unauthorized and authentication was invoked, and so the request should be retried. Returns FALSE if the request did not contain an authentication error.

Definition at line 82 of file API.Authentication.cs.

◆ TryPromptForAuthentication()

static void AnalyzeRe.API.TryPromptForAuthentication ( )
inlinestatic

Invoke the AuthenticationRequested event, which requests authentication credentials for the server. Note: this will have no effect if already authenticated or authentication is not required for this server.

Definition at line 372 of file API.Authentication.cs.

Member Data Documentation

◆ Agents

readonly ResourceCollection<Agent> AnalyzeRe.API.Agents
static
Initial value:
=
new ResourceCollection<Agent>(Agent.CLASS_COLLECTION_NAME)

The collection of Agents on the server.

Definition at line 16 of file API.Collections.cs.

◆ Analyses

readonly ResourceCollection<Analysis> AnalyzeRe.API.Analyses
static
Initial value:
=
new ResourceCollection<Analysis>(Analysis.CLASS_COLLECTION_NAME)

The collection of Analyses on the server.

Definition at line 22 of file API.Collections.cs.

◆ AnalysisProfiles

readonly ResourceCollection<AnalysisProfile> AnalyzeRe.API.AnalysisProfiles
static
Initial value:
=
new ResourceCollection<AnalysisProfile>(AnalysisProfile.CLASS_COLLECTION_NAME)

The collection of AnalysisProfiles on the server.

Definition at line 26 of file API.Collections.cs.

◆ AnalyzeReCustomServerHeader

readonly string AnalyzeRe.API.AnalyzeReCustomServerHeader = "ARE-Server"
static

The Custom Server Header returned by valid AnalyzeRe servers.

Definition at line 22 of file API.Configuration.cs.

◆ AnalyzeReServerIdentity

readonly string AnalyzeRe.API.AnalyzeReServerIdentity = "ARE-API"
static

The Server identity returned by valid AnalyzeRe servers.

Definition at line 19 of file API.Configuration.cs.

◆ DateTimeFormat

readonly string AnalyzeRe.API.DateTimeFormat = @"O"
static

The format used when transmitting DateTime information to Analyze Re servers.

Definition at line 25 of file API.Configuration.cs.

◆ Distributions

readonly ResourceCollection<IDistribution> AnalyzeRe.API.Distributions
static
Initial value:
=
new ResourceCollection<IDistribution>(Distribution.CLASS_COLLECTION_NAME)

The collection of Distributions on the server.

Definition at line 30 of file API.Collections.cs.

◆ EventCatalogs

readonly ResourceCollection<EventCatalog> AnalyzeRe.API.EventCatalogs
static
Initial value:
=
new ResourceCollection<EventCatalog>(EventCatalog.CLASS_COLLECTION_NAME)

The collection of EventCatalogs on the server.

Definition at line 34 of file API.Collections.cs.

◆ ExchangeRateProfiles

readonly ResourceCollection<ExchangeRateProfile> AnalyzeRe.API.ExchangeRateProfiles
static
Initial value:
=
new ResourceCollection<ExchangeRateProfile>(ExchangeRateProfile.CLASS_COLLECTION_NAME)

The collection of ExchangeRateProfiles on the server.

Definition at line 38 of file API.Collections.cs.

◆ ExchangeRateTables

readonly ResourceCollection<ExchangeRateTable> AnalyzeRe.API.ExchangeRateTables
static
Initial value:
=
new ResourceCollection<ExchangeRateTable>(ExchangeRateTable.CLASS_COLLECTION_NAME)

The collection of ExchangeRateTables on the server.

Definition at line 42 of file API.Collections.cs.

◆ Files

readonly ResourceCollection<DataFile> AnalyzeRe.API.Files
static
Initial value:
=
new ResourceCollection<DataFile>(DataFile.CLASS_COLLECTION_NAME)

The collection of Files on the server.

Definition at line 46 of file API.Collections.cs.

◆ Layers

readonly ResourceCollection<ILayer> AnalyzeRe.API.Layers
static
Initial value:
=
new ResourceCollection<ILayer>(Layer.CLASS_COLLECTION_NAME)

The collection of Layers on the server.

Definition at line 54 of file API.Collections.cs.

◆ LayerViews

readonly ResourceCollection<ILayerView> AnalyzeRe.API.LayerViews
static
Initial value:
=
new ResourceCollection<ILayerView>(AnalyzeRe.LayerViews.CLASS_COLLECTION_NAME)
LayerView factory class.
Definition LayerViews.cs:9
static readonly string CLASS_COLLECTION_NAME
The collection endpoint at which resources of this type reside on the server.
Definition LayerViews.cs:11

The collection of LayerViews on the server.

Definition at line 50 of file API.Collections.cs.

◆ LossFilters

readonly ResourceCollection<LossFilter> AnalyzeRe.API.LossFilters
static
Initial value:
=
new ResourceCollection<LossFilter>(LossFilter.CLASS_COLLECTION_NAME)

The collection of LossFilters on the server.

Definition at line 58 of file API.Collections.cs.

◆ LossSets

readonly ResourceCollection<LossSet> AnalyzeRe.API.LossSets
static
Initial value:
=
new ResourceCollection<LossSet>(LossSet.CLASS_COLLECTION_NAME)

The collection of LossSets on the server.

Definition at line 62 of file API.Collections.cs.

◆ MaxRequestRetries

volatile int AnalyzeRe.API.MaxRequestRetries = 3
static

When a temporary communication failure occurs (such as a socket error or an authentication failure for which there is a handler) this property determines how many times the client will automatically retry the same request before returning the error.

Definition at line 93 of file API.Configuration.cs.

◆ MetricsFunctions

readonly ResourceCollection<MetricsFunction> AnalyzeRe.API.MetricsFunctions
static
Initial value:
=
new ResourceCollection<MetricsFunction>(MetricsFunction.CLASS_COLLECTION_NAME)

The collection of optimization metrics functions on the server.

Definition at line 74 of file API.Collections.cs.

◆ OptimizationViews

readonly ResourceCollection<OptimizationView> AnalyzeRe.API.OptimizationViews
static
Initial value:
=
new ResourceCollection<OptimizationView>(OptimizationView.CLASS_COLLECTION_NAME)

The collection of OptimizationViews on the server.

Definition at line 66 of file API.Collections.cs.

◆ Portfolios

readonly ResourceCollection<Portfolio> AnalyzeRe.API.Portfolios
static
Initial value:
=
new ResourceCollection<Portfolio>(Portfolio.CLASS_COLLECTION_NAME)

The collection of Portfolios on the server.

Definition at line 82 of file API.Collections.cs.

◆ PortfolioViews

readonly ResourceCollection<PortfolioView> AnalyzeRe.API.PortfolioViews
static
Initial value:
=
new ResourceCollection<PortfolioView>(PortfolioView.CLASS_COLLECTION_NAME)

The collection of PortfolioViews on the server.

Definition at line 78 of file API.Collections.cs.

◆ ProjectionFunctions

readonly ResourceCollection<ProjectionFunction> AnalyzeRe.API.ProjectionFunctions
static
Initial value:
=
new ResourceCollection<ProjectionFunction>(ProjectionFunction.CLASS_COLLECTION_NAME)

The collection of optimization projection functions on the server.

Definition at line 70 of file API.Collections.cs.

◆ Simulations

readonly ResourceCollection<Simulation> AnalyzeRe.API.Simulations
static
Initial value:
=
new ResourceCollection<Simulation>(Simulation.CLASS_COLLECTION_NAME)

The collection of Simulations on the server.

Definition at line 86 of file API.Collections.cs.

Property Documentation

◆ AuthenticationToken

IAccessToken AnalyzeRe.API.AuthenticationToken
staticgetset

The AccessToken storing authentication information for requests made to the server.

Definition at line 48 of file API.Authentication.cs.

◆ DefaultRequestTimeout

int AnalyzeRe.API.DefaultRequestTimeout
staticgetset

The default timeout used for all simple server requests, in milliseconds.

Note: If ManagedSettingsEnabled (by default it is), changing this default has the side-effect of storing the user-setting permanently on the client machine.

Definition at line 120 of file API.Configuration.cs.

◆ DefaultRequestTimeoutCollections

int AnalyzeRe.API.DefaultRequestTimeoutCollections
staticgetset

The default timeout used when requesting a resource collection from the server, in milliseconds.

Note: If ManagedSettingsEnabled (by default it is), changing this default has the side-effect of storing the user-setting permanently on the client machine.

Definition at line 142 of file API.Configuration.cs.

◆ DefaultServerURL

string AnalyzeRe.API.DefaultServerURL
staticget

The Default ServerURL the API is instantiated with, as configured in the settings.

Note: Unlike some other default settings, this setting cannot be modified using this property. To change the default Server URL for all Analyze Re applications on this machine, you should configure the appropriate Settings.Default attribute.

Definition at line 210 of file API.Configuration.cs.

◆ ManagedSettingsEnabled

bool AnalyzeRe.API.ManagedSettingsEnabled = true
staticgetset

By Default, the Analyze Re Client Library will automatically save and restore certain configured settings such as timeouts and credentials. Set this to false to disable these features (for instance if they cause issues for your application).

Definition at line 98 of file API.Configuration.cs.

◆ Parallelism

int AnalyzeRe.API.Parallelism
staticgetset

The maximum number of concurrent requests that can be made.

Note: Unlike many other settings, this setting is not stored to the client's local machine. To change the default degree of parallelism for all Analyze Re applications on this machine, you should configure the appropriate Settings.Default attribute.

Definition at line 104 of file API.Configuration.cs.

◆ ServerURL

string AnalyzeRe.API.ServerURL
staticgetset

The default server URL to be used for all API requests. On change, voids the current cached authentication credentials.

Note: If ManagedSettingsEnabled (by default it is), changing this default has the side-effect of storing the user-setting permanently on the client machine.

Warning: This property has side effects: When changed, the client will:

  1. Unset the current AuthenticationToken (even if it may have been valid against the new server)
  2. Check the settings (if enabled) for any cached credentials for the new server URL.

Definition at line 167 of file API.Configuration.cs.

◆ UserAgent

string AnalyzeRe.API.UserAgent
staticgetset

The UserAgent identifying the requests made by this client. This can be changed if an application wishes to better identify itself to the server.

Definition at line 78 of file API.Configuration.cs.

Event Documentation

◆ AuthenticationRequested

AuthenticationRequestedHandler AnalyzeRe.API.AuthenticationRequested
static

An event that fires whenever authentication is requested by the server. This event can be used to prompt a user or other external source for credentials as needed, rather than hard-coding them into the application.

TODO: Authentication Requested event mechanism is flawed and should be revisited This should be a Func{args, IAccessToken} for which there is at most one implementation per instance. This is currently muddied by the API being a static class (i.e. singleton). For now, suppress the code analysis warning about event handlers.

Definition at line 44 of file API.Authentication.cs.


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