-
Notifications
You must be signed in to change notification settings - Fork 29
/
Image.cs
80 lines (74 loc) · 2.2 KB
/
Image.cs
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Wechaty.Module.Filebox;
using Wechaty.Module.Puppet.Schemas;
namespace Wechaty.User
{
/// <summary>
/// image
/// </summary>
public class Image : Accessory<Image>
{
/// <summary>
/// init <see cref="Image"/>
/// </summary>
/// <param name="id"></param>
/// <param name="wechaty"></param>
/// <param name="logger"></param>
/// <param name="name"></param>
public Image([DisallowNull] string id,
[DisallowNull] Wechaty wechaty,
[DisallowNull] ILogger<Image> logger,
[AllowNull] string? name = null) : base(wechaty, logger, name)
{
Id = id;
if (Logger.IsEnabled(LogLevel.Trace))
{
Logger.LogTrace($"constructor({id})");
}
}
/// <summary>
/// id
/// </summary>
public string Id { get; }
/// <summary>
/// thumbnail
/// </summary>
/// <returns></returns>
public async Task<FileBox> Thumbnail()
{
if (Logger.IsEnabled(LogLevel.Trace))
{
Logger.LogTrace($"thumbnail() for id: \"{Id}\"");
}
return await Puppet.MessageImage(Id, ImageType.Thumbnail);
}
/// <summary>
/// hd
/// </summary>
/// <returns></returns>
public async Task<FileBox> HD()
{
if (Logger.IsEnabled(LogLevel.Trace))
{
Logger.LogTrace($"hd() for id: \"{Id}\"");
}
return await Puppet.MessageImage(Id, ImageType.HD);
}
/// <summary>
/// artwork
/// </summary>
/// <returns></returns>
public async Task<FileBox> Artwork()
{
if (Logger.IsEnabled(LogLevel.Trace))
{
Logger.LogTrace($"artwork() for id: \"{Id}\"");
}
return await Puppet.MessageImage(Id, ImageType.Artwork);
}
///<inheritdoc/>
public override Image ToImplement => this;
}
}