Public/New-GCEmailsRoute.ps1

<#
.SYNOPSIS
    Creates a new email route for a domain.

.DESCRIPTION
    Creates a new email route for the specified domain in Genesys Cloud.
    Uses the POST /api/v2/routing/email/domains/{domainName}/routes endpoint.

.PARAMETER DomainName
    The name of the email domain.

.PARAMETER Body
    The email route definition object.

.EXAMPLE
    $routeBody = @{ pattern = 'support'; fromName = 'Support'; fromEmail = 'support@example.com' }
    New-GCEmailsRoute -DomainName 'example.com' -Body $routeBody

.NOTES
    Genesys Cloud API: POST /api/v2/routing/email/domains/{domainName}/routes
#>

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

        [Parameter(Mandatory = $true)]
        [object]$Body
    )

    $endpoint = "routing/email/domains/$DomainName/routes"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method POST -Body $Body
}