diff options
| author | JP Dillingham <jpdillingham@gmail.com> | 2021-05-21 08:59:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-21 08:59:02 -0500 |
| commit | 1d0978ab2273255f0decc8c9b6239ef5d0a0c5bd (patch) | |
| tree | 432afbaf7f55c1dc571a48661564078969a6049b /src/slskd/API/DTO | |
| parent | 510de3d91a58b60b59447a785b6b6a1b3ccc5bd7 (diff) | |
| parent | 82a38b0f0b405c03503f3b1fff81a7981227b267 (diff) | |
| download | slskd-1d0978ab2273255f0decc8c9b6239ef5d0a0c5bd.tar.gz | |
Merge pull request #77 from slskd/warnings
Resolve noisy build warnings
Diffstat (limited to 'src/slskd/API/DTO')
| -rw-r--r-- | src/slskd/API/DTO/ConnectRequest.cs | 19 | ||||
| -rw-r--r-- | src/slskd/API/DTO/LoginRequest.cs | 19 | ||||
| -rw-r--r-- | src/slskd/API/DTO/PrivateMessageResponse.cs | 21 | ||||
| -rw-r--r-- | src/slskd/API/DTO/QueueDownloadRequest.cs | 19 | ||||
| -rw-r--r-- | src/slskd/API/DTO/RoomInfoResponse.cs | 21 | ||||
| -rw-r--r-- | src/slskd/API/DTO/RoomMessageResponse.cs | 21 | ||||
| -rw-r--r-- | src/slskd/API/DTO/RoomResponse.cs | 23 | ||||
| -rw-r--r-- | src/slskd/API/DTO/SearchRequest.cs | 23 | ||||
| -rw-r--r-- | src/slskd/API/DTO/TokenResponse.cs | 39 | ||||
| -rw-r--r-- | src/slskd/API/DTO/Transfer.cs | 23 | ||||
| -rw-r--r-- | src/slskd/API/DTO/UserAddress.cs | 19 | ||||
| -rw-r--r-- | src/slskd/API/DTO/UserDataResponse.cs | 21 |
12 files changed, 236 insertions, 32 deletions
diff --git a/src/slskd/API/DTO/ConnectRequest.cs b/src/slskd/API/DTO/ConnectRequest.cs index 5d90073f..155db2da 100644 --- a/src/slskd/API/DTO/ConnectRequest.cs +++ b/src/slskd/API/DTO/ConnectRequest.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <copyright file="ConnectRequest.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.API.DTO { public class ConnectRequest { diff --git a/src/slskd/API/DTO/LoginRequest.cs b/src/slskd/API/DTO/LoginRequest.cs index 269a489b..9f3ccf2e 100644 --- a/src/slskd/API/DTO/LoginRequest.cs +++ b/src/slskd/API/DTO/LoginRequest.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <copyright file="LoginRequest.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.API.DTO { public class LoginRequest { diff --git a/src/slskd/API/DTO/PrivateMessageResponse.cs b/src/slskd/API/DTO/PrivateMessageResponse.cs index e20ce637..aa2b142d 100644 --- a/src/slskd/API/DTO/PrivateMessageResponse.cs +++ b/src/slskd/API/DTO/PrivateMessageResponse.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <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.API.DTO { using System; using slskd.Entities; @@ -50,7 +67,7 @@ Message = privateMessage.Message, Acknowledged = privateMessage.Acknowledged, Replayed = privateMessage.Replayed, - Self = self ? self: (bool?)null + Self = self ? self : (bool?)null, }; } } diff --git a/src/slskd/API/DTO/QueueDownloadRequest.cs b/src/slskd/API/DTO/QueueDownloadRequest.cs index fcd279ab..a849fefa 100644 --- a/src/slskd/API/DTO/QueueDownloadRequest.cs +++ b/src/slskd/API/DTO/QueueDownloadRequest.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <copyright file="QueueDownloadRequest.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.API.DTO { public class QueueDownloadRequest { diff --git a/src/slskd/API/DTO/RoomInfoResponse.cs b/src/slskd/API/DTO/RoomInfoResponse.cs index 8b9a3cb6..6f135d56 100644 --- a/src/slskd/API/DTO/RoomInfoResponse.cs +++ b/src/slskd/API/DTO/RoomInfoResponse.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <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.API.DTO { using Soulseek; @@ -36,7 +53,7 @@ Name = info.Name, UserCount = info.UserCount, IsPrivate = isPrivate, - IsOwned = isOwned + IsOwned = isOwned, }; } } diff --git a/src/slskd/API/DTO/RoomMessageResponse.cs b/src/slskd/API/DTO/RoomMessageResponse.cs index 3a804b65..520da714 100644 --- a/src/slskd/API/DTO/RoomMessageResponse.cs +++ b/src/slskd/API/DTO/RoomMessageResponse.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <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.API.DTO { using System; using slskd.Entities; @@ -38,7 +55,7 @@ Username = roomMessage.Username, Message = roomMessage.Message, RoomName = roomMessage.RoomName, - Self = self ? self : (bool?)null + Self = self ? self : (bool?)null, }; } } diff --git a/src/slskd/API/DTO/RoomResponse.cs b/src/slskd/API/DTO/RoomResponse.cs index d7708da7..a6da7836 100644 --- a/src/slskd/API/DTO/RoomResponse.cs +++ b/src/slskd/API/DTO/RoomResponse.cs @@ -1,8 +1,25 @@ -namespace slskd.API.DTO +// <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.API.DTO { - using slskd.Entities; using System.Collections.Generic; using System.Linq; + using slskd.Entities; public class RoomResponse { @@ -51,7 +68,7 @@ Operators = room.Operators?.ToList(), Owner = room.Owner, Users = new List<UserDataResponse>(), - Messages = new List<RoomMessageResponse>() + Messages = new List<RoomMessageResponse>(), }; } } diff --git a/src/slskd/API/DTO/SearchRequest.cs b/src/slskd/API/DTO/SearchRequest.cs index 2e6c61e6..147eb205 100644 --- a/src/slskd/API/DTO/SearchRequest.cs +++ b/src/slskd/API/DTO/SearchRequest.cs @@ -1,15 +1,32 @@ -using Soulseek; -using System; +// <copyright file="SearchRequest.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.API.DTO { + using System; + using Soulseek; + /// <summary> /// A search request. /// </summary> public class SearchRequest { /// <summary> - /// Gets or sets the unique search identifier + /// Gets or sets the unique search identifier. /// </summary> public Guid? Id { get; set; } diff --git a/src/slskd/API/DTO/TokenResponse.cs b/src/slskd/API/DTO/TokenResponse.cs index 3490d570..c20e325c 100644 --- a/src/slskd/API/DTO/TokenResponse.cs +++ b/src/slskd/API/DTO/TokenResponse.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <copyright file="TokenResponse.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.API.DTO { using System; using System.IdentityModel.Tokens.Jwt; @@ -14,14 +31,6 @@ JwtSecurityToken = jwtSecurityToken; } - [JsonIgnore] - private JwtSecurityToken JwtSecurityToken { get; } - - /// <summary> - /// Gets the Access Token string. - /// </summary> - public string Token => new JwtSecurityTokenHandler().WriteToken(JwtSecurityToken); - /// <summary> /// Gets the time at which the Access Token expires. /// </summary> @@ -35,16 +44,24 @@ /// <summary> /// Gets the value of the Name claim from the Access Token. /// </summary> - public string Name => JwtSecurityToken.Claims.Where(c => c.Type == ClaimTypes.Name).SingleOrDefault().Value; + public string Name => JwtSecurityToken.Claims.SingleOrDefault(c => c.Type == ClaimTypes.Name)?.Value; /// <summary> /// Gets the value of the Not Before claim from the Access Token. /// </summary> - public long NotBefore => long.Parse(JwtSecurityToken.Claims.Where(c => c.Type == "nbf").SingleOrDefault().Value); + public long NotBefore => long.Parse(JwtSecurityToken.Claims.SingleOrDefault(c => c.Type == "nbf").Value); + + /// <summary> + /// Gets the Access Token string. + /// </summary> + public string Token => new JwtSecurityTokenHandler().WriteToken(JwtSecurityToken); /// <summary> /// Gets the Token type. /// </summary> public string TokenType => JwtBearerDefaults.AuthenticationScheme; + + [JsonIgnore] + private JwtSecurityToken JwtSecurityToken { get; } } }
\ No newline at end of file diff --git a/src/slskd/API/DTO/Transfer.cs b/src/slskd/API/DTO/Transfer.cs index 34639a40..c3e4ac22 100644 --- a/src/slskd/API/DTO/Transfer.cs +++ b/src/slskd/API/DTO/Transfer.cs @@ -1,8 +1,25 @@ -namespace slskd.API.DTO +// <copyright file="Transfer.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.API.DTO { - using Soulseek; using System; using System.Net; + using Soulseek; /// <summary> /// A single file transfer. @@ -124,7 +141,7 @@ StartTime = transfer.StartTime, State = transfer.State, Token = transfer.Token, - Username = transfer.Username + Username = transfer.Username, }; } } diff --git a/src/slskd/API/DTO/UserAddress.cs b/src/slskd/API/DTO/UserAddress.cs index 4fe7dc4a..28a28726 100644 --- a/src/slskd/API/DTO/UserAddress.cs +++ b/src/slskd/API/DTO/UserAddress.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <copyright file="UserAddress.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.API.DTO { /// <summary> /// A user's IP address and port. diff --git a/src/slskd/API/DTO/UserDataResponse.cs b/src/slskd/API/DTO/UserDataResponse.cs index 5d79639c..e854922e 100644 --- a/src/slskd/API/DTO/UserDataResponse.cs +++ b/src/slskd/API/DTO/UserDataResponse.cs @@ -1,4 +1,21 @@ -namespace slskd.API.DTO +// <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.API.DTO { using Soulseek; @@ -61,7 +78,7 @@ SlotsFree = userData.SlotsFree, Status = userData.Status, Username = userData.Username, - Self = self ? self : (bool?)null + Self = self ? self : (bool?)null, }; } } |
