using System; using System.Collections.Generic; using System.Threading.Tasks; using Timeline.Entities; namespace Timeline.Services.User { public interface IUserService : IBasicUserService { /// /// Try to get a user by id. /// /// The id of the user. /// The user info. /// Thrown when the user with given id does not exist. Task GetUserAsync(long id); /// /// List all users. /// /// The user info of users. Task> GetUsersAsync(); /// /// Create a user with given info. /// /// Info of new user. /// The the new user. /// Thrown when is null. /// Thrown when param field is illegal. /// Thrown when a user with given username already exists. Task CreateUserAsync(CreateUserParams param); /// /// Modify a user. /// /// The id of the user. /// The new information. /// The new user info. /// Thrown when some fields in is bad. /// Thrown when user with given id does not exist. /// /// Version will increase if password is changed. /// Task ModifyUserAsync(long id, ModifyUserParams? param); /// /// Try to verify the given username and password. /// /// The username of the user to verify. /// The password of the user to verify. /// User id. /// Thrown when or is null. /// Thrown when is of bad format or is empty. /// Thrown when the user with given username does not exist. /// Thrown when password is wrong. Task VerifyCredential(string username, string password); /// /// Try to change a user's password with old password. /// /// The id of user to change password of. /// Old password. /// New password. /// Thrown if or is null. /// Thrown if or is empty. /// Thrown if the user with given username does not exist. /// Thrown if the old password is wrong. Task ChangePassword(long id, string oldPassword, string newPassword); } }