// // Copyright (c) slskd Team. All rights reserved. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published // by the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see https://www.gnu.org/licenses/. // namespace slskd.API.DTO { using slskd.Messaging; 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(), }; } } }