Class DynamicRestClient
A rest client that uses dynamic objects for invocation and result values. Strongly typed methods are for dynamic binding purposes only. Aside from construction, there is little or no need to interact with this type as anything other than a dynamic object.
Inherited Members
Namespace: DynamicRestProxy.PortableHttpClient
Assembly: DynamicRestProxy.NetStandard.dll
Syntax
public sealed class DynamicRestClient : RestProxy, IDynamicMetaObjectProvider, IDisposable
Constructors
| Improve this Doc View SourceDynamicRestClient(HttpClient, Boolean, Func<HttpRequestMessage, CancellationToken, Task>)
ctor
Declaration
public DynamicRestClient(HttpClient client, bool disposeClient = false, Func<HttpRequestMessage, CancellationToken, Task> configureRequest = null)
Parameters
| Type | Name | Description |
|---|---|---|
| HttpClient | client | HttpClient to use for communication |
| Boolean | disposeClient | Flag indicating whether to take ownership of the client instance and dispose of when this instance is disposed |
| System.Func<HttpRequestMessage, CancellationToken, Task> | configureRequest | A callback function that will be called just before any request is sent |
DynamicRestClient(String, DynamicRestClientDefaults, Func<HttpRequestMessage, CancellationToken, Task>)
ctor
Declaration
public DynamicRestClient(string baseUri, DynamicRestClientDefaults defaults = null, Func<HttpRequestMessage, CancellationToken, Task> configureRequest = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | baseUri | The root url for all requests |
| DynamicRestClientDefaults | defaults | Default values to add to all requests |
| System.Func<HttpRequestMessage, CancellationToken, Task> | configureRequest | A callback function that will be called just before any request is sent |
DynamicRestClient(String, HttpMessageHandler, Boolean, DynamicRestClientDefaults, Func<HttpRequestMessage, CancellationToken, Task>)
ctor
Declaration
public DynamicRestClient(string baseUri, HttpMessageHandler handler, bool disposeHandler = false, DynamicRestClientDefaults defaults = null, Func<HttpRequestMessage, CancellationToken, Task> configureRequest = null)
Parameters
| Type | Name | Description |
|---|---|---|
| String | baseUri | The root url for all requests |
| HttpMessageHandler | handler | HttpMessageHandler to use for communication |
| Boolean | disposeHandler | Flag indicating whether to take ownership of the handler instance and dispose of when this instance is disposed |
| DynamicRestClientDefaults | defaults | Default values to add to all requests |
| System.Func<HttpRequestMessage, CancellationToken, Task> | configureRequest | A callback function that will be called just before any request is sent |
DynamicRestClient(Uri, DynamicRestClientDefaults, Func<HttpRequestMessage, CancellationToken, Task>)
ctor
Declaration
public DynamicRestClient(Uri baseUri, DynamicRestClientDefaults defaults = null, Func<HttpRequestMessage, CancellationToken, Task> configureRequest = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | baseUri | The root url for all requests |
| DynamicRestClientDefaults | defaults | Default values to add to all requests |
| System.Func<HttpRequestMessage, CancellationToken, Task> | configureRequest | A callback function that will be called just before any request is sent |
DynamicRestClient(Uri, HttpMessageHandler, Boolean, DynamicRestClientDefaults, Func<HttpRequestMessage, CancellationToken, Task>)
ctor
Declaration
public DynamicRestClient(Uri baseUri, HttpMessageHandler handler, bool disposeHandler = false, DynamicRestClientDefaults defaults = null, Func<HttpRequestMessage, CancellationToken, Task> configureRequest = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | baseUri | The root url for all requests |
| HttpMessageHandler | handler | HttpMessageHandler to use for communication |
| Boolean | disposeHandler | Flag indicating whether to take ownership of the handler instance and dispose of when this instance is disposed |
| DynamicRestClientDefaults | defaults | Default values to add to all requests |
| System.Func<HttpRequestMessage, CancellationToken, Task> | configureRequest | A callback function that will be called just before any request is sent |
Properties
| Improve this Doc View SourceBaseUri
Declaration
protected override Uri BaseUri { get; }
Property Value
| Type | Description |
|---|---|
| Uri |
Overrides
Methods
| Improve this Doc View SourceCreateProxyNode(RestProxy, String)
Declaration
protected override RestProxy CreateProxyNode(RestProxy parent, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| RestProxy | parent | |
| String | name |
Returns
| Type | Description |
|---|---|
| RestProxy |
Overrides
| Improve this Doc View SourceCreateVerbAsyncTask<T>(String, IEnumerable<Object>, IEnumerable<KeyValuePair<String, Object>>, CancellationToken, JsonSerializerSettings)
Declaration
protected override Task<T> CreateVerbAsyncTask<T>(string verb, IEnumerable<object> unnamedArgs, IEnumerable<KeyValuePair<string, object>> namedArgs, CancellationToken cancelToken, JsonSerializerSettings serializationSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| String | verb | |
| System.Collections.Generic.IEnumerable<Object> | unnamedArgs | |
| System.Collections.Generic.IEnumerable<KeyValuePair<String, Object>> | namedArgs | |
| CancellationToken | cancelToken | |
| Newtonsoft.Json.JsonSerializerSettings | serializationSettings |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<T> |
Type Parameters
| Name | Description |
|---|---|
| T |
Overrides
| Improve this Doc View SourceDispose()
Disposes the contained HttpClient
Declaration
public void Dispose()