Class CustomNewtonsoftJsonContentSerializer
A custom IHttpContentSerializer based on NewtonsoftJsonContentSerializer to handle retries after missing members are observed
public class CustomNewtonsoftJsonContentSerializer : IHttpContentSerializer
- Inheritance
-
CustomNewtonsoftJsonContentSerializer
- Implements
-
IHttpContentSerializer
- Inherited Members
Constructors
CustomNewtonsoftJsonContentSerializer(MerakiClientOptions, ILogger)
public CustomNewtonsoftJsonContentSerializer(MerakiClientOptions options, ILogger logger)
Parameters
optionsMerakiClientOptionsloggerILogger
Methods
FromHttpContentAsync<T>(HttpContent, CancellationToken)
Deserializes an object of type T from an HttpContent object.
public Task<T?> FromHttpContentAsync<T>(HttpContent content, CancellationToken cancellationToken = default)
Parameters
contentHttpContentHttpContent object to deserialize.
cancellationTokenCancellationTokenCancellationToken to abort the deserialization.
Returns
- Task<T>
The deserialized object of type
T.
Type Parameters
TType of the object to serialize to.
GetFieldNameForProperty(PropertyInfo)
Calculates what the field name should be for the given property. This may be affected by custom attributes the serializer understands
public string? GetFieldNameForProperty(PropertyInfo propertyInfo)
Parameters
propertyInfoPropertyInfoA PropertyInfo object.
Returns
- string
The calculated field name.
ToHttpContent<T>(T)
Serializes an object of type T to HttpContent
public HttpContent ToHttpContent<T>(T item)
Parameters
itemTObject to serialize.
Returns
- HttpContent
HttpContent that contains the serialized
Tobject.
Type Parameters
TType of the object to serialize from.