mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
set-snipeitcomponent
This commit is contained in:
parent
dfb271dbec
commit
83eb363889
1 changed files with 24 additions and 19 deletions
|
|
@ -49,8 +49,8 @@ function Set-SnipeitComponent()
|
||||||
)]
|
)]
|
||||||
|
|
||||||
Param(
|
Param(
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||||
[int]$id,
|
[int[]]$id,
|
||||||
|
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[int]$qty,
|
[int]$qty,
|
||||||
|
|
@ -74,7 +74,7 @@ function Set-SnipeitComponent()
|
||||||
[parameter(mandatory = $true)]
|
[parameter(mandatory = $true)]
|
||||||
[string]$apiKey
|
[string]$apiKey
|
||||||
)
|
)
|
||||||
|
begin {
|
||||||
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
|
||||||
|
|
||||||
$values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
$values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||||
|
|
@ -84,9 +84,12 @@ function Set-SnipeitComponent()
|
||||||
}
|
}
|
||||||
|
|
||||||
$Body = $values | ConvertTo-Json;
|
$Body = $values | ConvertTo-Json;
|
||||||
|
}
|
||||||
|
|
||||||
|
process {
|
||||||
|
foreach($component_id in $id){
|
||||||
$Parameters = @{
|
$Parameters = @{
|
||||||
Uri = "$url/api/v1/components/$id"
|
Uri = "$url/api/v1/components/$component_id"
|
||||||
Method = 'Patch'
|
Method = 'Patch'
|
||||||
Body = $Body
|
Body = $Body
|
||||||
Token = $apiKey
|
Token = $apiKey
|
||||||
|
|
@ -98,4 +101,6 @@ function Set-SnipeitComponent()
|
||||||
}
|
}
|
||||||
|
|
||||||
$result
|
$result
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue