Class CelerikHttpClient
HttpClient to call services implementing the Celerik Api Protocol. The protocol is simple: all http body responses have: Data, Message, MessageType and Success.
Inheritance
Inherited Members
Namespace: Celerik.NetCore.HttpClient
Assembly: cs.temp.dll.dll
Syntax
public class CelerikHttpClient
Constructors
CelerikHttpClient(Net.Http.HttpClient)
Initializes a new instance of the class.
Declaration
public CelerikHttpClient(Net.Http.HttpClient httpClient)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Net.Http.HttpClient | httpClient | Reference to the current HttpClient. |
Methods
SendAsync<TData, TStatusCode>(HttpMethod, String, String, CancellationToken, Object)
Sends an HTTP request as an asynchronous operation.
Declaration
public Task<ApiResponse<TData, TStatusCode>> SendAsync<TData, TStatusCode>(HttpMethod method, string controller, string endpoint, CancellationToken cancellationToken, object payload = null)
where TData : class where TStatusCode : struct, IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| HttpMethod | method | The Http Method: DELETE, GET, POST, PUT. |
| System.String | controller | The name of the controller this client points to. |
| System.String | endpoint | The name of the endpoint method this client points to. |
| CancellationToken | cancellationToken | The cancellation token to cancel operation. |
| System.Object | payload | Arguments of the service. |
Returns
| Type | Description |
|---|---|
| Task<ApiResponse<TData, TStatusCode>> | The task object representing the asynchronous operation. |
Type Parameters
| Name | Description |
|---|---|
| TData | Type of the Data property. |
| TStatusCode | Type of the StatusCode poperty. |
SendAsync<TData, TStatusCode>(HttpMethod, String, String, HttpCompletionOption, CancellationToken, Object)
Sends an HTTP request as an asynchronous operation.
Declaration
public Task<ApiResponse<TData, TStatusCode>> SendAsync<TData, TStatusCode>(HttpMethod method, string controller, string endpoint, HttpCompletionOption completionOption, CancellationToken cancellationToken, object payload = null)
where TData : class where TStatusCode : struct, IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| HttpMethod | method | The Http Method: DELETE, GET, POST, PUT. |
| System.String | controller | The name of the controller this client points to. |
| System.String | endpoint | The name of the endpoint method this client points to. |
| HttpCompletionOption | completionOption | When the operation should complete (as soon as a response is available or after reading the whole response content). |
| CancellationToken | cancellationToken | The cancellation token to cancel operation. |
| System.Object | payload | Arguments of the service. |
Returns
| Type | Description |
|---|---|
| Task<ApiResponse<TData, TStatusCode>> | The task object representing the asynchronous operation. |
Type Parameters
| Name | Description |
|---|---|
| TData | Type of the Data property. |
| TStatusCode | Type of the StatusCode poperty. |
SendAsync<TData, TStatusCode>(HttpMethod, String, String, HttpCompletionOption, Object)
Sends an HTTP request as an asynchronous operation.
Declaration
public Task<ApiResponse<TData, TStatusCode>> SendAsync<TData, TStatusCode>(HttpMethod method, string controller, string endpoint, HttpCompletionOption completionOption, object payload = null)
where TData : class where TStatusCode : struct, IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| HttpMethod | method | The Http Method: DELETE, GET, POST, PUT. |
| System.String | controller | The name of the controller this client points to. |
| System.String | endpoint | The name of the endpoint method this client points to. |
| HttpCompletionOption | completionOption | When the operation should complete (as soon as a response is available or after reading the whole response content). |
| System.Object | payload | Arguments of the service. |
Returns
| Type | Description |
|---|---|
| Task<ApiResponse<TData, TStatusCode>> | The task object representing the asynchronous operation. |
Type Parameters
| Name | Description |
|---|---|
| TData | Type of the Data property. |
| TStatusCode | Type of the StatusCode poperty. |
SendAsync<TData, TStatusCode>(HttpMethod, String, String, Object)
Sends an HTTP request as an asynchronous operation.
Declaration
public Task<ApiResponse<TData, TStatusCode>> SendAsync<TData, TStatusCode>(HttpMethod method, string controller, string endpoint, object payload = null)
where TData : class where TStatusCode : struct, IConvertible
Parameters
| Type | Name | Description |
|---|---|---|
| HttpMethod | method | The Http Method: DELETE, GET, POST, PUT. |
| System.String | controller | The name of the controller this client points to. |
| System.String | endpoint | The name of the endpoint method this client points to. |
| System.Object | payload | Arguments of the service. |
Returns
| Type | Description |
|---|---|
| Task<ApiResponse<TData, TStatusCode>> | The task object representing the asynchronous operation. |
Type Parameters
| Name | Description |
|---|---|
| TData | Type of the Data property. |
| TStatusCode | Type of the StatusCode poperty. |