Public/PropertyContacts/New-AspirePropertyContact.ps1
|
<#
.SYNOPSIS Creates a new property contact in the Aspire API. .DESCRIPTION Uses Invoke-AspireRequest to perform a POST request to the /PropertyContacts endpoint. .PARAMETER PropertyID The ID of the property (required). .PARAMETER ContactID The ID of the contact (required). .PARAMETER PrimaryContact Optional boolean indicating if this is the primary contact. .PARAMETER BillingContact Optional boolean indicating if this is the billing contact. .PARAMETER EmailInvoiceContact Optional boolean indicating if this is the email invoice contact. .PARAMETER EmailNotificationsContact Optional boolean indicating if this is the email notifications contact. .PARAMETER SMSNotificationsContact Optional boolean indicating if this is the SMS notifications contact. .OUTPUTS The response from the API containing the result. .EXAMPLE New-AspirePropertyContact -PropertyID 123 -ContactID 456 -PrimaryContact $true #> function New-AspirePropertyContact { [CmdletBinding()] param( [Parameter(Mandatory = $true)] [int]$PropertyID, [Parameter(Mandatory = $true)] [int]$ContactID, [bool]$PrimaryContact = $null, [bool]$BillingContact = $null, [bool]$EmailInvoiceContact = $null, [bool]$EmailNotificationsContact = $null, [bool]$SMSNotificationsContact = $null ) $body = @{ PropertyID = $PropertyID ContactID = $ContactID } if ($PSBoundParameters.ContainsKey('PrimaryContact')) { $body.PrimaryContact = $PrimaryContact } if ($PSBoundParameters.ContainsKey('BillingContact')) { $body.BillingContact = $BillingContact } if ($PSBoundParameters.ContainsKey('EmailInvoiceContact')) { $body.EmailInvoiceContact = $EmailInvoiceContact } if ($PSBoundParameters.ContainsKey('EmailNotificationsContact')) { $body.EmailNotificationsContact = $EmailNotificationsContact } if ($PSBoundParameters.ContainsKey('SMSNotificationsContact')) { $body.SMSNotificationsContact = $SMSNotificationsContact } return Invoke-AspireRequest -Method POST -Path "/PropertyContacts" -Body $body -ApiVersion $null } |