Class ServiceHttpClientExtensions
Helper methods for IServiceHttpClient.
Inherited Members
Namespace: Unity.Cloud.Common
Syntax
public static class ServiceHttpClientExtensions
Methods
DeleteAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, String, ServiceHttpClientOptions)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, string requestUri, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, String, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, string requestUri, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, String, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, string requestUri, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, Uri requestUri, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, Uri requestUri, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
DeleteAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous DELETE request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> DeleteAsync(this IServiceHttpClient httpClient, Uri requestUri, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
GetAsync(IServiceHttpClient, String, ServiceHttpClientOptions)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> GetAsync(this IServiceHttpClient httpClient, string requestUri, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
GetAsync(IServiceHttpClient, String, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> GetAsync(this IServiceHttpClient httpClient, string requestUri, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
GetAsync(IServiceHttpClient, String, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> GetAsync(this IServiceHttpClient httpClient, string requestUri, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> GetAsync(this IServiceHttpClient httpClient, Uri requestUri, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> GetAsync(this IServiceHttpClient httpClient, Uri requestUri, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
GetAsync(IServiceHttpClient, Uri, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> GetAsync(this IServiceHttpClient httpClient, Uri requestUri, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PatchAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous PATCH request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PatchAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PatchAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous PATCH request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PatchAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PatchAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous PATCH request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PatchAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous PATCH request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PatchAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous PATCH request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PatchAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PatchAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous PATCH request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PatchAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PostAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous POST request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PostAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PostAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous POST request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PostAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PostAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous POST request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PostAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous POST request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PostAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous POST request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PostAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PostAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous POST request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PostAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PutAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous PUT request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PutAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PutAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous PUT request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PutAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PutAsync(IServiceHttpClient, String, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous PUT request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PutAsync(this IServiceHttpClient httpClient, string requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
String | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions)
Sends an asynchronous PUT request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PutAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, HttpCompletionOption, IProgress<HttpProgress>, CancellationToken)
Sends an asynchronous PUT request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PutAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, HttpCompletionOption completionOption, IProgress<HttpProgress> progress, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
IProgress<HttpProgress> | progress | The progress provider. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
PutAsync(IServiceHttpClient, Uri, HttpContent, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous PUT request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> PutAsync(this IServiceHttpClient httpClient, Uri requestUri, HttpContent content, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
Uri | requestUri | The uri for the request. |
HttpContent | content | The HTTP content for the request. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> SendAsync(this IServiceHttpClient httpClient, HttpRequestMessage request, ServiceHttpClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
HttpRequestMessage | request | The request to be sent. |
ServiceHttpClientOptions | options | The options for the client. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> SendAsync(this IServiceHttpClient httpClient, HttpRequestMessage request, ServiceHttpClientOptions options, HttpCompletionOption completionOption)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
HttpRequestMessage | request | The request to be sent. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, HttpCompletionOption, CancellationToken)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> SendAsync(this IServiceHttpClient httpClient, HttpRequestMessage request, ServiceHttpClientOptions options, HttpCompletionOption completionOption, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
HttpRequestMessage | request | The request to be sent. |
ServiceHttpClientOptions | options | The options for the client. |
HttpCompletionOption | completionOption | When the operation should complete. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
SendAsync(IServiceHttpClient, HttpRequestMessage, ServiceHttpClientOptions, CancellationToken)
Sends an asynchronous GET request to the specified Uri.
Declaration
public static Task<HttpResponseMessage> SendAsync(this IServiceHttpClient httpClient, HttpRequestMessage request, ServiceHttpClientOptions options, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | httpClient | The HTTP client. |
HttpRequestMessage | request | The request to be sent. |
ServiceHttpClientOptions | options | The options for the client. |
CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<HttpResponseMessage> |
Exceptions
Type | Condition |
---|---|
ArgumentException | Thrown when the requestUri is invalid. |
HttpRequestException | Thrown when an HTTP response can't be obtained from the server. |
TaskCanceledException | Thrown when the request is cancelled by a cancellation token. |
TimeoutException | Thrown when the request failed due to timeout. |
WithApiSourceHeaders(IServiceHttpClient, String, String)
Creates an instance of Unity.Cloud.Common.ServiceHttpClientHeaderModifier which adds the API source headers to each request.
Declaration
public static IServiceHttpClient WithApiSourceHeaders(this IServiceHttpClient baseServiceHttpClient, string name, string version)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | baseServiceHttpClient | The client for which to modify the request headers. |
String | name | The API source name. |
String | version | The API source version. |
Returns
Type | Description |
---|---|
IServiceHttpClient | The created Unity.Cloud.Common.ServiceHttpClientHeaderModifier. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown is |
WithApiSourceHeadersFromAssembly(IServiceHttpClient, Assembly)
Creates an instance of Unity.Cloud.Common.ServiceHttpClientHeaderModifier which adds the API source headers to each request. The source values are retrieved from the ApiSourceVersionAttribute which must be defined in the calling Assembly.
Declaration
public static IServiceHttpClient WithApiSourceHeadersFromAssembly(this IServiceHttpClient baseServiceHttpClient, Assembly assembly)
Parameters
Type | Name | Description |
---|---|---|
IServiceHttpClient | baseServiceHttpClient | The client for which to modify the request headers. |
Assembly | assembly | The target assembly. |
Returns
Type | Description |
---|---|
IServiceHttpClient | The created Unity.Cloud.Common.ServiceHttpClientHeaderModifier. |
Remarks
An instance of the ApiSourceVersionAttribute must be defined at the assembly-level in the calling Assembly in order for the correct API source values to be added as a header.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | Thrown if |
InvalidOperationException | Thrown if ApiSourceVersionAttribute does not exist or is not initialized in the calling assembly. |
InvalidArgumentException | Thrown if ApiSourceVersionAttribute is initialized with null or empty values in the calling assembly. |