using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using JSONAPI.Documents;
namespace JSONAPI.Http
{
///
/// This service provides the glue between JSONAPI.NET and your persistence layer.
///
public interface IDocumentMaterializer
{
///
/// Returns a document containing records that are filtered, sorted,
/// and paginated according to query parameters present in the provided request.
///
Task GetRecords(HttpRequestMessage request, CancellationToken cancellationToken);
///
/// Returns a document with the resource identified by the given ID.
///
Task GetRecordById(string id, HttpRequestMessage request,
CancellationToken cancellationToken);
///
/// Creates a record corresponding to the data in the request document, and returns a document
/// corresponding to the created record.
///
Task CreateRecord(ISingleResourceDocument requestDocument, HttpRequestMessage request,
CancellationToken cancellationToken);
///
/// Updates the record corresponding to the data in the request document, and returns a document
/// corresponding to the updated record.
///
Task UpdateRecord(string id, ISingleResourceDocument requestDocument,
HttpRequestMessage request, CancellationToken cancellationToken);
///
/// Deletes the record corresponding to the given id.
///
Task DeleteRecord(string id, CancellationToken cancellationToken);
}
}