-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add JSON Source Gen - LTS Target - AOT Analyzer for .NET 8 * Get Ready For Merge * Formatting
- Loading branch information
1 parent
d0255ae
commit 75fade0
Showing
27 changed files
with
495 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
using Passwordless.Net.Models; | ||
|
||
namespace Passwordless.Net.Helpers; | ||
|
||
[JsonSourceGenerationOptions( | ||
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, | ||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] | ||
[JsonSerializable(typeof(RegisterTokenResponse))] | ||
[JsonSerializable(typeof(RegisterOptions))] | ||
[JsonSerializable(typeof(VerifyTokenRequest))] // TODO: Use this with JsonContent.Create | ||
[JsonSerializable(typeof(VerifiedUser))] | ||
[JsonSerializable(typeof(DeleteUserRequest))] | ||
[JsonSerializable(typeof(ListResponse<PasswordlessUserSummary>))] | ||
[JsonSerializable(typeof(ListResponse<AliasPointer>))] | ||
[JsonSerializable(typeof(ListResponse<Credential>))] | ||
[JsonSerializable(typeof(DeleteCredentialRequest))] | ||
[JsonSerializable(typeof(UsersCount))] | ||
[JsonSerializable(typeof(PasswordlessProblemDetails))] | ||
[JsonSerializable(typeof(Dictionary<string, JsonElement>))] | ||
[JsonSerializable(typeof(JsonElement))] | ||
internal partial class PasswordlessSerializerContext : JsonSerializerContext | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
using System.Text.Json.Serialization; | ||
|
||
using static Passwordless.Net.PasswordlessClient; | ||
|
||
namespace Passwordless.Net; | ||
|
||
public class CredentialDescriptor | ||
{ | ||
public CredentialDescriptor(byte[] id) | ||
{ | ||
Id = id; | ||
} | ||
|
||
[JsonConverter(typeof(Base64UrlConverter))] | ||
public byte[] Id { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Passwordless.Net.Models; | ||
|
||
internal class DeleteCredentialRequest | ||
{ | ||
public DeleteCredentialRequest(string credentialId) | ||
{ | ||
CredentialId = credentialId; | ||
} | ||
|
||
public string CredentialId { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Passwordless.Net.Models; | ||
|
||
internal class DeleteUserRequest | ||
{ | ||
public DeleteUserRequest(string userId) | ||
{ | ||
UserId = userId; | ||
} | ||
|
||
public string UserId { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,13 @@ | ||
namespace Passwordless.Net.Models; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Passwordless.Net.Models; | ||
|
||
public class RegisterTokenResponse | ||
{ | ||
public string Token { get; set; } | ||
public RegisterTokenResponse(string token) | ||
{ | ||
Token = token; | ||
} | ||
|
||
public string Token { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Passwordless.Net.Models; | ||
|
||
internal class VerifyTokenRequest | ||
{ | ||
public VerifyTokenRequest(string token) | ||
{ | ||
Token = token; | ||
} | ||
|
||
public string Token { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
using System.Diagnostics; | ||
using System.Net.Http; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace Passwordless.Net; | ||
|
||
public sealed class PasswordlessApiException : HttpRequestException | ||
{ | ||
public ProblemDetails Details { get; } | ||
public PasswordlessProblemDetails Details { get; } | ||
|
||
public PasswordlessApiException(ProblemDetails problemDetails) : base(problemDetails.Title) | ||
public PasswordlessApiException(PasswordlessProblemDetails problemDetails) : base(problemDetails.Title) | ||
{ | ||
Details = problemDetails; | ||
} | ||
} | ||
|
||
public class ProblemDetails | ||
public class PasswordlessProblemDetails | ||
{ | ||
// TODO: Make immutable | ||
public PasswordlessProblemDetails(string type, | ||
string title, int status, string? detail, string? instance) | ||
{ | ||
Type = type; | ||
Title = title; | ||
Status = status; | ||
Detail = detail; | ||
Instance = instance; | ||
} | ||
|
||
// TODO: Include errorCode as a property once it's more common | ||
public string Type { get; set; } = null!; | ||
public string Title { get; set; } = null!; | ||
public int Status { get; set; } | ||
public string? Detail { get; set; } | ||
public string? Instance { get; set; } | ||
public string Type { get; } | ||
public string Title { get; } | ||
public int Status { get; } | ||
public string? Detail { get; } | ||
public string? Instance { get; } | ||
|
||
[JsonExtensionData] | ||
public Dictionary<string, object?> Extensions { get; set; } | ||
public Dictionary<string, JsonElement> Extensions { get; set; } = new Dictionary<string, JsonElement>(); | ||
} |
Oops, something went wrong.