29 lines
945 B
C#
29 lines
945 B
C#
using System;
|
|
using System.IO;
|
|
using System.Net.Http;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Elsa.Http.Contracts;
|
|
|
|
/// <summary>
|
|
/// A strategy that reads a <see cref="HttpResponseMessage"/> of a given content type.
|
|
/// </summary>
|
|
public interface IHttpContentParser
|
|
{
|
|
/// <summary>
|
|
/// The priority of the parser as compared to other parsers.
|
|
/// The higher the number, the higher priority.
|
|
/// </summary>
|
|
int Priority { get; }
|
|
|
|
/// <summary>
|
|
/// Returns a value indicating whether this reader supports the specified content type.
|
|
/// </summary>
|
|
bool GetSupportsContentType(string contentType);
|
|
|
|
/// <summary>
|
|
/// Reads the specified <c>stream</c> and returns a parsed object of the specified type. If no type is specified, a string is returned.
|
|
/// </summary>
|
|
Task<object> ReadAsync(Stream content, Type? returnType, CancellationToken cancellationToken);
|
|
} |