set-snipeitcomponent

This commit is contained in:
Petri Asikainen 2021-06-13 18:35:43 +03:00
parent dfb271dbec
commit 83eb363889

View file

@ -49,8 +49,8 @@ function Set-SnipeitComponent()
)]
Param(
[parameter(mandatory = $true)]
[int]$id,
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
[int[]]$id,
[parameter(mandatory = $true)]
[int]$qty,
@ -74,7 +74,7 @@ function Set-SnipeitComponent()
[parameter(mandatory = $true)]
[string]$apiKey
)
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -84,9 +84,12 @@ function Set-SnipeitComponent()
}
$Body = $values | ConvertTo-Json;
}
process {
foreach($component_id in $id){
$Parameters = @{
Uri = "$url/api/v1/components/$id"
Uri = "$url/api/v1/components/$component_id"
Method = 'Patch'
Body = $Body
Token = $apiKey
@ -99,3 +102,5 @@ function Set-SnipeitComponent()
$result
}
}
}