Class RestClientExtensions
IRestClient extensions for http requests/responses and url construction
Inheritance
Inherited Members
Namespace: BlazorFocused.Extensions
Assembly: BlazorFocused.Client.dll
Syntax
public static class RestClientExtensions
Methods
| Improve this Doc View SourceDeleteAsync<T>(IRestClient, Action<IRestClientUrlBuilder>)
Performs DELETE http request
Declaration
public static Task<T> DeleteAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
Returns
Type | Description |
---|---|
Task<T> | Http response body of type |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on DeleteAsync<T>(String) apply
DeleteTaskAsync(IRestClient, Action<IRestClientUrlBuilder>)
Performs DELETE http request
Declaration
public static Task DeleteTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
Returns
Type | Description |
---|---|
Task | Task for completion detection |
Remarks
Rules/Details on DeleteTaskAsync(String) apply
GetAsync<T>(IRestClient, Action<IRestClientUrlBuilder>)
Performs GET http request
Declaration
public static Task<T> GetAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
Returns
Type | Description |
---|---|
Task<T> | Http response body of type |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on GetAsync<T>(String) apply
PatchAsync<T>(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PATCH http request
Declaration
public static Task<T> PatchAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<T> | Http response body of type |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on PatchAsync<T>(String, Object) apply
PatchTaskAsync(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PATCH http request
Declaration
public static Task PatchTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task | Task for completion detection |
Remarks
Rules/Details on PatchTaskAsync(String, Object) apply
PostAsync<T>(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs POST http request
Declaration
public static Task<T> PostAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<T> | Http response body of type |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on PostAsync<T>(String, Object) apply
PostTaskAsync(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs POST http request
Declaration
public static Task PostTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task | Task for completion detection |
Remarks
Rules/Details on PostAsync<T>(String, Object) apply
PutAsync<T>(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PUT http request
Declaration
public static Task<T> PutAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<T> | Http response body of type |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on PutAsync<T>(String, Object) apply
PutTaskAsync(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PUT http request
Declaration
public static Task PutTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task | Task for completion detection |
Remarks
Rules/Details on PutAsync<T>(String, Object) apply
TryDeleteAsync<T>(IRestClient, Action<IRestClientUrlBuilder>)
Performs DELETE http request
Declaration
public static Task<RestClientResponse<T>> TryDeleteAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including value, status code, or any exceptions. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on TryDeleteAsync<T>(IRestClient, String) apply
TryDeleteAsync<T>(IRestClient, String)
Performs DELETE http request
Declaration
public static Task<RestClientResponse<T>> TryDeleteAsync<T>(this IRestClient restClient, string relativeUrl)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including value, status code, or any exceptions. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
If request is successful, value is returned. If request is not successful, exception is returned. Success is indicated by "IsValid" property. See RestClientResponse<T>
TryDeleteTaskAsync(IRestClient, Action<IRestClientUrlBuilder>)
Performs DELETE http request
Declaration
public static Task<RestClientTask> TryDeleteTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. |
Remarks
Rules/Details on TryDeleteAsync<T>(IRestClient, String) apply
TryDeleteTaskAsync(IRestClient, String)
Performs DELETE http request
Declaration
public static async Task<RestClientTask> TryDeleteTaskAsync(this IRestClient restClient, string relativeUrl)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. NOTE: Use this when not expecting to receive a deserialized response object. To received deserialized response object, use extension TryDeleteAsync<T>(IRestClient, String) |
TryGetAsync<T>(IRestClient, Action<IRestClientUrlBuilder>)
Performs GET http request
Declaration
public static Task<RestClientResponse<T>> TryGetAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including value, status code, or any exceptions. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on TryGetAsync<T>(IRestClient, String) apply
TryGetAsync<T>(IRestClient, String)
Performs GET http request
Declaration
public static Task<RestClientResponse<T>> TryGetAsync<T>(this IRestClient restClient, string relativeUrl)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including body, status code, or any exceptions that occurred. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
If request is successful, value is returned. If request is not successful, exception is returned. Success is indicated by "IsValid" property. See RestClientResponse<T>
TryPatchAsync<T>(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PATCH http request
Declaration
public static Task<RestClientResponse<T>> TryPatchAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including value, status code, or any exceptions. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on TryPatchAsync<T>(IRestClient, String, Object) apply
TryPatchAsync<T>(IRestClient, String, Object)
Performs PATCH http request
Declaration
public static Task<RestClientResponse<T>> TryPatchAsync<T>(this IRestClient restClient, string relativeUrl, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including body, status code, or any exceptions that occurred. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
If request is successful, value is returned. If request is not successful, exception is returned. Success is indicated by "IsValid" property. See RestClientResponse<T>
TryPatchTaskAsync(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PATCH http request
Declaration
public static Task<RestClientTask> TryPatchTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. |
Remarks
Rules/Details on TryPatchTaskAsync(IRestClient, String, Object) apply
TryPatchTaskAsync(IRestClient, String, Object)
Performs PATCH http request
Declaration
public static async Task<RestClientTask> TryPatchTaskAsync(this IRestClient restClient, string relativeUrl, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. NOTE: Use this when not expecting to receive a deserialized response object. To received deserialized response object, use extension TryPatchAsync<T>(IRestClient, String, Object) |
TryPostAsync<T>(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs POST http request
Declaration
public static Task<RestClientResponse<T>> TryPostAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including value, status code, or any exceptions. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on TryPostAsync<T>(IRestClient, String, Object) apply
TryPostAsync<T>(IRestClient, String, Object)
Performs POST http request
Declaration
public static Task<RestClientResponse<T>> TryPostAsync<T>(this IRestClient restClient, string relativeUrl, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including body, status code, or any exceptions that occurred. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
If request is successful, value is returned. If request is not successful, exception is returned. Success is indicated by "IsValid" property. See RestClientResponse<T>
TryPostTaskAsync(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs POST http request
Declaration
public static Task<RestClientTask> TryPostTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. |
Remarks
Rules/Details on TryPostTaskAsync(IRestClient, String, Object) apply
TryPostTaskAsync(IRestClient, String, Object)
Performs POST http request
Declaration
public static async Task<RestClientTask> TryPostTaskAsync(this IRestClient restClient, string relativeUrl, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. NOTE: Use this when not expecting to receive a deserialized response object. To received deserialized response object, use extension TryPostAsync<T>(IRestClient, String, Object) |
TryPutAsync<T>(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PUT http request
Declaration
public static Task<RestClientResponse<T>> TryPutAsync<T>(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including value, status code, or any exceptions. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
Rules/Details on TryPutAsync<T>(IRestClient, String, Object) apply
TryPutAsync<T>(IRestClient, String, Object)
Performs PUT http request
Declaration
public static Task<RestClientResponse<T>> TryPutAsync<T>(this IRestClient restClient, string relativeUrl, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientResponse<T>> | Http response attributes including body, status code, or any exceptions that occurred. See RestClientResponse<T> |
Type Parameters
Name | Description |
---|---|
T | Object type of response from http request |
Remarks
If request is successful, value is returned. If request is not successful, exception is returned. Success is indicated by "IsValid" property. See RestClientResponse<T>
TryPutTaskAsync(IRestClient, Action<IRestClientUrlBuilder>, Object)
Performs PUT http request
Declaration
public static Task<RestClientTask> TryPutTaskAsync(this IRestClient restClient, Action<IRestClientUrlBuilder> urlBuilder, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
Action<IRestClientUrlBuilder> | urlBuilder | IRestClientUrlBuilder used to construct relative or absolute url for request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. |
Remarks
Rules/Details on TryPutTaskAsync(IRestClient, String, Object) apply
TryPutTaskAsync(IRestClient, String, Object)
Performs PUT http request
Declaration
public static async Task<RestClientTask> TryPutTaskAsync(this IRestClient restClient, string relativeUrl, object data)
Parameters
Type | Name | Description |
---|---|---|
IRestClient | restClient | IRestClient implementation being extended |
System.String | relativeUrl | Relative url for http request |
System.Object | data | Http request object body |
Returns
Type | Description |
---|---|
Task<RestClientTask> | RestClientTask with http response attributes including status code or any exceptions. NOTE: Use this when not expecting to receive a deserialized response object. To received deserialized response object, use extension TryPutAsync<T>(IRestClient, String, Object) |