diff --git a/PSTruPortal/Public/Add-Credential.ps1 b/PSTruPortal/Public/Add-Credential.ps1 index 02fcf80..6705b21 100644 --- a/PSTruPortal/Public/Add-Credential.ps1 +++ b/PSTruPortal/Public/Add-Credential.ps1 @@ -16,59 +16,68 @@ function Add-Credential { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true + )] + [switch]$UseSSL = $Script:UseSSL, + + [Parameter( + ValueFromPipelineByPropertyName=$true + )] + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, + + [Parameter( + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] [int]$PersonId, [Parameter( - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] [string]$CardNumber, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [int]$IssueCode, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [int]$Pin, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [string]$ActiveFrom, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [string]$ActiveTo, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [switch]$AntipassbackExempt, [Parameter( - Mandatory=$false - )] - [switch]$ExtendedAccess, - - [Parameter( - Mandatory=$false - )] - [int[]]$AccessLevels, - - [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, + [switch]$ExtendedAccess, [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [int[]]$AccessLevels ) begin { diff --git a/PSTruPortal/Public/Get-AccessLevel.ps1 b/PSTruPortal/Public/Get-AccessLevel.ps1 index 09ac47d..d7ce958 100644 --- a/PSTruPortal/Public/Get-AccessLevel.ps1 +++ b/PSTruPortal/Public/Get-AccessLevel.ps1 @@ -24,9 +24,12 @@ function Get-AccessLevel { ValueFromPipelineByPropertyName=$true )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - - [Parameter()] - [int]$Id, + + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$AccessLevelId, [Parameter()] [ValidateRange(1,250)] @@ -53,8 +56,8 @@ function Get-AccessLevel { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($AccessLevelId) { + $uri = "$uri/$AccessLevelId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -71,7 +74,7 @@ function Get-AccessLevel { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + AccessLevelId=$_.id; Name=$_.name; } } diff --git a/PSTruPortal/Public/Get-ActionTrigger.ps1 b/PSTruPortal/Public/Get-ActionTrigger.ps1 index 7b54213..991830d 100644 --- a/PSTruPortal/Public/Get-ActionTrigger.ps1 +++ b/PSTruPortal/Public/Get-ActionTrigger.ps1 @@ -24,9 +24,12 @@ function Get-ActionTrigger { ValueFromPipelineByPropertyName=$true )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - - [Parameter()] - [int]$Id, + + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$ActionTriggerId, [Parameter()] [ValidateRange(1,250)] @@ -53,8 +56,8 @@ function Get-ActionTrigger { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($ActionTriggerId) { + $uri = "$uri/$ActionTriggerId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -71,7 +74,7 @@ function Get-ActionTrigger { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + ActionTriggerId=$_.id; Name=$_.name; } } diff --git a/PSTruPortal/Public/Get-Credential.ps1 b/PSTruPortal/Public/Get-Credential.ps1 index 2731fd3..ec1fb26 100644 --- a/PSTruPortal/Public/Get-Credential.ps1 +++ b/PSTruPortal/Public/Get-Credential.ps1 @@ -25,10 +25,16 @@ function Get-Credential { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$CredentialId, - [Parameter()] + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] [int]$PersonId, [Parameter()] @@ -56,8 +62,8 @@ function Get-Credential { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($CredentialIdId) { + $uri = "$uri/$CredentialId" } if($PersonId) { @@ -78,11 +84,11 @@ function Get-Credential { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + CredentialId=$_.id; ActiveFrom=$_.activeFrom; ActiveTo=$_.activeTo; AntipassbackExempt=$_.antipassbackExempt; - Cardnumber=$_.cardNumber; + CardNumber=$_.cardNumber; AccessLevels=$_.accessLevels; Pin=$_.pin; PersonId=$_.PersonId; diff --git a/PSTruPortal/Public/Get-Device.ps1 b/PSTruPortal/Public/Get-Device.ps1 index a07d50e..4c7855c 100644 --- a/PSTruPortal/Public/Get-Device.ps1 +++ b/PSTruPortal/Public/Get-Device.ps1 @@ -25,8 +25,11 @@ function Get-Device { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$DeviceId, [Parameter()] [ValidateRange(1,250)] @@ -53,8 +56,8 @@ function Get-Device { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($DeviceId) { + $uri = "$uri/$DeviceId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -71,7 +74,7 @@ function Get-Device { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + DeviceId=$_.id; Name=$_.name; } } diff --git a/PSTruPortal/Public/Get-Door.ps1 b/PSTruPortal/Public/Get-Door.ps1 index 7acdd7b..196aa9a 100644 --- a/PSTruPortal/Public/Get-Door.ps1 +++ b/PSTruPortal/Public/Get-Door.ps1 @@ -25,8 +25,11 @@ function Get-Door { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$DoorId, [Parameter()] [ValidateRange(1,250)] @@ -53,8 +56,8 @@ function Get-Door { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($DoorId) { + $uri = "$uri/$DoorId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -71,7 +74,7 @@ function Get-Door { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + DoorId=$_.id; Name=$_.name; State=$_.state; ReaderTamper=$_.readerTemper; diff --git a/PSTruPortal/Public/Get-Event.ps1 b/PSTruPortal/Public/Get-Event.ps1 index a1674a9..39c0bcc 100644 --- a/PSTruPortal/Public/Get-Event.ps1 +++ b/PSTruPortal/Public/Get-Event.ps1 @@ -25,16 +25,28 @@ function Get-Event { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$EventId, - [Parameter()] - [int]$Type, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$EventType, - [Parameter()] + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] [int]$PersonId, - [Parameter()] + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] [int]$DeviceId, [Parameter()] @@ -73,8 +85,8 @@ function Get-Event { $query.Add("deviceId", $DeviceId) } - if($Id) { - $uri = "$uri/$Id" + if($EventId) { + $uri = "$uri/$EventId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -97,8 +109,8 @@ function Get-Event { } $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; - Type=$_.type; + EventId=$_.id; + EventType=$_.type; Description=$_.description; PersonId=$_.personId; PersonName=$_.personName; diff --git a/PSTruPortal/Public/Get-Input.ps1 b/PSTruPortal/Public/Get-Input.ps1 index 50708b4..06f3004 100644 --- a/PSTruPortal/Public/Get-Input.ps1 +++ b/PSTruPortal/Public/Get-Input.ps1 @@ -25,8 +25,11 @@ function Get-Input { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$InputId, [Parameter()] [ValidateRange(1,250)] @@ -52,8 +55,8 @@ function Get-Input { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($InputId) { + $uri = "$uri/$InputId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -70,7 +73,7 @@ function Get-Input { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + InputId=$_.id; Name=$_.name; State=$_.state; } diff --git a/PSTruPortal/Public/Get-Output.ps1 b/PSTruPortal/Public/Get-Output.ps1 index c5874cc..a505362 100644 --- a/PSTruPortal/Public/Get-Output.ps1 +++ b/PSTruPortal/Public/Get-Output.ps1 @@ -25,8 +25,11 @@ function Get-Output { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$OutputId, [Parameter()] [ValidateRange(1,250)] @@ -52,8 +55,8 @@ function Get-Output { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($OutputId) { + $uri = "$uri/$OutputId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -70,7 +73,7 @@ function Get-Output { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + OutputId=$_.id; Name=$_.name; State=$_.state; } diff --git a/PSTruPortal/Public/Get-Person.ps1 b/PSTruPortal/Public/Get-Person.ps1 index e04349a..78270f0 100644 --- a/PSTruPortal/Public/Get-Person.ps1 +++ b/PSTruPortal/Public/Get-Person.ps1 @@ -25,13 +25,22 @@ function Get-Person { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] [string]$FirstName, - [Parameter()] + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] [string]$MiddleName, - [Parameter()] + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] [string]$LastName, [Parameter()] @@ -84,7 +93,7 @@ function Get-Person { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + PersonId=$_.id; FirstName=$_.firstname; MiddleName=$_.middlename; LastName=$_.lastname; diff --git a/PSTruPortal/Public/Get-Reader.ps1 b/PSTruPortal/Public/Get-Reader.ps1 index ae4d597..17a2174 100644 --- a/PSTruPortal/Public/Get-Reader.ps1 +++ b/PSTruPortal/Public/Get-Reader.ps1 @@ -25,8 +25,11 @@ function Get-Reader { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$ReaderId, [Parameter()] [ValidateRange(1,250)] @@ -53,8 +56,8 @@ function Get-Reader { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($ReaderId) { + $uri = "$uri/$ReaderId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -71,7 +74,7 @@ function Get-Reader { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + ReaderId=$_.id; Name=$_.name; } } diff --git a/PSTruPortal/Public/Get-UserDefinedField.ps1 b/PSTruPortal/Public/Get-UserDefinedField.ps1 index 8a1c5be..e85603c 100644 --- a/PSTruPortal/Public/Get-UserDefinedField.ps1 +++ b/PSTruPortal/Public/Get-UserDefinedField.ps1 @@ -25,8 +25,11 @@ function Get-UserDefinedField { )] [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, - [Parameter()] - [int]$Id, + [Parameter( + Mandatory=$false, + ValueFromPipelineByPropertyName=$true + )] + [int]$UserDefinedFieldId, [Parameter()] [ValidateRange(1,250)] @@ -52,8 +55,8 @@ function Get-UserDefinedField { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id" + if($UserDefinedFieldId) { + $uri = "$uri/$UserDefinedFieldId" } Write-Verbose -Message "$($method) $($uri) $($contentType)" @@ -70,7 +73,7 @@ function Get-UserDefinedField { $response = Invoke-RestMethod @message $response | ForEach-Object { New-Object -TypeName PSObject -Property @{ - Id=$_.id; + UserDefinedFieldId=$_.id; Name=$_.name; Required=$_.required; Secured=$_.secured; diff --git a/PSTruPortal/Public/Invoke-ActivateActionTrigger.ps1 b/PSTruPortal/Public/Invoke-ActivateActionTrigger.ps1 index 73983a7..f8e8125 100644 --- a/PSTruPortal/Public/Invoke-ActivateActionTrigger.ps1 +++ b/PSTruPortal/Public/Invoke-ActivateActionTrigger.ps1 @@ -26,10 +26,10 @@ function Invoke-ActivateActionTrigger { [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, [Parameter( - ValueFromPipelineByPropertyName=$true, - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [int]$Id + [int]$ActionTriggerId ) begin { @@ -51,8 +51,8 @@ function Invoke-ActivateActionTrigger { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id/execute?action=activation" + if($ActionTriggerId) { + $uri = "$uri/$ActionTriggerId/execute?action=activation" } Write-Verbose -Message "$($method) $($uri) $($contentType)" diff --git a/PSTruPortal/Public/Invoke-ActivateOutput.ps1 b/PSTruPortal/Public/Invoke-ActivateOutput.ps1 index 78a793c..07fe2e5 100644 --- a/PSTruPortal/Public/Invoke-ActivateOutput.ps1 +++ b/PSTruPortal/Public/Invoke-ActivateOutput.ps1 @@ -26,10 +26,10 @@ function Invoke-ActivateOutput { [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, [Parameter( - ValueFromPipelineByPropertyName=$true, - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [int]$Id + [int]$OutputId ) begin { @@ -51,8 +51,8 @@ function Invoke-ActivateOutput { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id/state?state=active" + if($OutputId) { + $uri = "$uri/$OutputId/state?state=active" } Write-Verbose -Message "$($method) $($uri) $($contentType)" diff --git a/PSTruPortal/Public/Invoke-DeactivateActionTrigger.ps1 b/PSTruPortal/Public/Invoke-DeactivateActionTrigger.ps1 index 2ee8fcc..0c13a84 100644 --- a/PSTruPortal/Public/Invoke-DeactivateActionTrigger.ps1 +++ b/PSTruPortal/Public/Invoke-DeactivateActionTrigger.ps1 @@ -26,10 +26,10 @@ function Invoke-DeactivateActionTrigger { [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, [Parameter( - ValueFromPipelineByPropertyName=$true, - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [int]$Id + [int]$ActionTriggerId ) begin { @@ -51,8 +51,8 @@ function Invoke-DeactivateActionTrigger { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id/execute?action=deactivation" + if($ActionTriggerId) { + $uri = "$uri/$ActionTriggerId/execute?action=deactivation" } Write-Verbose -Message "$($method) $($uri) $($contentType)" diff --git a/PSTruPortal/Public/Invoke-DeactivateOutput.ps1 b/PSTruPortal/Public/Invoke-DeactivateOutput.ps1 index 05dcc08..4ae5127 100644 --- a/PSTruPortal/Public/Invoke-DeactivateOutput.ps1 +++ b/PSTruPortal/Public/Invoke-DeactivateOutput.ps1 @@ -26,10 +26,10 @@ function Invoke-DeactivateOutput { [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, [Parameter( - ValueFromPipelineByPropertyName=$true, - Mandatory=$true + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] - [int]$Id + [int]$OutputId ) begin { @@ -51,8 +51,8 @@ function Invoke-DeactivateOutput { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id/state?state=inactive" + if($OutputId) { + $uri = "$uri/$OutputId/state?state=inactive" } Write-Verbose -Message "$($method) $($uri) $($contentType)" diff --git a/PSTruPortal/Public/Invoke-GrantAccess.ps1 b/PSTruPortal/Public/Invoke-GrantAccess.ps1 index f74d193..88dd738 100644 --- a/PSTruPortal/Public/Invoke-GrantAccess.ps1 +++ b/PSTruPortal/Public/Invoke-GrantAccess.ps1 @@ -26,14 +26,14 @@ function Invoke-GrantAccess { [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, [Parameter( - ValueFromPipelineByPropertyName=$true, - Mandatory=$true + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] - [int]$Id, + [int]$DoorId, [Parameter( - ValueFromPipelineByPropertyName=$true, - Mandatory=$true + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [string]$CardNumber ) @@ -57,8 +57,8 @@ function Invoke-GrantAccess { limit=$Limit; } - if($Id) { - $uri = "$uri/$Id/state?command=grant-access&cardNumber=$Cardnumber" + if($DoorId) { + $uri = "$uri/$DoorId/state?command=grant-access&cardNumber=$Cardnumber" } Write-Verbose -Message "$($method) $($uri) $($contentType)" diff --git a/PSTruPortal/Public/Invoke-LoginUser.ps1 b/PSTruPortal/Public/Invoke-LoginUser.ps1 index 1f13172..05c2823 100644 --- a/PSTruPortal/Public/Invoke-LoginUser.ps1 +++ b/PSTruPortal/Public/Invoke-LoginUser.ps1 @@ -3,7 +3,8 @@ function Invoke-LoginUser { [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")] param ( [Parameter( - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] [string]$Host, diff --git a/PSTruPortal/Public/New-Person.ps1 b/PSTruPortal/Public/New-Person.ps1 index 8a48e4b..3d700dd 100644 --- a/PSTruPortal/Public/New-Person.ps1 +++ b/PSTruPortal/Public/New-Person.ps1 @@ -16,29 +16,32 @@ function New-Person { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true )] - [string]$FirstName, + [switch]$UseSSL = $Script:UseSSL, [Parameter( - Mandatory=$false + ValueFromPipelineByPropertyName=$true )] - [string]$MiddleName = $null, - + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, + [Parameter( - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [string]$LastName, + [string]$FirstName, [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, + [string]$MiddleName = $null, [Parameter( + Mandatory=$true, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [string]$LastName ) begin { diff --git a/PSTruPortal/Public/Remove-Credential.ps1 b/PSTruPortal/Public/Remove-Credential.ps1 index f0682e7..d7bf620 100644 --- a/PSTruPortal/Public/Remove-Credential.ps1 +++ b/PSTruPortal/Public/Remove-Credential.ps1 @@ -16,19 +16,20 @@ function Remove-Credential { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true )] - [int]$Id, + [switch]$UseSSL = $Script:UseSSL, [Parameter( ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, - + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, + [Parameter( + Mandatory=$true, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [int]$CredentialId ) begin { @@ -43,8 +44,8 @@ function Remove-Credential { $contentType = "application/json" $uri = "http" + $(if($UseSSL) { "s" }) + "://$($Host)/$($endPoint)" - if($Id) { - $uri = "$uri/$Id" + if($CredentialId) { + $uri = "$uri/$CredentialId" } $headers = @{ diff --git a/PSTruPortal/Public/Remove-Person.ps1 b/PSTruPortal/Public/Remove-Person.ps1 index e09ba31..32b0b21 100644 --- a/PSTruPortal/Public/Remove-Person.ps1 +++ b/PSTruPortal/Public/Remove-Person.ps1 @@ -16,19 +16,20 @@ function Remove-Person { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true )] - [int]$Id, + [switch]$UseSSL = $Script:UseSSL, [Parameter( ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, - + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, + [Parameter( + Mandatory=$true, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [int]$PersonId ) begin { @@ -43,8 +44,8 @@ function Remove-Person { $contentType = "application/json" $uri = "http" + $(if($UseSSL) { "s" }) + "://$($Host)/$($endPoint)" - if($Id) { - $uri = "$uri/$Id" + if($PersonId) { + $uri = "$uri/$PersonId" } $headers = @{ diff --git a/PSTruPortal/Public/Send-Event.ps1 b/PSTruPortal/Public/Send-Event.ps1 index d38be33..b46b62e 100644 --- a/PSTruPortal/Public/Send-Event.ps1 +++ b/PSTruPortal/Public/Send-Event.ps1 @@ -16,29 +16,32 @@ function Send-Event { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true )] - [string]$Description, + [switch]$UseSSL = $Script:UseSSL, [Parameter( - Mandatory=$false + ValueFromPipelineByPropertyName=$true )] - [string]$DeviceDescription, - + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, + [Parameter( - Mandatory=$false + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [string]$PersonDescription, + [string]$Description, [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, + [string]$DeviceDescription, [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [string]$PersonDescription ) begin { diff --git a/PSTruPortal/Public/Set-Credential.ps1 b/PSTruPortal/Public/Set-Credential.ps1 index 28f2cd2..c0da03a 100644 --- a/PSTruPortal/Public/Set-Credential.ps1 +++ b/PSTruPortal/Public/Set-Credential.ps1 @@ -16,64 +16,74 @@ function Set-Credential { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true )] - [int]$Id, + [switch]$UseSSL = $Script:UseSSL, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true + )] + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, + + [Parameter( + Mandatory=$true, + ValueFromPipelineByPropertyName=$true + )] + [int]$CredentialId, + + [Parameter( + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] [int]$PersonId, [Parameter( - Mandatory=$true + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] [string]$CardNumber, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [int]$IssueCode, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [int]$Pin, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [string]$ActiveFrom, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [string]$ActiveTo, [Parameter( - Mandatory=$false + Mandatory=$false, + ValueFromPipelineByPropertyName=$true )] [switch]$AntipassbackExempt, [Parameter( - Mandatory=$false - )] - [switch]$ExtendedAccess, - - [Parameter( - Mandatory=$false - )] - [int[]]$AccessLevels, - - [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, + [switch]$ExtendedAccess, [Parameter( + Mandatory=$false, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [int[]]$AccessLevels ) begin { @@ -88,8 +98,8 @@ function Set-Credential { $contentType = "application/json" $uri = "http" + $(if($UseSSL) { "s" }) + "://$($Host)/$($endPoint)" - if($Id) { - $uri = "$uri/$Id" + if($CredentialId) { + $uri = "$uri/$CredentialId" } $headers = @{ diff --git a/PSTruPortal/Public/Set-Person.ps1 b/PSTruPortal/Public/Set-Person.ps1 index a283902..9a7a4e6 100644 --- a/PSTruPortal/Public/Set-Person.ps1 +++ b/PSTruPortal/Public/Set-Person.ps1 @@ -16,34 +16,38 @@ function Set-Person { [string]$SessionKey = $Script:SessionKey, [Parameter( - Mandatory=$true + ValueFromPipelineByPropertyName=$true )] - [int]$Id, + [switch]$UseSSL = $Script:UseSSL, [Parameter( - Mandatory=$false + ValueFromPipelineByPropertyName=$true )] - [string]$FirstName = $null, + [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors, [Parameter( - Mandatory=$false + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [string]$MiddleName = $null, + [int]$PersonId, [Parameter( - Mandatory=$false + Mandatory=$true, + ValueFromPipelineByPropertyName=$true )] - [string]$LastName = $null, + [string]$FirstName = $null, [Parameter( + Mandatory=$true, ValueFromPipelineByPropertyName=$true )] - [switch]$UseSSL = $Script:UseSSL, + [string]$MiddleName = $null, [Parameter( + Mandatory=$true, ValueFromPipelineByPropertyName=$true )] - [switch]$IgnoreCertificateErrors = $Script:IgnoreCertificateErrors + [string]$LastName = $null ) begin { @@ -58,8 +62,8 @@ function Set-Person { $contentType = "application/json" $uri = "http" + $(if($UseSSL) { "s" }) + "://$($Host)/$($endPoint)" - if($Id) { - $uri = "$uri/$Id" + if($PersonId) { + $uri = "$uri/$PersonId" } $headers = @{