blob: 7ec855aaeccf3caf2f48281779b2f588cc4c24a2 (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
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> GetAvatarDigestAsync(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> GetAvatarAsync(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> SetAvatarAsync(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 DeleteAvatarAsync(long userId);
}
}
|