1 files changed, 47 insertions, 0 deletions
diff --git a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
index 8b06c30..4376d3f 100644
--- a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
+++ b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
@@ -118,6 +118,21 @@ public class SafeNSoundClient(SafeNSoundConfiguration config, string accessToken
var res = await HttpClient.PostAsync("/auth/logout", null);
res.EnsureSuccessStatusCode();
}
+
+ public async Task AddBudget(string userId, BudgetWithReason budget) {
+ var res = await HttpClient.PatchAsJsonAsync($"/user/{userId}/budget", budget);
+ res.EnsureSuccessStatusCode();
+ }
+
+ public async Task<BudgetWithHistory> GetBudget(string userId = "@me") {
+ var res = await HttpClient.GetAsync(
+ userId == "@me"
+ ? $"/budget"
+ : $"/user/{userId}/budget"
+ );
+ res.EnsureSuccessStatusCode();
+ return (await res.Content.ReadFromJsonAsync<BudgetWithHistory>())!;
+ }
}
public class AlarmDto {
@@ -140,4 +155,36 @@ public class DeviceDto {
[JsonPropertyName("lastSeen")]
public DateTime LastSeen { get; set; }
+}
+
+public class Budget {
+ [JsonPropertyName("budget")]
+ public double Amount { get; set; }
+}
+
+public class BudgetWithReason : Budget {
+ [JsonPropertyName("reason")]
+ public string? Reason { get; set; }
+}
+
+public class BudgetWithHistory {
+ [JsonPropertyName("budget")]
+ public double Amount { get; set; }
+
+ [JsonPropertyName("history")]
+ public List<BudgetHistoryEntry> History { get; set; } = new();
+}
+
+public class BudgetHistoryEntry {
+ [JsonPropertyName("venue")]
+ public string Venue { get; set; }
+
+ [JsonPropertyName("amount")]
+ public double Amount { get; set; }
+
+ [JsonPropertyName("reason")]
+ public string Reason { get; set; }
+
+ [JsonPropertyName("createdAt")]
+ public DateTime CreatedAt { get; set; }
}
\ No newline at end of file
|