Interface IHttpContentConverter
This interface is used for all
Namespace:Dapplo.HttpExtensions
Assembly:Dapplo.HttpExtensions.dll
Syntax
public interface IHttpContentConverter
Properties
| Improve this Doc View SourceOrder
Specify the order in that this IHttpContentConverter is used
Declaration
int Order { get; }
Returns
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceAddAcceptHeadersForType(Type, HttpRequestMessage)
This will add accept headers depending on the result type
Declaration
void AddAcceptHeadersForType(Type resultType, HttpRequestMessage httpRequestMessage)
Parameters
Type | Name | Description |
---|---|---|
System.Type | resultType | Type to read into |
System.Net.Http.HttpRequestMessage | httpRequestMessage | HttpClient for the response headers |
CanConvertFromHttpContent(Type, HttpContent)
Check if this IHttpContentProcessor can convert the HttpContent into the specified type
Declaration
bool CanConvertFromHttpContent(Type typeToConvertTo, HttpContent httpContent)
Parameters
Type | Name | Description |
---|---|---|
System.Type | typeToConvertTo | Type from which a conversion should be made |
System.Net.Http.HttpContent | httpContent | HttpContent object to process |
Returns
Type | Description |
---|---|
System.Boolean | true if this processor can do the conversion |
CanConvertToHttpContent(Type, Object)
Check if this IHttpContentProcessor can convert the specified type to a HttpContent
Declaration
bool CanConvertToHttpContent(Type typeToConvertFrom, object content)
Parameters
Type | Name | Description |
---|---|---|
System.Type | typeToConvertFrom | Type to convert |
System.Object | content | Content to place into a HttpContent |
Returns
Type | Description |
---|---|
System.Boolean | true if this processor can do the conversion |
ConvertFromHttpContentAsync(Type, HttpContent, CancellationToken)
Create the target object from the supplied HttpContent
Declaration
Task<object> ConvertFromHttpContentAsync(Type resultType, HttpContent httpContent, CancellationToken token = null)
Parameters
Type | Name | Description |
---|---|---|
System.Type | resultType | Typ to process the HttpContent to |
System.Net.Http.HttpContent | httpContent | HttpContent |
System.Threading.CancellationToken | token | CancellationToken |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Object> | object of type resultType |
ConvertToHttpContent(Type, Object)
Create HttpContent for the supplied object/type
Declaration
HttpContent ConvertToHttpContent(Type typeToConvert, object content)
Parameters
Type | Name | Description |
---|---|---|
System.Type | typeToConvert | Type of the content to convert |
System.Object | content | Content to place into a HttpContent |
Returns
Type | Description |
---|---|
System.Net.Http.HttpContent | HttpContent |