Class APIClient#

Inheritance Relationships#

Base Type#

Class Documentation#

class xbe.sdk.APIClient : xbe.sdk.AbstractAPIClient#

Provides a lightweight wrapper for the .NET HttpClient that can perform automatic serialization, header assignment and automatic request retries.

Public Functions

APIClient (Configuration configuration)#
APIClient (Configuration configuration, HttpClient httpClient)
override async Task<HttpResponseMessage> Send (string url, HttpMethod method, Dictionary<string, string> query = null, Dictionary<string, string> headers = null, int retryDelay = 250, int retryCount = 0)#

Sends an HTTP/S request to the given url using the specified method, query and headers.

Tparam T:

The type of data that is expected to be returned.

Param url:

The url to send the request to.

Param method:

The HTTP method to perform.

Param query:

The optional map containing the query parameters that will be appended to the url.

Param headers:

The optional headers that will be appended to the HTTP request.

Return:

override async Task<HttpResponseMessage> Send (string url, HttpMethod method, string body, Dictionary<string, string> query = null, Dictionary<string, string> headers = null, int retryDelay = 250, int retryCount = 0)

Sends an HTTP/S request to the given url using the specified method, query and headers.

Tparam T:

The type of data that is expected to be returned.

Param url:

The url to send the request to.

Param method:

The HTTP method to perform.

Param body:

The optional body to send with the request.

Param query:

The optional map containing the query parameters that will be appended to the url.

Param headers:

The optional headers that will be appended to the HTTP request.

Param retryDelay:

The length of time, in milliseconds, to wait before the next retry occurs on internal server failure.

Param retryCount:

The current retry count.

Return:

override async Task<T> Send<T> (string url, HttpMethod method, string body = null, Dictionary<string, string> query = null, Dictionary<string, string> headers = null, int retryDelay = 250, int retryCount = 0)

Sends an HTTP/S request to the given url using the specified method, query and headers.

Tparam T:

The type of data that is expected to be returned.

Param url:

The url to send the request to.

Param method:

The HTTP method to perform.

Param body:

The optional body to send with the request.

Param query:

The optional map containing the query parameters that will be appended to the url.

Param headers:

The optional headers that will be appended to the HTTP request.

Param retryDelay:

The length of time, in milliseconds, to wait before the next retry occurs on internal server failure.

Param retryCount:

The current retry count.

Return:

override async Task<List<T>> SendAndGetList<T> (string url, HttpMethod method, string body = null, Dictionary<string, string> query = null, Dictionary<string, string> headers = null, int retryDelay = 250, int retryCount = 0)#

Sends an HTTP/S request to the given url using the specified method, query and headers.

Tparam T:

The type of data that is expected to be returned.

Param url:

The url to send the request to.

Param method:

The HTTP method to perform.

Param body:

The optional body to send with the request.

Param query:

The optional map containing the query parameters that will be appended to the url.

Param headers:

The optional headers that will be appended to the HTTP request.

Param retryDelay:

The length of time, in milliseconds, to wait before the next retry occurs on internal server failure.

Param retryCount:

The current retry count.

Return: