Class UserDataService
public class UserDataService : IUserDataService, IDisposable
- Inheritance
-
UserDataService
- Implements
- Inherited Members
- Extension Methods
Constructors
UserDataService(IUserDataDbContext)
public UserDataService(IUserDataDbContext dbContext)
Parameters
dbContextIUserDataDbContext
Methods
AddOrUpdateAsync(ulong, Action<WarfareUserData, IDbContext>, CancellationToken)
Update a WarfareUserData object. Any added HWIDs and IP addresses need to be added using the IDbContext argument and any updated need to be updated using it.
public Task<WarfareUserData> AddOrUpdateAsync(ulong steam64, Action<WarfareUserData, IDbContext> update, CancellationToken token = default)
Parameters
steam64ulongupdateAction<WarfareUserData, IDbContext>tokenCancellationToken
Returns
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetDiscordIdAsync(ulong, CancellationToken)
Get a player's Discord ID, or 0 if their Discord is not linked.
public Task<ulong> GetDiscordIdAsync(ulong steam64, CancellationToken token = default)
Parameters
steam64ulongtokenCancellationToken
Returns
GetDiscordIdsAsync(IReadOnlyList<ulong>, CancellationToken)
Get a set of players' Discord IDs, or 0 if their Discord is not linked.
public Task<ulong[]> GetDiscordIdsAsync(IReadOnlyList<ulong> steam64s, CancellationToken token = default)
Parameters
steam64sIReadOnlyList<ulong>tokenCancellationToken
Returns
GetSteam64Async(ulong, CancellationToken)
Get a player's Steam64 ID from their Discord ID, or 0 if their Discord is not linked.
public Task<ulong> GetSteam64Async(ulong discordId, CancellationToken token = default)
Parameters
discordIdulongtokenCancellationToken
Returns
GetSteam64sAsync(IReadOnlyList<ulong>, CancellationToken)
Get a player's Steam64 ID from their Discord ID, or 0 if their Discord is not linked.
public Task<ulong[]> GetSteam64sAsync(IReadOnlyList<ulong> discordIds, CancellationToken token = default)
Parameters
discordIdsIReadOnlyList<ulong>tokenCancellationToken
Returns
GetUsernamesAsync(ulong, CancellationToken)
Get a player's usernames from their Steam64 ID.
public Task<PlayerNames> GetUsernamesAsync(ulong steam64, CancellationToken token = default)
Parameters
steam64ulongtokenCancellationToken
Returns
ReadAsync(IEnumerable<ulong>, CancellationToken)
Get multiple players' user data in bulk if they've joined. Not necessarily returned in the same order as it was inputted.
public Task<IReadOnlyList<WarfareUserData>> ReadAsync(IEnumerable<ulong> steam64, CancellationToken token = default)
Parameters
steam64IEnumerable<ulong>tokenCancellationToken
Returns
ReadAsync(ulong, CancellationToken)
Get a single player's user data if they've joined.
public Task<WarfareUserData?> ReadAsync(ulong steam64, CancellationToken token = default)
Parameters
steam64ulongtokenCancellationToken
Returns
ReadFromDiscordIdAsync(ulong, CancellationToken)
Get a single player's user data if they've joined from their Discord ID if it's linked.
public Task<WarfareUserData?> ReadFromDiscordIdAsync(ulong discordId, CancellationToken token = default)
Parameters
discordIdulongtokenCancellationToken
Returns
SearchFirstPlayerAsync(string, PlayerNameType, bool, CancellationToken)
Search all players that have ever joined by their usernames, and return the best match.
public Task<PlayerNames> SearchFirstPlayerAsync(string input, PlayerNameType prioritizedName, bool byLastJoined, CancellationToken token = default)
Parameters
inputstringprioritizedNamePlayerNameTypeThe type of name to prioritize.
byLastJoinedboolIf they should be ordered by the last time they joined. Exact matches will still be prioritized.
tokenCancellationToken
Returns
SearchPlayersAsync(string, PlayerNameType, bool, ICollection<PlayerNames>, int, CancellationToken)
Search all players that have ever joined by their usernames, and add them to a collection as they're found.
public Task<int> SearchPlayersAsync(string input, PlayerNameType prioritizedName, bool byLastJoined, ICollection<PlayerNames> output, int limit = -1, CancellationToken token = default)
Parameters
inputstringprioritizedNamePlayerNameTypeThe type of name to prioritize.
byLastJoinedboolIf they should be ordered by the last time they joined. Exact matches will still be prioritized.
outputICollection<PlayerNames>Collection to add matches to.
limitintMaximum number of names to find.
tokenCancellationToken