diff options
Diffstat (limited to 'NewTagDefinition.cs')
| -rw-r--r-- | NewTagDefinition.cs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/NewTagDefinition.cs b/NewTagDefinition.cs new file mode 100644 index 0000000..c1fd971 --- /dev/null +++ b/NewTagDefinition.cs @@ -0,0 +1,28 @@ +using HyperBooru.ApiClient; +using HyperBooru.ApiModels; +using System.Management.Automation; + +namespace HyperBooru.PowerShell; + +[Alias("nhbtd")] +[Cmdlet(VerbsCommon.New, "HyperBooruTagDefinition")] +public class NewTagDefinitionCmdlet : PSCmdlet { + [Parameter(Mandatory = true)] + public required HBSession Session { get; set; } + + [Parameter] public string? Namespace { get; set; } + [Parameter(Mandatory = true)] public required string Name { get; set; } + [Parameter] public string? Alias { get; set; } + [Parameter] public Guid[]? ImplicitTags { get; set; } + + protected override void ProcessRecord() { + var tagDefinition = Session.Tag.CreateTagDefinitionAsync(new TagCreateRequest { + Namespace = Namespace, + Name = Name, + Alias = Alias, + ImplicitTags = ImplicitTags + }).GetAwaiter().GetResult(); + + WriteObject(tagDefinition); + } +} |
