aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Application/Messaging/API/DTO
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-09-21 08:28:11 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-09-21 08:28:11 -0500
commit0eb773dbd4aa2fe971bc55e5c5f12413003296bb (patch)
tree7e36184eb454ed8b0f5f0cbce07c53c191a0a3c1 /src/slskd/Application/Messaging/API/DTO
parent7387d568548af0898d9fd2b716d3bb16b6d9be2b (diff)
downloadslskd-0eb773dbd4aa2fe971bc55e5c5f12413003296bb.tar.gz
move stuff again
Diffstat (limited to 'src/slskd/Application/Messaging/API/DTO')
-rw-r--r--src/slskd/Application/Messaging/API/DTO/PrivateMessageResponse.cs74
-rw-r--r--src/slskd/Application/Messaging/API/DTO/RoomInfoResponse.cs60
-rw-r--r--src/slskd/Application/Messaging/API/DTO/RoomMessageResponse.cs62
-rw-r--r--src/slskd/Application/Messaging/API/DTO/RoomResponse.cs75
-rw-r--r--src/slskd/Application/Messaging/API/DTO/UserDataResponse.cs85
5 files changed, 0 insertions, 356 deletions
diff --git a/src/slskd/Application/Messaging/API/DTO/PrivateMessageResponse.cs b/src/slskd/Application/Messaging/API/DTO/PrivateMessageResponse.cs
deleted file mode 100644
index a7e08d50..00000000
--- a/src/slskd/Application/Messaging/API/DTO/PrivateMessageResponse.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-// <copyright file="PrivateMessageResponse.cs" company="slskd Team">
-// 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/.
-// </copyright>
-
-namespace slskd.Messaging.API
-{
- using System;
- using slskd.Messaging;
-
- public class PrivateMessageResponse
- {
- /// <summary>
- /// A value indicating whether the message has been acknowledged.
- /// </summary>
- public bool Acknowledged { get; set; } = false;
-
- /// <summary>
- /// The unique message id, used to acknowledge receipt.
- /// </summary>
- public int Id { get; set; }
-
- /// <summary>
- /// The message.
- /// </summary>
- public string Message { get; set; }
-
- /// <summary>
- /// A value indicating whether the message was replayed.
- /// </summary>
- public bool Replayed { get; set; }
-
- /// <summary>
- /// The UTC timestamp of the message.
- /// </summary>
- public DateTime Timestamp { get; set; } = DateTime.UtcNow;
-
- /// <summary>
- /// The username of the user who sent the message.
- /// </summary>
- public string Username { get; set; }
-
- /// <summary>
- /// A value indicating whether this message was sent by the currently logged in user.
- /// </summary>
- public bool? Self { get; set; }
-
- public static PrivateMessageResponse FromPrivateMessage(PrivateMessage privateMessage, bool self = false)
- {
- return new PrivateMessageResponse()
- {
- Id = privateMessage.Id,
- Timestamp = privateMessage.Timestamp,
- Username = privateMessage.Username,
- Message = privateMessage.Message,
- Acknowledged = privateMessage.Acknowledged,
- Replayed = privateMessage.Replayed,
- Self = self ? self : (bool?)null,
- };
- }
- }
-}
diff --git a/src/slskd/Application/Messaging/API/DTO/RoomInfoResponse.cs b/src/slskd/Application/Messaging/API/DTO/RoomInfoResponse.cs
deleted file mode 100644
index 46edbdc8..00000000
--- a/src/slskd/Application/Messaging/API/DTO/RoomInfoResponse.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-// <copyright file="RoomInfoResponse.cs" company="slskd Team">
-// 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/.
-// </copyright>
-
-namespace slskd.Messaging.API
-{
- using Soulseek;
-
- public class RoomInfoResponse
- {
- /// <summary>
- /// Gets the room name.
- /// </summary>
- public string Name { get; init; }
-
- /// <summary>
- /// Gets the number of users in the room.
- /// </summary>
- public int UserCount { get; init; }
-
- /// <summary>
- /// Gets a value indicating whether the room is private.
- /// </summary>
- public bool IsPrivate { get; init; }
-
- /// <summary>
- /// Gets a value indicating whether the room is owned by the currently logged in user.
- /// </summary>
- public bool IsOwned { get; init; }
-
- /// <summary>
- /// Gets a value indicating whether the room is moderated by the currently logged in user.
- /// </summary>
- 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,
- };
- }
- }
-}
diff --git a/src/slskd/Application/Messaging/API/DTO/RoomMessageResponse.cs b/src/slskd/Application/Messaging/API/DTO/RoomMessageResponse.cs
deleted file mode 100644
index 965c63a6..00000000
--- a/src/slskd/Application/Messaging/API/DTO/RoomMessageResponse.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-// <copyright file="RoomMessageResponse.cs" company="slskd Team">
-// 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/.
-// </copyright>
-
-namespace slskd.Messaging.API
-{
- using System;
- using slskd.Messaging;
-
- public class RoomMessageResponse
- {
- /// <summary>
- /// The timestamp of the message.
- /// </summary>
- public DateTime Timestamp { get; set; } = DateTime.UtcNow;
-
- /// <summary>
- /// The username of the user who sent the message.
- /// </summary>
- public string Username { get; set; }
-
- /// <summary>
- /// The message.
- /// </summary>
- public string Message { get; set; }
-
- /// <summary>
- /// The room to which the message pertains.
- /// </summary>
- public string RoomName { get; set; }
-
- /// <summary>
- /// A value indicating whether this user data belongs to the currently logged in user.
- /// </summary>
- public bool? Self { get; set; }
-
- public static RoomMessageResponse FromRoomMessage(RoomMessage roomMessage, bool self = false)
- {
- return new RoomMessageResponse()
- {
- Timestamp = roomMessage.Timestamp,
- Username = roomMessage.Username,
- Message = roomMessage.Message,
- RoomName = roomMessage.RoomName,
- Self = self ? self : (bool?)null,
- };
- }
- }
-}
diff --git a/src/slskd/Application/Messaging/API/DTO/RoomResponse.cs b/src/slskd/Application/Messaging/API/DTO/RoomResponse.cs
deleted file mode 100644
index cf7e1478..00000000
--- a/src/slskd/Application/Messaging/API/DTO/RoomResponse.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-// <copyright file="RoomResponse.cs" company="slskd Team">
-// 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/.
-// </copyright>
-
-namespace slskd.Messaging.API
-{
- using System.Collections.Generic;
- using System.Linq;
- using slskd.Messaging;
-
- public class RoomResponse
- {
- /// <summary>
- /// The room name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// A value indicating whether the room is private.
- /// </summary>
- public bool IsPrivate { get; set; }
-
- /// <summary>
- /// The number of operators in the room, if private.
- /// </summary>
- public int? OperatorCount { get; set; }
-
- /// <summary>
- /// The operators in the room, if private.
- /// </summary>
- public IList<string> Operators { get; set; }
-
- /// <summary>
- /// The owner of the room, if private.
- /// </summary>
- public string Owner { get; set; }
-
- /// <summary>
- /// The list of users in the room.
- /// </summary>
- public IEnumerable<UserDataResponse> Users { get; set; } = new List<UserDataResponse>();
-
- /// <summary>
- /// The list of messages.
- /// </summary>
- public IEnumerable<RoomMessageResponse> Messages { get; set; } = new List<RoomMessageResponse>();
-
- 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<UserDataResponse>(),
- Messages = new List<RoomMessageResponse>(),
- };
- }
- }
-}
diff --git a/src/slskd/Application/Messaging/API/DTO/UserDataResponse.cs b/src/slskd/Application/Messaging/API/DTO/UserDataResponse.cs
deleted file mode 100644
index 8f1e9544..00000000
--- a/src/slskd/Application/Messaging/API/DTO/UserDataResponse.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-// <copyright file="UserDataResponse.cs" company="slskd Team">
-// 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/.
-// </copyright>
-
-namespace slskd.Messaging.API
-{
- using Soulseek;
-
- public class UserDataResponse
- {
- /// <summary>
- /// The average upload speed of the user.
- /// </summary>
- public int AverageSpeed { get; set; }
-
- /// <summary>
- /// The user's country code, if provided.
- /// </summary>
- public string CountryCode { get; set; }
-
- /// <summary>
- /// The number of directories shared by the user.
- /// </summary>
- public int DirectoryCount { get; set; }
-
- /// <summary>
- /// The number of files shared by the user.
- /// </summary>
- public int FileCount { get; set; }
-
- /// <summary>
- /// A value indicating whether this user data belongs to the currently logged in user.
- /// </summary>
- public bool? Self { get; set; }
-
- /// <summary>
- /// The number of the user's free download slots, if provided.
- /// </summary>
- public int? SlotsFree { get; set; }
-
- /// <summary>
- /// The status of the user (0 = offline, 1 = away, 2 = online).
- /// </summary>
- public UserPresence Status { get; set; }
-
- /// <summary>
- /// The number of uploads tracked by the server for the user.
- /// </summary>
- public long UploadCount { get; set; }
-
- /// <summary>
- /// The username of the user.
- /// </summary>
- public string Username { get; set; }
-
- public static UserDataResponse FromUserData(UserData userData, bool self = false)
- {
- return new UserDataResponse()
- {
- AverageSpeed = userData.AverageSpeed,
- CountryCode = userData.CountryCode,
- DirectoryCount = userData.DirectoryCount,
- UploadCount = userData.UploadCount,
- FileCount = userData.FileCount,
- SlotsFree = userData.SlotsFree,
- Status = userData.Status,
- Username = userData.Username,
- Self = self ? self : (bool?)null,
- };
- }
- }
-} \ No newline at end of file