summaryrefslogtreecommitdiff
path: root/GetMediaTag.cs
blob: 90d98354d104372f1d7655cc0c6dd6990dde1bb7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using HyperBooru.ApiClient;
using System.Management.Automation;

namespace HyperBooru.PowerShell;

[Alias("ghbmt")]
[Cmdlet(VerbsCommon.Get, "HyperBooruMediaTag")]
public class GetMediaTagCmdlet : PSCmdlet {
    [Parameter(Position = 0, Mandatory = true)]
    public required HBSession Session { get; set; }

    [Parameter(Position = 1, Mandatory = true)]
    public Guid MediaId { get; set; }

    protected override void ProcessRecord() {
        var tags = Session.Media.GetTagsAsync(MediaId)
            .GetAwaiter()
            .GetResult();
        foreach(var td in tags)
            WriteObject(td);
    }
}