-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIAccountDisconnectService.cs
More file actions
33 lines (30 loc) · 1.77 KB
/
Copy pathIAccountDisconnectService.cs
File metadata and controls
33 lines (30 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
namespace RustPlusBot.Features.Pairing.Accounts;
/// <summary>Full account disconnect: stop the listener, disable the registration, drop the user's pool credentials.</summary>
internal interface IAccountDisconnectService
{
/// <summary>Reads what a disconnect would affect, for the confirmation dialog.</summary>
/// <param name="guildId">The owning guild snowflake.</param>
/// <param name="ownerUserId">The Discord user.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>Whether the user is connected and the names of servers they would be removed from.</returns>
Task<AccountDisconnectPreview> PreviewAsync(
ulong guildId,
ulong ownerUserId,
CancellationToken cancellationToken = default);
/// <summary>
/// Stops the user's FCM listener, marks their registration Disabled, removes all their pool credentials
/// in the guild, and publishes a <c>ServerCredentialsChangedEvent</c> per affected server.
/// </summary>
/// <param name="guildId">The owning guild snowflake.</param>
/// <param name="ownerUserId">The Discord user.</param>
/// <param name="cancellationToken">A cancellation token.</param>
/// <returns>The number of servers the user was removed from.</returns>
Task<int> DisconnectAsync(
ulong guildId,
ulong ownerUserId,
CancellationToken cancellationToken = default);
}
/// <summary>What an account disconnect would affect.</summary>
/// <param name="IsConnected">True if the user has a non-Disabled registration or any pool credential.</param>
/// <param name="AffectedServerNames">Names of servers the user holds a credential for.</param>
internal sealed record AccountDisconnectPreview(bool IsConnected, IReadOnlyList<string> AffectedServerNames);