Class ApiRequestBaseExtensions
Extends the ApiRequestBase class with default extension methods provided by the library.
Namespace: ReqRest
Assembly: ReqRest.dll
Syntax
public static class ApiRequestBaseExtensions
Methods
SetHttpClientProvider<T>(T, Func<HttpClient>)
Sets the HttpClientProvider function which returns an HttpClient instance which will ultimately be used to send the HttpRequestMessage for executing the API request.
Declaration
public static T SetHttpClientProvider<T>(this T request, Func<HttpClient> httpClientProvider)
where T : ApiRequestBase
Parameters
Type | Name | Description |
---|---|---|
T | request | The request. |
Func<HttpClient> | httpClientProvider | A function which returns an HttpClient instance which will ultimately be used to send the HttpRequestMessage for executing the API request. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the request. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
SetHttpClientProvider<T>(T, HttpClient)
Sets the HttpClientProvider function to a function
which returns the specified httpClient
.
Declaration
public static T SetHttpClientProvider<T>(this T request, HttpClient httpClient)
where T : ApiRequestBase
Parameters
Type | Name | Description |
---|---|---|
T | request | The request. |
HttpClient | httpClient | An HttpClient instance which will ultimately be used to send the HttpRequestMessage for executing the API request. |
Returns
Type | Description |
---|---|
T | The specified |
Type Parameters
Name | Description |
---|---|
T | The type of the request. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|