blob: 7b9ab07dccf76c6d582910e8ec2b1b9db45fb0ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
using HyperBooru.ApiClient;
using System.Management.Automation;
using System.Security;
namespace HyperBooru.PowerShell;
[Alias("nhbu")]
[Cmdlet(VerbsCommon.New, "HyperBooruUser")]
public class NewUserCmdlet : PSCmdlet {
[Parameter(Position = 0, Mandatory = true)]
public HBSession Session { get; set; }
[Parameter(Position = 1, Mandatory = true)]
public string Username { get; set; }
[Parameter(Position = 2, Mandatory = true)]
public SecureString Password { get; set; }
protected override void ProcessRecord() {
var user = Session.User.CreateUserAsync(Username, Password.ToInsecureString())
.GetAwaiter()
.GetResult();
WriteObject(user);
}
}
|