namespace ChatRoomContract; /// /// Minimal message description /// public class Message { /// /// Message ID /// public int id { get; set; } /// /// Message contents /// public string contents { get; set; } /// /// Does this message need to be censored? /// public bool needsToBeCensored { get; set; } } /// /// 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); }