Skip to content

Commit 208477f

Browse files
authored
Merge pull request #176 from snazy2000/develop
Add nullable ints and fix get asset by serial
2 parents 959c679 + 6e8d27e commit 208477f

22 files changed

+113
-83
lines changed

SnipeitPS/Public/Get-SnipeitAsset.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function Get-SnipeitAsset() {
172172
'Search' { $apiurl = "$url/api/v1/hardware" }
173173
'Get with id' {$apiurl= "$url/api/v1/hardware/$id"}
174174
'Get with asset tag' {$apiurl= "$url/api/v1/hardware/bytag/$asset_tag"}
175-
'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$asset_serial"}
175+
'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$serial"}
176176
'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"}
177177
'Assets overdue for auditing' {$apiurl = "$url/api/v1/hardware/audit/overdue"}
178178
}

SnipeitPS/Public/New-SnipeitUser.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
.PARAMETER active
1818
Can user log in to snipe-it?
1919
20+
.PARAMETER password
21+
Password for user
22+
2023
.PARAMETER notes
2124
User Notes
2225

SnipeitPS/Public/Set-SnipeitAccessory.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ Notes about the accessory
1414
.PARAMETER qty
1515
Quantity of the accessory you have
1616
17+
.PARAMETER min_amt
18+
Minimum amount of the accessory, before alert is triggered
19+
1720
.PARAMETER category_id
1821
ID number of the category the accessory belongs to
1922
@@ -78,11 +81,9 @@ function Set-SnipeitAccessory() {
7881
[ValidateRange(1, [int]::MaxValue)]
7982
[int]$category_id,
8083

81-
[ValidateRange(1, [int]::MaxValue)]
82-
[int]$company_id,
84+
[Nullable[System.Int32]]$company_id,
8385

84-
[ValidateRange(1, [int]::MaxValue)]
85-
[int]$manufacturer_id,
86+
[Nullable[System.Int32]]$manufacturer_id,
8687

8788

8889
[string]$order_number,
@@ -91,10 +92,9 @@ function Set-SnipeitAccessory() {
9192

9293
[datetime]$purchase_date,
9394

94-
[bool]$min_qty,
95+
[Nullable[System.Int32]]$min_amt,
9596

96-
[ValidateRange(1, [int]::MaxValue)]
97-
[int]$supplier_id,
97+
[Nullable[System.Int32]]$supplier_id,
9898

9999
[parameter(mandatory = $true)]
100100
[string]$url,

SnipeitPS/Public/Set-SnipeitAsset.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,23 @@ function Set-SnipeitAsset()
8989

9090
[string]$name,
9191

92+
[ValidateRange(1, [int]::MaxValue)]
9293
[int]$status_id,
9394

95+
[ValidateRange(1, [int]::MaxValue)]
9496
[int]$model_id,
9597

9698
[DateTime]$last_checkout,
9799

98-
[int]$assigned_to,
100+
[Nullable[System.Int32]]$assigned_to,
99101

100-
[int]$company_id,
102+
[Nullable[System.Int32]]$company_id,
101103

102104
[string]$serial,
103105

104106
[string]$order_number,
105107

106-
[int]$warranty_months,
108+
[Nullable[System.Int32]]$warranty_months,
107109

108110
[double]$purchase_cost,
109111

@@ -113,7 +115,7 @@ function Set-SnipeitAsset()
113115

114116
[bool]$archived,
115117

116-
[int]$rtd_location_id,
118+
[Nullable[System.Int32]]$rtd_location_id,
117119

118120
[string]$notes,
119121

SnipeitPS/Public/Set-SnipeitComponent.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ function Set-SnipeitComponent()
5858
[parameter(mandatory = $true)]
5959
[int]$qty,
6060

61-
[int]$min_amt,
61+
[Nullable[System.Int32]]$min_amt,
6262

6363
[string]$name,
6464

65-
[int]$company_id,
65+
[Nullable[System.Int32]]$company_id,
6666

67-
[int]$location_id,
67+
[Nullable[System.Int32]]$location_id,
6868

6969

7070
[string]$order_number,

SnipeitPS/Public/Set-SnipeitConsumable.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,25 +75,27 @@ function Set-SnipeitConsumable()
7575
[string]$name,
7676

7777
[parameter(mandatory = $false)]
78+
[ValidateRange(1, [int]::MaxValue)]
7879
[int]$qty,
7980

8081
[parameter(mandatory = $false)]
82+
[ValidateRange(1, [int]::MaxValue)]
8183
[int]$category_id,
8284

8385
[parameter(mandatory = $false)]
84-
[int]$min_amt,
86+
[Nullable[System.Int32]]$min_amt,
8587

8688
[parameter(mandatory = $false)]
87-
[int]$company_id,
89+
[Nullable[System.Int32]]$company_id,
8890

8991
[parameter(mandatory = $false)]
9092
[string]$order_number,
9193

9294
[parameter(mandatory = $false)]
93-
[int]$manufacturer_id,
95+
[Nullable[System.Int32]]$manufacturer_id,
9496

9597
[parameter(mandatory = $false)]
96-
[int]$location_id,
98+
[Nullable[System.Int32]]$location_id,
9799

98100
[parameter(mandatory = $false)]
99101
[bool]$requestable,

SnipeitPS/Public/Set-SnipeitDepartment.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ function Set-SnipeitDepartment() {
4343

4444
[string]$name,
4545

46-
[int]$company_id,
46+
[Nullable[System.Int32]]$company_id,
4747

48-
[int]$location_id,
48+
[Nullable[System.Int32]]$location_id,
4949

50-
[int]$manager_id,
50+
[Nullable[System.Int32]]$manager_id,
5151

5252
[string]$notes,
5353

SnipeitPS/Public/Set-SnipeitLicense.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,11 @@ function Set-SnipeitLicense() {
8989
[ValidateRange(1, [int]::MaxValue)]
9090
[int]$category_id,
9191

92-
[ValidateRange(1, [int]::MaxValue)]
93-
[int]$company_id,
92+
93+
[Nullable[System.Int32]]$company_id,
9494

9595
[datetime]$expiration_date,
9696

97-
[ValidateLength(1, 120)]
9897
[mailaddress]$license_email,
9998

10099
[ValidateLength(1, 100)]
@@ -118,8 +117,7 @@ function Set-SnipeitLicense() {
118117

119118
[string]$serial,
120119

121-
[ValidateRange(1, [int]::MaxValue)]
122-
[int]$supplier_id,
120+
[Nullable[System.Int32]]$supplier_id,
123121

124122
[datetime]$termination_date,
125123

SnipeitPS/Public/Set-SnipeitLocation.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ function Set-SnipeitLocation() {
8282

8383
[string]$currency,
8484

85-
[int]$manager_id,
85+
[Nullable[System.Int32]]$manager_id,
8686

8787
[string]$ldap_ou,
8888

89-
[int]$parent_id,
89+
[Nullable[System.Int32]]$parent_id,
9090

9191
[parameter(mandatory = $true)]
9292
[string]$url,

SnipeitPS/Public/Set-SnipeitModel.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ function Set-SnipeitModel() {
5252

5353
[int]$manufacturer_id,
5454

55-
[ValidateRange(1, 240)]
56-
[int]$eol,
55+
[Nullable[System.Int32]]$eol,
5756

5857
[Alias("fieldset_id")]
59-
[int]$custom_fieldset_id,
58+
[Nullable[System.Int32]]$custom_fieldset_id,
6059

6160
[parameter(mandatory = $true)]
6261
[string]$url,

0 commit comments

Comments
 (0)