Interface IRestClient
Represents a REST API client able to do basic HTTP requests and return response data.
Namespace: Colore.Rest
Assembly: Colore.dll
Syntax
public interface IRestClient
Properties
BaseAddress
Gets or sets the base address where calls will be routed.
Declaration
Uri BaseAddress { get; set; }
Property Value
Type | Description |
---|---|
Uri |
Methods
DeleteAsync<T>(String)
Performs a DELETE request to the specified resource.
Declaration
Task<IRestResponse<T>> DeleteAsync<T>(string resource)
Parameters
Type | Name | Description |
---|---|---|
String | resource | Resource path. |
Returns
Type | Description |
---|---|
Task<IRestResponse<T>> | An instance of IRestResponse<TData>. |
Type Parameters
Name | Description |
---|---|
T | The type of response to expect. |
DeleteAsync<T>(String, Object)
Performs a DELETE request to the specified resource with the provided data.
Declaration
Task<IRestResponse<T>> DeleteAsync<T>(string resource, object data)
Parameters
Type | Name | Description |
---|---|---|
String | resource | Resource path. |
Object | data | Request data. |
Returns
Type | Description |
---|---|
Task<IRestResponse<T>> | An instance of IRestResponse<TData>. |
Type Parameters
Name | Description |
---|---|
T | The type of response to expect. |
PostAsync<T>(String, Object)
Performs a POST request to the specified resource with the provided data.
Declaration
Task<IRestResponse<T>> PostAsync<T>(string resource, object data)
Parameters
Type | Name | Description |
---|---|---|
String | resource | Resource path. |
Object | data | Request data. |
Returns
Type | Description |
---|---|
Task<IRestResponse<T>> | An instance of IRestResponse<TData>. |
Type Parameters
Name | Description |
---|---|
T | The type of response to expect. |
PutAsync<T>(String)
Performs a PUT request to the specified resource without any data.
Declaration
Task<IRestResponse<T>> PutAsync<T>(string resource)
Parameters
Type | Name | Description |
---|---|---|
String | resource | Resource path. |
Returns
Type | Description |
---|---|
Task<IRestResponse<T>> | An instance of IRestResponse<TData>. |
Type Parameters
Name | Description |
---|---|
T | The type of response to expect. |
PutAsync<T>(String, Object)
Performs a PUT request to the specified resource with the provided data.
Declaration
Task<IRestResponse<T>> PutAsync<T>(string resource, object data)
Parameters
Type | Name | Description |
---|---|---|
String | resource | Resource path. |
Object | data | Request data. |
Returns
Type | Description |
---|---|
Task<IRestResponse<T>> | An instance of IRestResponse<TData>. |
Type Parameters
Name | Description |
---|---|
T | The type of response to expect. |