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_GET') $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 NmePortalNotificationRestModel_POST Requires an NmePortalNotificationRestModel_POST object, as generated by the New-NmePortalNotificationRestModel_POST command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmePortalNotificationRestModel_POST"){$true} else{throw " is not a NmePortalNotificationRestModel_POST object."}})]$NmePortalNotificationRestModel_POST ) Set-NmeAuthHeaders Try { $json = $NmePortalNotificationRestModel_POST | 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, 'NmeResponseWithJobAndPortalNotificationRestModel_GET') $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_GET') $Result | Add-Member -NotePropertyName 'id' -NotePropertyValue $id -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } Function Set-NmePortalNotificationId { <# .SYNOPSIS Update portal notification. .DESCRIPTION Update portal notification. This function calls the /api/v1/portal-notification/{id} endpoint of the NME REST API, using the put method. .PARAMETER Id ID of scripted Action .PARAMETER NmePortalNotificationRestModel_PUT Requires an NmePortalNotificationRestModel_PUT object, as generated by the New-NmePortalNotificationRestModel_PUT command. #> [CmdletBinding()] Param( [Parameter(Mandatory=$true,ValueFromPipelineByPropertyName=$true)][int]$Id, [Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$True)][ValidateScript({if ($_.PSObject.TypeNames -contains "NmePortalNotificationRestModel_PUT"){$true} else{throw " is not a NmePortalNotificationRestModel_PUT object."}})]$NmePortalNotificationRestModel_PUT ) Set-NmeAuthHeaders Try { $json = $NmePortalNotificationRestModel_PUT | ConvertTo-Json -Depth 20 Write-Debug 'json:' Write-Debug $json $Result = Invoke-RestMethod "$script:NmeUri/api/v1/portal-notification/$Id$QueryString" -Method put -Headers $script:AuthHeaders -ContentType 'application/json' -body $json Write-Verbose ($result | out-string) $Result.PSObject.TypeNames.Insert(0, 'NmeResponseWithJobAndPortalNotificationRestModel_GET') $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.PSObject.TypeNames.Insert(0, 'NmeResponseWithJob') $Result | Add-Member -NotePropertyName 'id' -NotePropertyValue $id -erroraction 'SilentlyContinue' $Result | CapProps } Catch { $message = ParseErrorForResponseBody($_) write-error ($message | out-string) } } |