diff --git a/Foxnouns.Backend/Services/Auth/RemoteAuthService.Discord.cs b/Foxnouns.Backend/Services/Auth/RemoteAuthService.Discord.cs index e43ea21..de16d2f 100644 --- a/Foxnouns.Backend/Services/Auth/RemoteAuthService.Discord.cs +++ b/Foxnouns.Backend/Services/Auth/RemoteAuthService.Discord.cs @@ -12,8 +12,7 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -using System.Diagnostics.CodeAnalysis; -using JetBrains.Annotations; +using System.Text.Json.Serialization; namespace Foxnouns.Backend.Services.Auth; @@ -66,22 +65,12 @@ public partial class RemoteAuthService if (user == null) throw new FoxnounsError("Discord user response was null"); - return new RemoteUser(user.id, user.username); + return new RemoteUser(user.Id, user.Username); } - [SuppressMessage( - "ReSharper", - "InconsistentNaming", - Justification = "Easier to use snake_case here, rather than passing in JSON converter options" - )] - [UsedImplicitly] - private record DiscordTokenResponse(string access_token, string token_type); - - [SuppressMessage( - "ReSharper", - "InconsistentNaming", - Justification = "Easier to use snake_case here, rather than passing in JSON converter options" - )] - [UsedImplicitly] - private record DiscordUserResponse(string id, string username); + // ReSharper disable once ClassNeverInstantiated.Local + private record DiscordUserResponse( + [property: JsonPropertyName("id")] string Id, + [property: JsonPropertyName("username")] string Username + ); } diff --git a/Foxnouns.Backend/Services/Auth/RemoteAuthService.Google.cs b/Foxnouns.Backend/Services/Auth/RemoteAuthService.Google.cs index a6800cc..3245858 100644 --- a/Foxnouns.Backend/Services/Auth/RemoteAuthService.Google.cs +++ b/Foxnouns.Backend/Services/Auth/RemoteAuthService.Google.cs @@ -12,7 +12,6 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -using System.Diagnostics.CodeAnalysis; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; @@ -69,7 +68,7 @@ public partial class RemoteAuthService return new RemoteUser(user.Id, user.Email); } - [SuppressMessage("ReSharper", "ClassNeverInstantiated.Local")] + // ReSharper disable once ClassNeverInstantiated.Local private record GoogleTokenResponse([property: JsonPropertyName("id_token")] string IdToken); private record GoogleUser( diff --git a/Foxnouns.Backend/Services/Auth/RemoteAuthService.Tumblr.cs b/Foxnouns.Backend/Services/Auth/RemoteAuthService.Tumblr.cs index be752af..d63ee1a 100644 --- a/Foxnouns.Backend/Services/Auth/RemoteAuthService.Tumblr.cs +++ b/Foxnouns.Backend/Services/Auth/RemoteAuthService.Tumblr.cs @@ -14,6 +14,8 @@ // along with this program. If not, see . using System.Text.Json.Serialization; +// ReSharper disable ClassNeverInstantiated.Local + namespace Foxnouns.Backend.Services.Auth; public partial class RemoteAuthService @@ -83,11 +85,6 @@ public partial class RemoteAuthService return new RemoteUser(blog.Uuid, blog.Name); } - private record OauthTokenResponse( - [property: JsonPropertyName("access_token")] string AccessToken, - [property: JsonPropertyName("token_type")] string TokenType - ); - // tumblr why private record TumblrData( [property: JsonPropertyName("meta")] TumblrMeta Meta, diff --git a/Foxnouns.Backend/Services/Auth/RemoteAuthService.cs b/Foxnouns.Backend/Services/Auth/RemoteAuthService.cs index 083faf3..6e0ba76 100644 --- a/Foxnouns.Backend/Services/Auth/RemoteAuthService.cs +++ b/Foxnouns.Backend/Services/Auth/RemoteAuthService.cs @@ -13,6 +13,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . using System.Diagnostics.CodeAnalysis; +using System.Text.Json.Serialization; using System.Web; using Foxnouns.Backend.Database; using Foxnouns.Backend.Database.Models; @@ -35,6 +36,12 @@ public partial class RemoteAuthService( public record RemoteUser(string Id, string Username); + [SuppressMessage("ReSharper", "ClassNeverInstantiated.Local")] + private record OauthTokenResponse( + [property: JsonPropertyName("access_token")] string AccessToken, + [property: JsonPropertyName("token_type")] string TokenType + ); + /// /// Validates whether a user can still add a new account of the given AuthType, and throws an error if they can't. ///