begin, process, end

This commit is contained in:
Petri Asikainen 2021-08-23 18:01:09 +03:00
parent 3446a885dc
commit 923838e15f
37 changed files with 1357 additions and 1201 deletions

View file

@ -36,18 +36,17 @@ function Invoke-SnipeitMethod {
BEGIN { BEGIN {
#use legacy per command based url and apikey #use legacy per command based url and apikey
if ( $null -ne $SnipeitPSSession.legacyUrl -and $null -ne $SnipeitPSSession.legacyApiKey ) { if ( $null -ne $SnipeitPSSession.legacyUrl -and $null -ne $SnipeitPSSession.legacyApiKey ) {
[string]$Url = $SnipeitPSSession.legacyrl [string]$Url = $SnipeitPSSession.legacyUrl
Write-Debug "Invoke-SnipeitMethod url: $Url" Write-Debug "Invoke-SnipeitMethod url: $Url"
$Token = ConvertFrom-SecureString -AsPlainText -SecureString $SnipeitPSSession.legacyApiKey $Token = ConvertFrom-SecureString -AsPlainText -SecureString $SnipeitPSSession.legacyApiKey
throw "Cannot connect to Snipe it. Please run Connect-SnipePS to set connection information."
} elseif ($null -ne $SnipeitPSSession.url -and $null -ne $SnipeitPSSession.apiKey) { } elseif ($null -ne $SnipeitPSSession.url -and $null -ne $SnipeitPSSession.apiKey) {
} else {
[string]$Url = $SnipeitPSSession.url [string]$Url = $SnipeitPSSession.url
Write-Debug "Invoke-SnipeitMethod url: $Url" Write-Debug "Invoke-SnipeitMethod url: $Url"
$Token = ConvertFrom-SecureString -AsPlainText -SecureString $SnipeitPSSession.apiKey $Token = ConvertFrom-SecureString -AsPlainText -SecureString $SnipeitPSSession.apiKey
} else {
throw "Please use Connect-SnipeitPS to setup connection before any other commands."
} }
# Validation of parameters # Validation of parameters
@ -57,9 +56,6 @@ function Invoke-SnipeitMethod {
Throw $exception Throw $exception
} }
# Double check those old deprecated -url parameters
$Url = $Url.TrimEnd('/')
#Build request uri #Build request uri
$apiUri = "$Url$Api" $apiUri = "$Url$Api"
#To support images "image" property have be handled before this #To support images "image" property have be handled before this

View file

@ -6,6 +6,7 @@ function Reset-SnipeitPSLegacyApi {
param( param(
) )
process { process {
Write-Verbose 'Reset-SnipeitPSLegacyApi'
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$SnipeitPSSession.legacyUrl = $null $SnipeitPSSession.legacyUrl = $null
$SnipeitPSSession.legacyApiKey = $null $SnipeitPSSession.legacyApiKey = $null

View file

@ -8,7 +8,7 @@ function Set-SnipeitPSLegacyUrl {
) )
process { process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$SnipeitPSSession.legacyUrl = $url $SnipeitPSSession.legacyUrl = $url.TrimEnd('/')
} }
} }
} }

View file

@ -69,7 +69,7 @@ function Connect-SnipeitPS {
switch ($PsCmdlet.ParameterSetName) { switch ($PsCmdlet.ParameterSetName) {
'Connect with url and apikey' { 'Connect with url and apikey' {
$SnipeitPSSession.url = $url.TrimEnd('/') $SnipeitPSSession.url = $url.TrimEnd('/')
$SnipeitPSSession.apiKey = $apiKey | ConvertTo-SecureString -AsPlainText $SnipeitPSSession.apiKey = ConvertTo-SecureString -AsPlainText -String $apiKey
} }
'Connect with url and secure apikey' { 'Connect with url and secure apikey' {

View file

@ -85,6 +85,7 @@ function Get-SnipeitAccessory() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
switch($PsCmdlet.ParameterSetName) { switch($PsCmdlet.ParameterSetName) {
@ -110,7 +111,9 @@ function Get-SnipeitAccessory() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -130,12 +133,15 @@ function Get-SnipeitAccessory() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -32,7 +32,7 @@ function Get-SnipeitAccessoryOwner() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
$Parameters = @{ $Parameters = @{
Api = "/api/v1/accessories/$id/checkedout" Api = "/api/v1/accessories/$id/checkedout"
Method = 'GET' Method = 'GET'
@ -47,15 +47,18 @@ function Get-SnipeitAccessoryOwner() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
}
return $result
} }

View file

@ -77,7 +77,7 @@ function Get-SnipeitActivity() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
if (($target_type -and -not $target_id) -or if (($target_type -and -not $target_id) -or
($target_id -and -not $target_type)) { ($target_id -and -not $target_type)) {
throw "Please specify both target_type and target_id" throw "Please specify both target_type and target_id"
@ -106,7 +106,9 @@ function Get-SnipeitActivity() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -126,12 +128,15 @@ function Get-SnipeitActivity() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -206,6 +206,7 @@ function Get-SnipeitAsset() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -236,7 +237,9 @@ function Get-SnipeitAsset() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -257,11 +260,14 @@ function Get-SnipeitAsset() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
}
} }

View file

@ -60,7 +60,7 @@ function Get-SnipeitAssetMaintenance() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -80,7 +80,9 @@ function Get-SnipeitAssetMaintenance() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -100,12 +102,15 @@ function Get-SnipeitAssetMaintenance() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -59,6 +59,8 @@ function Get-SnipeitCategory() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -88,7 +90,8 @@ function Get-SnipeitCategory() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -108,9 +111,12 @@ function Get-SnipeitCategory() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -61,6 +61,7 @@ function Get-SnipeitCompany() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -90,7 +91,8 @@ function Get-SnipeitCompany() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -110,9 +112,12 @@ function Get-SnipeitCompany() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -78,6 +78,7 @@ function Get-SnipeitComponent() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -107,7 +108,9 @@ function Get-SnipeitComponent() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -127,9 +130,12 @@ function Get-SnipeitComponent() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -33,6 +33,7 @@ function Get-SnipeitCustomField() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
if ($id) { if ($id) {
@ -55,15 +56,17 @@ function Get-SnipeitCustomField() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -66,6 +66,7 @@ function Get-SnipeitDepartment() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
@ -96,7 +97,8 @@ function Get-SnipeitDepartment() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -116,10 +118,13 @@ function Get-SnipeitDepartment() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -31,7 +31,7 @@ function Get-SnipeitFieldset() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
bagin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
if ($id) { if ($id) {
@ -54,13 +54,16 @@ function Get-SnipeitFieldset() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -104,7 +104,7 @@ function Get-SnipeitLicense() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
bagin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -131,7 +131,9 @@ function Get-SnipeitLicense() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -151,10 +153,13 @@ function Get-SnipeitLicense() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -53,7 +53,7 @@ function Get-SnipeitLicenseSeat() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -80,7 +80,9 @@ function Get-SnipeitLicenseSeat() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -100,10 +102,13 @@ function Get-SnipeitLicenseSeat() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -59,7 +59,7 @@ function Get-SnipeitLocation() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -89,7 +89,9 @@ function Get-SnipeitLocation() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -109,10 +111,13 @@ function Get-SnipeitLocation() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -60,7 +60,7 @@ function Get-SnipeitManufacturer() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -90,7 +90,9 @@ function Get-SnipeitManufacturer() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -110,9 +112,12 @@ function Get-SnipeitManufacturer() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -60,6 +60,7 @@ function Get-SnipeitModel() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -89,7 +90,9 @@ function Get-SnipeitModel() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -109,9 +112,12 @@ function Get-SnipeitModel() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -59,7 +59,7 @@ function Get-SnipeitStatus() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -89,7 +89,9 @@ function Get-SnipeitStatus() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -109,9 +111,12 @@ function Get-SnipeitStatus() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -59,6 +59,7 @@ function Get-SnipeitSupplier() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -88,7 +89,9 @@ function Get-SnipeitSupplier() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -108,10 +111,12 @@ function Get-SnipeitSupplier() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -97,6 +97,7 @@ function Get-SnipeitUser() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
@ -121,7 +122,8 @@ function Get-SnipeitUser() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($all) { if ($all) {
$offstart = $(if ($offset) {$offset} Else {0}) $offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter $callargs = $SearchParameter
@ -141,9 +143,12 @@ function Get-SnipeitUser() {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
$result $result
} }
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -115,7 +115,7 @@ function New-SnipeitAccessory() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -139,16 +139,20 @@ function New-SnipeitAccessory() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -144,6 +144,7 @@ function New-SnipeitAsset() {
[hashtable] $customfields [hashtable] $customfields
) )
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
@ -184,15 +185,20 @@ function New-SnipeitAsset() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -76,7 +76,7 @@ function New-SnipeitAssetMaintenance() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -105,15 +105,20 @@ function New-SnipeitAssetMaintenance() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -35,7 +35,7 @@ function New-SnipeitAudit() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = @{ $Values = @{
@ -61,15 +61,20 @@ function New-SnipeitAudit() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -41,7 +41,7 @@ function New-SnipeitCompany() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -61,16 +61,21 @@ function New-SnipeitCompany() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -76,7 +76,7 @@ function New-SnipeitComponent() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -100,16 +100,21 @@ function New-SnipeitComponent() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -122,9 +122,7 @@ function New-SnipeitConsumable() {
if ($Values['purchase_date']) { if ($Values['purchase_date']) {
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd") $Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
} }
}
process {
$Parameters = @{ $Parameters = @{
Api = "/api/v1/consumables" Api = "/api/v1/consumables"
Method = 'Post' Method = 'Post'
@ -140,7 +138,9 @@ function New-SnipeitConsumable() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }

View file

@ -60,7 +60,7 @@ function New-SnipeitDepartment() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -80,16 +80,21 @@ function New-SnipeitDepartment() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -123,7 +123,7 @@ function New-SnipeitLicense() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -155,16 +155,20 @@ function New-SnipeitLicense() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -93,6 +93,7 @@ function New-SnipeitLocation() {
[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
@ -112,15 +113,20 @@ function New-SnipeitLocation() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -46,6 +46,7 @@ function New-SnipeitManufacturer() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = @{ $Values = @{
@ -67,15 +68,18 @@ function New-SnipeitManufacturer() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -66,6 +66,7 @@ function New-SnipeitModel() {
[string]$apiKey [string]$apiKey
) )
begin {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = @{ $Values = @{
@ -94,15 +95,20 @@ function New-SnipeitModel() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -96,7 +96,7 @@ function New-SnipeitSupplier() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -116,16 +116,21 @@ function New-SnipeitSupplier() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}

View file

@ -116,7 +116,7 @@ function New-SnipeitUser() {
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[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
@ -140,15 +140,20 @@ function New-SnipeitUser() {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead." Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSLegacyUrl -url $url Set-SnipeitPSLegacyUrl -url $url
} }
}
process {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) { if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters $result = Invoke-SnipeitMethod @Parameters
} }
$result $result
}
end {
# reset legacy sessions # reset legacy sessions
if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) { if ($PSBoundParameters.ContainsKey('url') -or $PSBoundParameters.ContainsKey('apiKey')) {
Reset-SnipeitPSLegacyApi Reset-SnipeitPSLegacyApi
} }
} }
}