1 files changed, 15 insertions, 8 deletions
diff --git a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
index 3cd5d5c..b5bca12 100644
--- a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
+++ b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
@@ -66,12 +66,14 @@ public class SafeNSoundClient(SafeNSoundConfiguration config, string accessToken
res.EnsureSuccessStatusCode();
}
- public async Task<BudgetWithHistory> GetBudget(string userId = "@me") {
- var res = await HttpClient.GetAsync(
- userId == "@me"
- ? $"/budget/@me"
- : $"/user/{userId}/budget"
- );
+ public async Task<CurrentBalance> GetBudget() {
+ var res = await HttpClient.GetAsync($"/budget/@me");
+ res.EnsureSuccessStatusCode();
+ return (await res.Content.ReadFromJsonAsync<CurrentBalance>())!;
+ }
+
+ public async Task<BudgetWithHistory> GetBudget(string userId) {
+ var res = await HttpClient.GetAsync($"/user/{userId}/budget");
res.EnsureSuccessStatusCode();
return (await res.Content.ReadFromJsonAsync<BudgetWithHistory>())!;
}
@@ -143,7 +145,7 @@ public class SafeNSoundClient(SafeNSoundConfiguration config, string accessToken
public class AlarmDto {
[JsonPropertyName("_id")]
public string? Id { get; set; }
-
+
[JsonPropertyName("reason")]
public required string Reason { get; set; }
@@ -165,8 +167,13 @@ public class DeviceDto {
public DateTime LastSeen { get; set; }
}
+public class CurrentBalance {
+ [JsonPropertyName("currentBalance")]
+ public double Amount { get; set; }
+}
+
public class BudgetWithHistory {
- [JsonPropertyName("budget")]
+ [JsonPropertyName("balance")]
public double Amount { get; set; }
[JsonPropertyName("history")]
|