Add register with validation
1 files changed, 31 insertions, 15 deletions
diff --git a/testFrontend/SafeNSound.Sdk/SafeNSoundAuthentication.cs b/testFrontend/SafeNSound.Sdk/SafeNSoundAuthentication.cs
index 7d88ec8..429e93c 100644
--- a/testFrontend/SafeNSound.Sdk/SafeNSoundAuthentication.cs
+++ b/testFrontend/SafeNSound.Sdk/SafeNSoundAuthentication.cs
@@ -1,19 +1,35 @@
-namespace SafeNSound.Sdk;
+using System.Text.Json.Serialization;
-public class SafeNSoundAuthentication(SafeNSoundConfiguration config)
-{
- public async Task<SafeNSoundAuthResult> Login(string username, string password)
- {
-
- }
-
- public async Task<SafeNSoundAuthResult> Register(string username, string password)
- {
-
+namespace SafeNSound.Sdk;
+
+public class SafeNSoundAuthentication(SafeNSoundConfiguration config) {
+ // public async Task<SafeNSoundAuthResult> Login(string username, string password)
+ // {
+
+ // }
+
+ public async Task<SafeNSoundAuthResult> Register(RegisterDto registerDto) {
+ var hc = new WrappedHttpClient() {
+ BaseAddress = new Uri(config.BaseUri)
+ };
+
+ var res = await hc.PostAsJsonAsync("/auth/register", registerDto);
+ return null!;
}
}
-public class SafeNSoundAuthResult
-{
-
-}
\ No newline at end of file
+public class RegisterDto {
+ [JsonPropertyName("username")]
+ public string Username { get; set; } = string.Empty;
+
+ [JsonPropertyName("password")]
+ public string Password { get; set; } = string.Empty;
+
+ [JsonPropertyName("email")]
+ public string Email { get; set; } = string.Empty;
+
+ [JsonPropertyName("type")]
+ public string UserType { get; set; } = string.Empty;
+}
+
+public class SafeNSoundAuthResult { }
\ No newline at end of file
|