summaryrefslogtreecommitdiff
path: root/SetTagDefinition.cs
diff options
context:
space:
mode:
Diffstat (limited to 'SetTagDefinition.cs')
-rw-r--r--SetTagDefinition.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/SetTagDefinition.cs b/SetTagDefinition.cs
new file mode 100644
index 0000000..51a18f4
--- /dev/null
+++ b/SetTagDefinition.cs
@@ -0,0 +1,31 @@
+using HyperBooru.ApiClient;
+using HyperBooru.ApiModels;
+using System.Management.Automation;
+
+namespace HyperBooru.PowerShell;
+
+[Alias("shbtd")]
+[Cmdlet(VerbsCommon.Set, "HyperBooruTagDefinition")]
+public class SetTagDefinitionCmdlet : PSCmdlet {
+ [Parameter(Mandatory = true)]
+ public required HBSession Session { get; set; }
+
+ [Parameter(Mandatory = true)]
+ public required Guid TagDefinitionId { get; set; }
+
+ [Parameter] public string? Namespace { get; set; }
+ [Parameter] public string? Name { get; set; }
+ [Parameter] public string? Alias { get; set; }
+
+ protected override void ProcessRecord() {
+ var tagDefinition = Session.Tag.UpdateTagDefinitionAsync(
+ TagDefinitionId,
+ new TagUpdateRequest {
+ Namespace = Namespace,
+ Name = Name,
+ Alias = Alias
+ }).GetAwaiter().GetResult();
+
+ WriteObject(tagDefinition);
+ }
+}