using MessagePack; namespace ChatRoomContract; /// /// Minimal message description /// [MessagePackObject] public class Message { /// /// Message ID /// [Key(0)] public int id; /// /// Message contents /// [Key(1)] public string contents; /// /// Does this message need to be censored? /// [Key(2)] public bool needsToBeCensored; } /// /// Chat room service contract /// public interface IChatRoomService { /// /// Register client with a name /// /// Name of client, can be duplicate between clients /// Client ID int RegisterClient(string name); /// /// Get number of strikes a participant has /// /// Client ID /// Number of strikes int GetStrikes(int clientId); /// /// Get timestamp until when the client is blocked /// /// Client ID /// Optional datetime object DateTime? GetBlockedUntil(int clientId); /// /// Send a message, will be given to a moderator to be approved /// /// Client ID /// Message contents /// Does this message need to be censored? /// Was sending successful, can fail if user is blocked bool SendMessage(int clientId, string contents, bool needsToBeCensored); /// /// Get the next message which hasn't been approved or rejected /// /// Message object. Returns null if there is no message Message? GetNewMessage(); /// /// Reject a message /// /// Message ID void RejectMessage(int messageId); /// /// Approve a message /// /// Message ID void ApproveMessage(int messageId); }