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/RoomInfoResponse.cs | 43 +++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/slskd/API/DTO/RoomInfoResponse.cs (limited to 'src/slskd/API/DTO/RoomInfoResponse.cs') diff --git a/src/slskd/API/DTO/RoomInfoResponse.cs b/src/slskd/API/DTO/RoomInfoResponse.cs new file mode 100644 index 00000000..8b9a3cb6 --- /dev/null +++ b/src/slskd/API/DTO/RoomInfoResponse.cs @@ -0,0 +1,43 @@ +namespace slskd.API.DTO +{ + using Soulseek; + + public class RoomInfoResponse + { + /// + /// Gets the room name. + /// + public string Name { get; init; } + + /// + /// Gets the number of users in the room. + /// + public int UserCount { get; init; } + + /// + /// Gets a value indicating whether the room is private. + /// + public bool IsPrivate { get; init; } + + /// + /// Gets a value indicating whether the room is owned by the currently logged in user. + /// + public bool IsOwned { get; init; } + + /// + /// Gets a value indicating whether the room is moderated by the currently logged in user. + /// + public bool IsModerated { get; set; } + + public static RoomInfoResponse FromRoomInfo(RoomInfo info, bool isPrivate = false, bool isOwned = false) + { + return new RoomInfoResponse() + { + Name = info.Name, + UserCount = info.UserCount, + IsPrivate = isPrivate, + IsOwned = isOwned + }; + } + } +} -- cgit v1.2.3