Class UriActionExtensions
Uri extension which perform an action
Inheritance
Inherited Members
Namespace: Dapplo.HttpExtensions
Assembly: Dapplo.HttpExtensions.dll
Syntax
public static class UriActionExtensions
Methods
| Improve this Doc View SourceDeleteAsync(Uri, CancellationToken)
Method to Delete content
Declaration
public static Task DeleteAsync(this Uri uri, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to send the delete to |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task | Task |
DeleteAsync<TResponse>(Uri, CancellationToken)
Method to Delete content
Declaration
public static async Task<TResponse> DeleteAsync<TResponse>(this Uri uri, CancellationToken cancellationToken = null)
where TResponse : class
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to send the delete to |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TResponse> | TResponse |
Type Parameters
| Name | Description |
|---|---|
| TResponse | the generic type to return the result into, use HttpContent or HttpResponseMessage to get those unprocessed |
GetAsAsync<TResponse>(Uri, CancellationToken)
Get the response as the specified type
Declaration
public static async Task<TResponse> GetAsAsync<TResponse>(this Uri uri, CancellationToken cancellationToken = null)
where TResponse : class
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | An Uri to specify the download location |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TResponse> | TResponse |
Type Parameters
| Name | Description |
|---|---|
| TResponse | Type to deserialize into |
HeadAsync(Uri, CancellationToken)
Retrieve only the content headers, by using the HTTP HEAD method
Declaration
public static async Task<HttpContentHeaders> HeadAsync(this Uri uri, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to get HEAD for |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<System.Net.Http.Headers.HttpContentHeaders> | HttpContentHeaders |
LastModifiedAsync(Uri, CancellationToken)
Get LastModified for a URI
Declaration
public static async Task<DateTimeOffset> LastModifiedAsync(this Uri uri, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<DateTimeOffset> | DateTime |
PatchAsync(Uri, Object, CancellationToken)
Method to Patch content, ignore response
Declaration
public static async Task PatchAsync(this Uri uri, object content, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to patch to |
| System.Object | content | Content to patch |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
PatchAsync<TResponse>(Uri, Object, CancellationToken)
Method to Patch content
Declaration
public static async Task<TResponse> PatchAsync<TResponse>(this Uri uri, object content, CancellationToken cancellationToken = null)
where TResponse : class
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to patch to |
| System.Object | content | Content to patch |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TResponse> | TResponse |
Type Parameters
| Name | Description |
|---|---|
| TResponse | the generic type to return the result into, use HttpContent or HttpResponseMessage to get those unprocessed |
PostAsync(Uri, Object, CancellationToken)
Method to Post content, ignore response
Declaration
public static async Task PostAsync(this Uri uri, object content, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to post to |
| System.Object | content | Content to post |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task |
PostAsync<TResponse>(Uri, Object, CancellationToken)
Method to Post content
Declaration
public static async Task<TResponse> PostAsync<TResponse>(this Uri uri, object content, CancellationToken cancellationToken = null)
where TResponse : class
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to post to |
| System.Object | content | Content to post |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TResponse> | TResponse |
Type Parameters
| Name | Description |
|---|---|
| TResponse | the generic type to return the result into, use HttpContent or HttpResponseMessage to get those unprocessed |
PutAsync(Uri, Object, CancellationToken)
Method to Put content
Declaration
public static async Task PutAsync(this Uri uri, object content, CancellationToken cancellationToken = null)
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to put to |
| System.Object | content | Content to put |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task | task |
PutAsync<TResponse>(Uri, Object, CancellationToken)
Method to Put content
Declaration
public static async Task<TResponse> PutAsync<TResponse>(this Uri uri, object content, CancellationToken cancellationToken = null)
where TResponse : class
Parameters
| Type | Name | Description |
|---|---|---|
| Uri | uri | Uri to put to |
| System.Object | content | Content to put |
| CancellationToken | cancellationToken | CancellationToken |
Returns
| Type | Description |
|---|---|
| Task<TResponse> | TResponse |
Type Parameters
| Name | Description |
|---|---|
| TResponse | the generic type to return the result into, use HttpContent or HttpResponseMessage to get those unprocessed |