Public/PortalNotification.ps1
Function Get-NmePortalNotification { <# .SYNOPSIS Get a list of portal notifications. .DESCRIPTION Get a list of portal notifications. This function calls the /api/v1/portal-notification endpoint of the NME REST API, using the get method. #> [CmdletBinding()] Param( ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/portal-notification$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmePortalNotificationRestModel') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function New-NmePortalNotification { <# .SYNOPSIS Create portal notification. .DESCRIPTION Create portal notification. This function calls the /api/v1/portal-notification endpoint of the NME REST API, using the post method. .PARAMETER NmeCreatePortalNotificationRestModel Requires an NmeCreatePortalNotificationRestModel object, as generated by the New-NmeCreatePortalNotificationRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmeCreatePortalNotificationRestModel"){$true} else{throw " is not a NmeCreatePortalNotificationRestModel object."}})]$NmeCreatePortalNotificationRestModel ) Set-NmeAuthHeaders Try { $json = $NmeCreatePortalNotificationRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/portal-notification$QueryString" -Method post -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmePortalNotificationRestModel') $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Get-NmePortalNotificationId { <# .SYNOPSIS Get portal notifications by id. .DESCRIPTION Get portal notifications by id. This function calls the /api/v1/portal-notification/{id} endpoint of the NME REST API, using the get method. .PARAMETER Id ID of scripted Action #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$Id ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/portal-notification/$Id$Querystring" -Method get -Headers $script:AuthHeaders -ContentType 'application/json' $Result.PSObject.TypeNames.Insert(0, 'NmePortalNotificationRestModel') $Result | Add-Member -NotePropertyName 'id' -NotePropertyValue $id -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmePortalNotificationId { <# .SYNOPSIS Partially update portal notification. .DESCRIPTION Partially update portal notification. This function calls the /api/v1/portal-notification/{id} endpoint of the NME REST API, using the patch method. .PARAMETER Id ID of scripted Action .PARAMETER NmePatchPortalNotificationRestModel Requires an NmePatchPortalNotificationRestModel object, as generated by the New-NmePatchPortalNotificationRestModel command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$Id, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmePatchPortalNotificationRestModel"){$true} else{throw " is not a NmePatchPortalNotificationRestModel object."}})]$NmePatchPortalNotificationRestModel ) Set-NmeAuthHeaders Try { $json = $NmePatchPortalNotificationRestModel | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/portal-notification/$Id$QueryString" -Method patch -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmePortalNotificationRestModel') $Result | Add-Member -NotePropertyName 'id' -NotePropertyValue $id -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Remove-NmePortalNotificationId { <# .SYNOPSIS Delete portal notification. .DESCRIPTION Delete portal notification. This function calls the /api/v1/portal-notification/{id} endpoint of the NME REST API, using the delete method. .PARAMETER Id ID of scripted Action #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$Id ) Set-NmeAuthHeaders Try { $Result = Invoke-RestMethod "$script:NmeUri/api/v1/portal-notification/$Id$Querystring" -Method delete -Headers $script:AuthHeaders -ContentType 'application/json' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } |