Pax8API/Public/Webhooks/New-Pax8WebhooksCreate.ps1

<#
.SYNOPSIS
Create webhook
.DESCRIPTION
Create an instance of WebhookView.
OpenAPI: POST /webhooks
Scope: Webhooks. Audience: https://api.pax8.com.
.PARAMETER DisplayName
Display name for the webhook
.PARAMETER Url
URL where webhook events will be sent
.PARAMETER Authorization
Authorization header value for webhook commands
.PARAMETER Active
Whether the webhook is active
.PARAMETER ContactEmail
Email address to notify when webhook delivery errors occur
.PARAMETER ErrorThreshold
Number of times a webhook will be retried and consecutive errors will result in an email notification
.PARAMETER IntegrationId
Id of the integration this webhook is associated with. This is required for 3rd party integrators
.PARAMETER WebhookTopics
List of topics and configurations this webhook subscribes to
.PARAMETER Body
Raw request body. This can be a hashtable, PSCustomObject, or pre-built JSON string.
.EXAMPLE
New-Pax8WebhooksCreate
.LINK
https://devx.pax8.com/openapi/webhooks-api.json
#>

function New-Pax8WebhooksCreate {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true)]
        [string]$DisplayName,

        [string]$Url,

        [string]$Authorization,

        [bool]$Active,

        [string]$ContactEmail,

        [int]$ErrorThreshold,

        [guid]$IntegrationId,

        [object[]]$WebhookTopics,

        [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
    }
}