1 files changed, 8 insertions, 13 deletions
diff --git a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
index 4376d3f..e1564db 100644
--- a/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
+++ b/testFrontend/SafeNSound.Sdk/SafeNSoundClient.cs
@@ -119,15 +119,20 @@ public class SafeNSoundClient(SafeNSoundConfiguration config, string accessToken
res.EnsureSuccessStatusCode();
}
- public async Task AddBudget(string userId, BudgetWithReason budget) {
+ public async Task AddBudget(string userId, BudgetHistoryEntry budget) {
var res = await HttpClient.PatchAsJsonAsync($"/user/{userId}/budget", budget);
res.EnsureSuccessStatusCode();
}
+
+ public async Task SpendBudget(BudgetHistoryEntry budget) {
+ var res = await HttpClient.PatchAsJsonAsync($"/budget/@me", budget);
+ res.EnsureSuccessStatusCode();
+ }
public async Task<BudgetWithHistory> GetBudget(string userId = "@me") {
var res = await HttpClient.GetAsync(
userId == "@me"
- ? $"/budget"
+ ? $"/budget/@me"
: $"/user/{userId}/budget"
);
res.EnsureSuccessStatusCode();
@@ -157,16 +162,6 @@ public class DeviceDto {
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; }
@@ -186,5 +181,5 @@ public class BudgetHistoryEntry {
public string Reason { get; set; }
[JsonPropertyName("createdAt")]
- public DateTime CreatedAt { get; set; }
+ public DateTime? CreatedAt { get; set; }
}
\ No newline at end of file
|