forked from JSONAPIdotNET/JSONAPI.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIJsonApiFormatter.cs
More file actions
29 lines (27 loc) · 1.17 KB
/
Copy pathIJsonApiFormatter.cs
File metadata and controls
29 lines (27 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
using System.Threading.Tasks;
using Newtonsoft.Json;
namespace JSONAPI.Json
{
/// <summary>
/// Interface responsible for serializing and deserializing JSON API document components
/// </summary>
/// <typeparam name="T">The type of component this service can format</typeparam>
public interface IJsonApiFormatter<T>
{
/// <summary>
/// Serializes the given component
/// </summary>
/// <param name="component">The component to serialize</param>
/// <param name="writer">The JSON writer to serialize with</param>
/// <returns>A task that resolves when serialization is complete.</returns>
Task Serialize(T component, JsonWriter writer);
/// <summary>
/// Deserializes the given component
/// </summary>
/// <param name="reader">The JSON reader to deserialize with</param>
/// <param name="currentPath">A JSON pointer pointing to the current thing being deserialized</param>
/// <typeparam name="T"></typeparam>
/// <returns>A task that resolves with the deserialized object</returns>
Task<T> Deserialize(JsonReader reader, string currentPath);
}
}