mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
Merge pull request #121 from PetriAsi/fix/datetime-inputs
check datetime and int input types
This commit is contained in:
commit
160ba60069
11 changed files with 40 additions and 35 deletions
|
|
@ -106,7 +106,7 @@ function New-SnipeItAsset()
|
|||
[string]$purchase_cost,
|
||||
|
||||
[parameter(mandatory = $false)]
|
||||
[string]$purchase_date,
|
||||
[datetime]$purchase_date,
|
||||
|
||||
[parameter(mandatory = $false)]
|
||||
[int]$supplier_id,
|
||||
|
|
@ -127,6 +127,9 @@ function New-SnipeItAsset()
|
|||
|
||||
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||
|
||||
if ($values['purchase_date']) {
|
||||
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
||||
}
|
||||
|
||||
if ($customfields)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ function Remove-SnipeItAsset ()
|
|||
|
||||
Param(
|
||||
[parameter(mandatory = $true)]
|
||||
[int]$ID,
|
||||
[int]$id,
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$URL,
|
||||
[parameter(mandatory = $true)]
|
||||
|
|
@ -35,7 +35,7 @@ function Remove-SnipeItAsset ()
|
|||
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||
|
||||
$Values = @{
|
||||
"ID" = $Name
|
||||
"ID" = $id
|
||||
}
|
||||
|
||||
$Body = $Values | ConvertTo-Json
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ function Remove-SnipeItAssetMaintenance {
|
|||
# Asset maintenance ID
|
||||
[Parameter(Mandatory = $true)]
|
||||
[int]
|
||||
$ID,
|
||||
$id,
|
||||
|
||||
# SnipeIt URL
|
||||
[Parameter(Mandatory = $true)]
|
||||
|
|
@ -39,7 +39,7 @@ function Remove-SnipeItAssetMaintenance {
|
|||
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||
|
||||
$Values = @{
|
||||
"ID" = $ID
|
||||
"ID" = $id
|
||||
}
|
||||
|
||||
$Body = $Values | ConvertTo-Json
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ function Remove-SnipeItUser ()
|
|||
|
||||
Param(
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$ID,
|
||||
[int]$id,
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$URL,
|
||||
[parameter(mandatory = $true)]
|
||||
|
|
@ -36,7 +36,7 @@ function Remove-SnipeItUser ()
|
|||
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||
|
||||
$Values = @{
|
||||
"ID" = $ID
|
||||
"ID" = $id
|
||||
}
|
||||
|
||||
$Body = $Values | ConvertTo-Json
|
||||
|
|
|
|||
|
|
@ -79,9 +79,9 @@ function Set-SnipeItAsset()
|
|||
|
||||
[string]$Name,
|
||||
|
||||
[string]$Status_id,
|
||||
[int]$status_id,
|
||||
|
||||
[string]$Model_id,
|
||||
[int]$model_id,
|
||||
|
||||
[DateTime]$last_checkout,
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ function Set-SnipeItAsset()
|
|||
|
||||
[double]$purchase_cost,
|
||||
|
||||
[DateTime]$purchase_date,
|
||||
[datetime]$purchase_date,
|
||||
|
||||
[bool]$requestable,
|
||||
|
||||
|
|
@ -118,7 +118,9 @@ function Set-SnipeItAsset()
|
|||
|
||||
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters
|
||||
|
||||
if ($model_id) { $Values.Add('model_id',$model_id)}
|
||||
if ($values['purchase_date']) {
|
||||
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
|
||||
}
|
||||
|
||||
if ($customfields)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ function Set-SnipeItComponent()
|
|||
|
||||
Param(
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$id,
|
||||
[int]$id,
|
||||
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$qty,
|
||||
[int]$qty,
|
||||
|
||||
[string]$name,
|
||||
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ Add a new Asset to Snipe-it asset system
|
|||
```
|
||||
New-SnipeItAsset [-status_id] <Int32> [-model_id] <Int32> [[-name] <String>] [[-asset_tag] <String>]
|
||||
[[-serial] <String>] [[-company_id] <Int32>] [[-order_number] <String>] [[-notes] <String>]
|
||||
[[-warranty_months] <Int32>] [[-purchase_cost] <String>] [[-purchase_date] <String>] [[-supplier_id] <Int32>]
|
||||
[[-rtd_location_id] <Int32>] [-url] <String> [-apiKey] <String> [[-customfields] <Hashtable>] [-WhatIf]
|
||||
[-Confirm] [<CommonParameters>]
|
||||
[[-warranty_months] <Int32>] [[-purchase_cost] <String>] [[-purchase_date] <DateTime>]
|
||||
[[-supplier_id] <Int32>] [[-rtd_location_id] <Int32>] [-url] <String> [-apiKey] <String>
|
||||
[[-customfields] <Hashtable>] [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
|
@ -188,7 +188,7 @@ Accept wildcard characters: False
|
|||
Optional Purchase cost of the Asset
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Type: DateTime
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Removes Asset from Snipe-it asset system
|
|||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-SnipeItAsset [-ID] <Int32> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Remove-SnipeItAsset [-id] <Int32> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
|
@ -43,7 +43,7 @@ Accept pipeline input: False
|
|||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ID
|
||||
### -id
|
||||
Unique ID For Asset to be removed
|
||||
|
||||
```yaml
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Removes User from Snipe-it asset system
|
|||
## SYNTAX
|
||||
|
||||
```
|
||||
Remove-SnipeItUser [-ID] <String> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
Remove-SnipeItUser [-id] <Int32> [-URL] <String> [-APIKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
||||
## DESCRIPTION
|
||||
|
|
@ -43,17 +43,17 @@ Accept pipeline input: False
|
|||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ID
|
||||
### -id
|
||||
Unique ID For User to be removed
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Default value: None
|
||||
Default value: 0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Update a specific Asset in the Snipe-it asset system
|
|||
## SYNTAX
|
||||
|
||||
```
|
||||
Set-SnipeItAsset [-id] <Int32> [[-Name] <String>] [[-Status_id] <String>] [[-Model_id] <String>]
|
||||
Set-SnipeItAsset [-id] <Int32> [[-Name] <String>] [[-status_id] <Int32>] [[-model_id] <Int32>]
|
||||
[[-last_checkout] <DateTime>] [[-assigned_to] <Int32>] [[-company_id] <Int32>] [[-serial] <String>]
|
||||
[[-order_number] <String>] [[-warranty_months] <Int32>] [[-purchase_cost] <Double>]
|
||||
[[-purchase_date] <DateTime>] [[-requestable] <Boolean>] [[-archived] <Boolean>] [[-rtd_location_id] <Int32>]
|
||||
|
|
@ -143,17 +143,17 @@ Accept pipeline input: False
|
|||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Model_id
|
||||
### -model_id
|
||||
Model ID of the asset, this can be got using Get-Model
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 4
|
||||
Default value: None
|
||||
Default value: 0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
|
@ -263,17 +263,17 @@ Accept pipeline input: False
|
|||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Status_id
|
||||
### -status_id
|
||||
Status ID of the asset, this can be got using Get-Status
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: 3
|
||||
Default value: None
|
||||
Default value: 0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Updates component
|
|||
## SYNTAX
|
||||
|
||||
```
|
||||
Set-SnipeItComponent [-id] <String> [-qty] <String> [[-name] <String>] [[-company_id] <Int32>]
|
||||
Set-SnipeItComponent [-id] <Int32> [-qty] <Int32> [[-name] <String>] [[-company_id] <Int32>]
|
||||
[[-location_id] <Int32>] [[-purchase_date] <DateTime>] [[-purchase_cost] <Single>] [-url] <String>
|
||||
[-apiKey] <String> [-WhatIf] [-Confirm] [<CommonParameters>]
|
||||
```
|
||||
|
|
@ -64,13 +64,13 @@ Accept wildcard characters: False
|
|||
ID number of name
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 1
|
||||
Default value: None
|
||||
Default value: 0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
|
@ -139,13 +139,13 @@ Accept wildcard characters: False
|
|||
Quantity of the components you have
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 2
|
||||
Default value: None
|
||||
Default value: 0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue