sharp-chat/SharpChat.Common/DataProvider/Null/NullUserClient.cs

34 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-08-30 15:05:29 +00:00
using SharpChat.Users;
using SharpChat.Users.Remote;
using System;
using System.Collections.Generic;
namespace SharpChat.DataProvider.Null {
public class NullUserClient : IRemoteUserClient {
public void AuthenticateUser(UserAuthRequest request, Action<IUserAuthResponse> onSuccess, Action<Exception> onFailure) {
if(request.Token.StartsWith(@"FAIL:")) {
onFailure(new UserAuthFailedException(request.Token[5..]));
return;
}
onSuccess(new NullUserAuthResponse(request));
}
public void BumpUsers(IEnumerable<UserBumpInfo> users, Action onSuccess, Action<Exception> onFailure) {
onSuccess();
}
public void ResolveUser(long userId, Action<IRemoteUser> onSuccess, Action<Exception> onFailure) {
onSuccess(null);
}
public void ResolveUser(string userName, Action<IRemoteUser> onSuccess, Action<Exception> onFailure) {
onSuccess(null);
}
public void ResolveUser(IUser localUser, Action<IRemoteUser> onSuccess, Action<Exception> onFailure) {
onSuccess(null);
}
}
}