Interface IHttpContentSerializer
Interface for an object that can serialize HTTP content to and from common Tableau API formats.
Namespace: Tableau.Migration.Net
Assembly: Tableau.Migration.dll
Syntax
public interface IHttpContentSerializer
Methods
DeserializeAsync<TContent>(HttpContent, CancellationToken)
Deserializes HttpContent.
Declaration
Task<TContent?> DeserializeAsync<TContent>(HttpContent content, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
HttpContent | content | The content to deserialize. |
CancellationToken | cancel | The cancellation token. |
Returns
Type | Description |
---|---|
Task<TContent> | The deserialized content. |
Type Parameters
Name | Description |
---|---|
TContent | The content's deserialized type. |
Serialize<TContent>(TContent, MediaTypeWithQualityHeaderValue)
Serializes content for a HttpRequestMessage.
Declaration
StringContent? Serialize<TContent>(TContent content, MediaTypeWithQualityHeaderValue contentType) where TContent : class
Parameters
Type | Name | Description |
---|---|---|
TContent | content | The |
MediaTypeWithQualityHeaderValue | contentType | The serialized content type. |
Returns
Type | Description |
---|---|
StringContent |
Type Parameters
Name | Description |
---|---|
TContent | The request's content type. |
TryDeserializeErrorAsync(HttpContent, CancellationToken)
Deserializes a Tableau Server Error if it exists in the content.
Declaration
Task<Error?> TryDeserializeErrorAsync(HttpContent content, CancellationToken cancel)
Parameters
Type | Name | Description |
---|---|---|
HttpContent | content | The HTTP content to deserialize. |
CancellationToken | cancel | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Error> | The deserialized error if found in the content, null otherwise. |