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/UserDataResponse.cs | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/slskd/API/DTO/UserDataResponse.cs (limited to 'src/slskd/API/DTO/UserDataResponse.cs') diff --git a/src/slskd/API/DTO/UserDataResponse.cs b/src/slskd/API/DTO/UserDataResponse.cs new file mode 100644 index 00000000..5d79639c --- /dev/null +++ b/src/slskd/API/DTO/UserDataResponse.cs @@ -0,0 +1,68 @@ +namespace slskd.API.DTO +{ + using Soulseek; + + public class UserDataResponse + { + /// + /// The average upload speed of the user. + /// + public int AverageSpeed { get; set; } + + /// + /// The user's country code, if provided. + /// + public string CountryCode { get; set; } + + /// + /// The number of directories shared by the user. + /// + public int DirectoryCount { get; set; } + + /// + /// The number of active user downloads. + /// + public long DownloadCount { get; set; } + + /// + /// The number of files shared by the user. + /// + public int FileCount { get; set; } + + /// + /// A value indicating whether this user data belongs to the currently logged in user. + /// + public bool? Self { get; set; } + + /// + /// The number of the user's free download slots, if provided. + /// + public int? SlotsFree { get; set; } + + /// + /// The status of the user (0 = offline, 1 = away, 2 = online). + /// + public UserPresence Status { get; set; } + + /// + /// The username of the user. + /// + 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, + DownloadCount = userData.DownloadCount, + FileCount = userData.FileCount, + SlotsFree = userData.SlotsFree, + Status = userData.Status, + Username = userData.Username, + Self = self ? self : (bool?)null + }; + } + } +} \ No newline at end of file -- cgit v1.2.3