diff options
Diffstat (limited to 'SetMediaTag.cs')
| -rw-r--r-- | SetMediaTag.cs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/SetMediaTag.cs b/SetMediaTag.cs new file mode 100644 index 0000000..8931991 --- /dev/null +++ b/SetMediaTag.cs @@ -0,0 +1,22 @@ +using HyperBooru.ApiClient; +using System.Management.Automation; + +namespace HyperBooru.PowerShell; + +[Alias("shbmt")] +[Cmdlet(VerbsCommon.Set, "HyperBooruMediaTag")] +public class SetMediaTagCmdlet : PSCmdlet { + [Parameter(Position = 0, Mandatory = true)] + public required HBSession Session { get; set; } + + [Parameter(Position = 1, Mandatory = true)] + public Guid MediaId { get; set; } + + [Parameter(Position = 2, Mandatory = true)] + public Guid[] TagId { get; set; } + + protected override void ProcessRecord() => + Session.Media.ReplaceTagsAsync(MediaId, TagId) + .GetAwaiter() + .GetResult(); +} |
