Pax8API/Public/Webhooks/Add-Pax8WebhookTopic.ps1

<#
.SYNOPSIS
Add webhook topic
.DESCRIPTION
Add a topic to a webhook. This api only adds, does not replace topics or updates existing topics. Will throw if a topic type exists for this webhook already.
OpenAPI: POST /webhooks/{id}/topics
Scope: Webhooks. Audience: https://api.pax8.com.
.PARAMETER Id
path parameter 'id'.
.PARAMETER Topic
The topic name to subscribe to
.PARAMETER Filters
Advanced filtering configuration
.PARAMETER Body
Raw request body. This can be a hashtable, PSCustomObject, or pre-built JSON string.
.EXAMPLE
Add-Pax8WebhookTopic -Id '00000000-0000-0000-0000-000000000000'
.LINK
https://devx.pax8.com/openapi/webhooks-api.json
#>

function Add-Pax8WebhookTopic {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [guid]$Id,

        [Parameter(Mandatory = $true)]
        [string]$Topic,

        [Parameter(Mandatory = $true)]
        [object[]]$Filters,

        [Parameter(ValueFromPipeline = $true)]
        [object]$Body,

        [switch]$Raw
    )

    process {
        $boundParameters = @{}
        foreach ($entry in $PSBoundParameters.GetEnumerator()) {
            $boundParameters[$entry.Key] = $entry.Value
        }

        Invoke-Pax8ApiOperation -CommandName $MyInvocation.MyCommand.Name -Parameters $boundParameters
    }
}