Class HttpClientManagementConnection
- Namespace
- Auth0.ManagementApi
- Assembly
- Auth0.ManagementApi.dll
Implements IManagementConnection using HttpClient.
public class HttpClientManagementConnection : IManagementConnection, IDisposable
- Inheritance
-
HttpClientManagementConnection
- Implements
- Inherited Members
Constructors
HttpClientManagementConnection(HttpClient, HttpClientManagementConnectionOptions)
Initializes a new instance of the HttpClientManagementConnection class.
public HttpClientManagementConnection(HttpClient httpClient = null, HttpClientManagementConnectionOptions options = null)
Parameters
httpClient
HttpClientOptional HttpClient to use. If not specified one will be created and be used for all requests made by this instance.
options
HttpClientManagementConnectionOptionsOptional HttpClientManagementConnectionOptions to use.
HttpClientManagementConnection(HttpMessageHandler, HttpClientManagementConnectionOptions)
Initializes a new instance of the HttpClientManagementConnection class.
public HttpClientManagementConnection(HttpMessageHandler handler, HttpClientManagementConnectionOptions options = null)
Parameters
handler
HttpMessageHandlerHttpMessageHandler to use with the managed HttpClient that will be created and used for all requests made by this instance.
options
HttpClientManagementConnectionOptionsOptional HttpClientManagementConnectionOptions to use.
Methods
Dispose()
Disposes of any owned disposable resources such as the underlying HttpClient if owned.
public void Dispose()
Dispose(bool)
Disposes of any owned disposable resources such as the underlying HttpClient if owned.
protected virtual void Dispose(bool disposing)
Parameters
GetAsync<T>(Uri, IDictionary<string, string>, JsonConverter[], CancellationToken)
Perform a HTTP GET operation against a given Uri and return the materialized response body as T.
public Task<T> GetAsync<T>(Uri uri, IDictionary<string, string> headers, JsonConverter[] converters = null, CancellationToken cancellationToken = default)
Parameters
uri
UriUri to perform the GET request against.
headers
IDictionary<string, string>Dictionary containing additional headers that may override the defaults.
converters
JsonConverter[]Optional array of Newtonsoft.Json.JsonConverters used to deserialize the resulting T.
cancellationToken
CancellationTokenThe cancellation token to cancel operation.
Returns
Type Parameters
T
Type of object to deserialize the result content as.
SendAsync<T>(HttpMethod, Uri, object, IDictionary<string, string>, IList<FileUploadParameter>, JsonConverter[], CancellationToken)
Perform a HTTP operation against a given Uri and return any materialized response body as T.
public Task<T> SendAsync<T>(HttpMethod method, Uri uri, object body, IDictionary<string, string> headers, IList<FileUploadParameter> files = null, JsonConverter[] converters = null, CancellationToken cancellationToken = default)
Parameters
method
HttpMethodHttpMethod to use in performing the request.
uri
UriUri to perform the request against.
body
objectPayload to send to the server. If specified as a Dictionary<string, string> then FormUrlEncodedContent is expected, otherwise StringContent containing the JSON representation of the object is expected.
headers
IDictionary<string, string>Dictionary containing additional headers that may override the defaults.
files
IList<FileUploadParameter>Optional IList<T> containing file contents to upload as a MultipartFormDataContent post.
converters
JsonConverter[]Optional array of Newtonsoft.Json.JsonConverters used to deserialize the resulting T.
cancellationToken
CancellationTokenThe cancellation token to cancel operation.
Returns
Type Parameters
T
Type of object to deserialize the result content as.
Remarks
files
can only be specified if body
is a Dictionary%lt;string, object%gt;"/>.