2021-05-25 22:53:22 +03:00
|
|
|
<#
|
|
|
|
|
.SYNOPSIS
|
|
|
|
|
Get list of checked out accessories
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
Get list of checked out accessories
|
|
|
|
|
|
|
|
|
|
.PARAMETER id
|
|
|
|
|
Unique ID For accessory to list
|
|
|
|
|
|
|
|
|
|
.PARAMETER url
|
2021-08-02 08:14:38 +03:00
|
|
|
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
|
2021-05-25 22:53:22 +03:00
|
|
|
|
|
|
|
|
.PARAMETER apiKey
|
2021-08-02 08:14:38 +03:00
|
|
|
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
|
2021-05-25 22:53:22 +03:00
|
|
|
|
|
|
|
|
.EXAMPLE
|
2021-06-08 20:23:32 +03:00
|
|
|
Get-SnipeitAccessoryOwner -id 1
|
2021-05-25 22:53:22 +03:00
|
|
|
#>
|
2021-08-02 08:14:38 +03:00
|
|
|
function Get-SnipeitAccessoryOwner() {
|
2021-05-25 22:53:22 +03:00
|
|
|
[CmdletBinding(
|
|
|
|
|
SupportsShouldProcess = $true,
|
|
|
|
|
ConfirmImpact = "Medium"
|
|
|
|
|
)]
|
|
|
|
|
|
|
|
|
|
Param(
|
|
|
|
|
[parameter(mandatory = $true)]
|
|
|
|
|
[int]$id,
|
|
|
|
|
|
2021-07-31 22:25:13 +03:00
|
|
|
[parameter(mandatory = $false)]
|
2021-05-25 22:53:22 +03:00
|
|
|
[string]$url,
|
|
|
|
|
|
2021-07-31 22:25:13 +03:00
|
|
|
[parameter(mandatory = $false)]
|
2021-05-25 22:53:22 +03:00
|
|
|
[string]$apiKey
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
$Parameters = @{
|
2021-08-02 08:14:38 +03:00
|
|
|
Api = "/api/v1/accessories/$id/checkedout"
|
2021-05-25 22:53:22 +03:00
|
|
|
Method = 'GET'
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-02 08:14:38 +03:00
|
|
|
if ($PSBoundParameters.ContainsKey('apiKey')) {
|
|
|
|
|
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
|
2021-08-22 22:23:08 +03:00
|
|
|
Set-SnipeitPSLegacyApiKey -apiKey $apikey
|
2021-08-02 08:14:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($PSBoundParameters.ContainsKey('url')) {
|
|
|
|
|
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
|
2021-08-22 22:23:08 +03:00
|
|
|
Set-SnipeitPSLegacyUrl -url $url
|
2021-08-02 08:14:38 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
|
2021-05-25 22:53:22 +03:00
|
|
|
$result = Invoke-SnipeitMethod @Parameters
|
|
|
|
|
}
|
|
|
|
|
|
2021-08-23 17:12:29 +03:00
|
|
|
# reset legacy sessions
|
|
|
|
|
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
|
|
|
|
|
Reset-SnipeitPSLegacyApi
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-25 22:53:22 +03:00
|
|
|
return $result
|
|
|
|
|
}
|