From 936ed099a6e5258f9fd5a5ac026afc0630359b98 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 13 Feb 2021 07:58:15 -0600 Subject: move controllers and DTOs to API namespace --- src/slskd/API/DTO/RoomResponse.cs | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 src/slskd/API/DTO/RoomResponse.cs (limited to 'src/slskd/API/DTO/RoomResponse.cs') diff --git a/src/slskd/API/DTO/RoomResponse.cs b/src/slskd/API/DTO/RoomResponse.cs new file mode 100644 index 00000000..d7708da7 --- /dev/null +++ b/src/slskd/API/DTO/RoomResponse.cs @@ -0,0 +1,58 @@ +namespace slskd.API.DTO +{ + using slskd.Entities; + using System.Collections.Generic; + using System.Linq; + + public class RoomResponse + { + /// + /// The room name. + /// + public string Name { get; set; } + + /// + /// A value indicating whether the room is private. + /// + public bool IsPrivate { get; set; } + + /// + /// The number of operators in the room, if private. + /// + public int? OperatorCount { get; set; } + + /// + /// The operators in the room, if private. + /// + public IList Operators { get; set; } + + /// + /// The owner of the room, if private. + /// + public string Owner { get; set; } + + /// + /// The list of users in the room. + /// + public IEnumerable Users { get; set; } = new List(); + + /// + /// The list of messages. + /// + public IEnumerable Messages { get; set; } = new List(); + + public static RoomResponse FromRoom(Room room) + { + return new RoomResponse() + { + Name = room.Name, + IsPrivate = room.IsPrivate, + OperatorCount = room.OperatorCount, + Operators = room.Operators?.ToList(), + Owner = room.Owner, + Users = new List(), + Messages = new List() + }; + } + } +} -- cgit v1.2.3