Initial commit carried over from private repo. This is V2.
This commit is contained in:
22
code/MessengerApi.Contracts.MessageParser/IMessageParser.cs
Normal file
22
code/MessengerApi.Contracts.MessageParser/IMessageParser.cs
Normal file
@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user