Files
messengerapi/code/MessengerApi.Contracts.MessageParser/IMessageParser.cs
masiton 4393977389
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m3s
Build and Push Docker Image / docker (push) Successful in 43s
Initial commit carried over from private repo. This is V2.
2025-07-04 21:24:12 +02:00

23 lines
974 B
C#

namespace MessengerApi.Contracts.MessageParser
{
/// <summary>
/// A tool that helps converting POCO request/response models into <see cref="InboxMessage"/>, <see cref="OutboxMessage"/> and back.
/// </summary>
/// <remarks>
/// If you implement this, it's gonna be a lot easier for you to translate
/// dumb request class into <see cref="OutboxMessage"/>, then convert
/// <see cref="InboxMessage"/> back to request at server-side, and do the
/// same with the response all the way down to the client.
/// </remarks>
public interface IMessageParser<TRequest, TResponse>
{
OutboxMessage GetMessageFromRequest(TRequest request, int targetUserId);
TRequest GetRequestFromMessage(InboxMessage message);
OutboxMessage GetMessageFromResponse(TResponse response, string apiKey, int targetUserId, InboxMessage requestOrigin = null);
TResponse GetResponseFromMessage(InboxMessage message);
}
}