summaryrefslogtreecommitdiff
path: root/GetMediaTag.cs
diff options
context:
space:
mode:
Diffstat (limited to 'GetMediaTag.cs')
-rw-r--r--GetMediaTag.cs22
1 files changed, 22 insertions, 0 deletions
diff --git a/GetMediaTag.cs b/GetMediaTag.cs
new file mode 100644
index 0000000..90d9835
--- /dev/null
+++ b/GetMediaTag.cs
@@ -0,0 +1,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);
+ }
+}