summary refs log tree commit diff
path: root/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2025-06-02 10:12:34 +0200
committerRory& <root@rory.gay>2025-06-02 10:12:34 +0200
commitc4fd9c93a63bce7c322aec1fc304b4dc5ac5a9cd (patch)
tree4cea31f08115376fefc2cdfed5befbc5610150f8 /testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
parentAdd shortcut for generating http file, part of API documentation (diff)
downloadnodejs-final-assignment-c4fd9c93a63bce7c322aec1fc304b4dc5ac5a9cd.tar.xz
Split authentication and authorization
Diffstat (limited to 'testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs')
-rw-r--r--testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs

index 05d0af9..4d81b52 100644 --- a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs +++ b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
@@ -12,6 +12,14 @@ public class SafeNSoundClient(SafeNSoundConfiguration config, string accessToken Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", accessToken) } }; + + public async Task<WhoAmI> WhoAmI() + { + var res = await HttpClient.GetAsync("/auth/whoami"); + res.EnsureSuccessStatusCode(); + return (await res.Content.ReadFromJsonAsync<WhoAmI>())!; + } + #region Alarm public async Task<AlarmDto> GetAlarm(string userId = "@me") {