diff options
author | crupest <crupest@outlook.com> | 2021-04-27 19:37:11 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-04-27 19:37:11 +0800 |
commit | ac309245d21f16c06abe2d1d9bb260e094d0805e (patch) | |
tree | 2ed691e4853aae0a527d4c9b7c0d00a4cf07a3af /BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs | |
parent | a6150c487e7a0eb3fb1d9874d2fa7de61cdbfd30 (diff) | |
download | timeline-ac309245d21f16c06abe2d1d9bb260e094d0805e.tar.gz timeline-ac309245d21f16c06abe2d1d9bb260e094d0805e.tar.bz2 timeline-ac309245d21f16c06abe2d1d9bb260e094d0805e.zip |
refactor: ...
Diffstat (limited to 'BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs')
-rw-r--r-- | BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs b/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs new file mode 100644 index 00000000..fda35aac --- /dev/null +++ b/BackEnd/Timeline/Services/User/Avatar/IUserAvatarService.cs @@ -0,0 +1,45 @@ +using System;
+using System.Threading.Tasks;
+using Timeline.Helpers.Cache;
+using Timeline.Models;
+using Timeline.Services.Imaging;
+
+namespace Timeline.Services.User.Avatar
+{
+ public interface IUserAvatarService
+ {
+ /// <summary>
+ /// Get avatar digest of a user.
+ /// </summary>
+ /// <param name="userId">User id.</param>
+ /// <returns>The avatar digest.</returns>
+ /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ Task<ICacheableDataDigest> GetAvatarDigest(long userId);
+
+ /// <summary>
+ /// Get avatar of a user. If the user has no avatar set, a default one is returned.
+ /// </summary>
+ /// <param name="userId">User id.</param>
+ /// <returns>The avatar.</returns>
+ /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ Task<ByteData> GetAvatar(long userId);
+
+ /// <summary>
+ /// Set avatar for a user.
+ /// </summary>
+ /// <param name="userId">User id.</param>
+ /// <param name="avatar">The new avatar data.</param>
+ /// <returns>The digest of the avatar.</returns>
+ /// <exception cref="ArgumentNullException">Thrown if <paramref name="avatar"/> is null.</exception>
+ /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ /// <exception cref="ImageException">Thrown if avatar is of bad format.</exception>
+ Task<ICacheableDataDigest> SetAvatar(long userId, ByteData avatar);
+
+ /// <summary>
+ /// Remove avatar of a user.
+ /// </summary>
+ /// <param name="userId">User id.</param>
+ /// <exception cref="UserNotExistException">Thrown when user does not exist.</exception>
+ Task DeleteAvatar(long userId);
+ }
+}
|