From aac3caf8a2980d7d0598d1e31b4d2f1308ff3509 Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 4 Sep 2026 12:34:59 +0200 Subject: [PATCH] Logout method in SDK, make gateway errors more verbose --- .../Utilities/Spacebar.Sdk/Core/SpacebarClient.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extra/admin-api/Utilities/Spacebar.Sdk/Core/SpacebarClient.cs b/extra/admin-api/Utilities/Spacebar.Sdk/Core/SpacebarClient.cs index 976dda1e6..b4d8bc950 100644 --- a/extra/admin-api/Utilities/Spacebar.Sdk/Core/SpacebarClient.cs +++ b/extra/admin-api/Utilities/Spacebar.Sdk/Core/SpacebarClient.cs @@ -81,6 +81,12 @@ public class AuthenticatedSpacebarClient { if (!resp.IsSuccessStatusCode) throw SpacebarApiException.FromJson((await resp.Content.ReadFromJsonAsync())!); return (await resp.Content.ReadFromJsonAsync>())!; } + + public async Task LogOutAsync() + { + var resp = await ApiHttpClient.PostAsJsonAsync("auth/logout", new {}); + if (!resp.IsSuccessStatusCode) throw SpacebarApiException.FromJson((await resp.Content.ReadFromJsonAsync())!); + } } public class SpacebarClientChannel(AuthenticatedSpacebarClient client, long channelId) { @@ -204,7 +210,7 @@ public class AuthenticatedSpacebarGatewayClient(ILogger()!.HeartbeatInterval, _cts.Token).ContinueWith(ct => { - logger.LogWarning("Heartbeat loop exited!"); + logger.LogWarning("Heartbeat loop exited! ({code}: {reason})", RawClientWebSocket.CloseStatus, RawClientWebSocket.CloseStatusDescription); if (ct.IsFaulted) throw ct.Exception; }); IdentifyData.Token = token;