Class AbstractAPIClient#

Inheritance Relationships#

Base Type#

  • public xbe.sdk.IAPIClient (exhale_interface_interfacexbe_1_1sdk_1_1IAPIClient)

Derived Type#

Class Documentation#

class xbe.sdk.AbstractAPIClient : xbe.sdk.IAPIClient#

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

Subclassed by xbe.sdk.APIClient

Public Functions

AbstractAPIClient (Configuration configuration)#
AbstractAPIClient (Configuration configuration, HttpClient httpClient)
Task Delete (string url, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP DELETE request to the given url using the specified optional 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 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:

async Task<long?> Head (string url, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP HEAD request to the given url using the specified optional query and headers.

Param url:

The url to send the request to.

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:

The content-length of the resource at the given url.

Task Get (string url, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP GET request to the given url using the specified optional 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 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:

Task<T> Get<T> (string url, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)

Sends an HTTP GET request to the given url using the specified optional 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 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:

Task<List<T>> GetList<T> (string url, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP GET request to the given url using the specified optional 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 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:

Task<T> Options<T> (string url, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP OPTIONS request to the given url using the specified optional 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 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:

Task<T> Post<T> (string url, string body, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP POST request to the given url using the specified optional 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 body:

The 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.

Return:

Task<T> Post<T> (string url, T body, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)

Sends an HTTP POST request to the given url using the specified optional 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 body:

The 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.

Return:

Task<T> Put<T> (string url, string body, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)#

Sends an HTTP PUT request to the given url using the specified optional 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 body:

The 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.

Return:

Task<T> Put<T> (string url, T body, Dictionary<string, string> query = null, Dictionary<string, string> headers = null)

Sends an HTTP PUT request to the given url using the specified optional query and headers.

Object

Tparam T:

The type of data that is expected to be returned.

Param url:

The url to send the request to.

Param body:

The 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.

Return:

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.

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:

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:

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:

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:

Protected Attributes

Configuration configuration#
HttpClientHandler handler#
HttpClient httpClient#