Public/New-GCRoutingQueueMembers.ps1

<#
.SYNOPSIS
    Adds or removes members from a routing queue in Genesys Cloud.

.DESCRIPTION
    Adds members to a routing queue by sending a POST request. Can also be used to remove
    members by setting the Delete parameter to $true.
    API Endpoint: POST /api/v2/routing/queues/{queueId}/members

.PARAMETER QueueId
    The unique identifier of the routing queue.

.PARAMETER Body
    The request body containing the member information. Accepts a hashtable or JSON string.
    Should include an array of member objects with user IDs.

.PARAMETER Delete
    When set to $true, the members specified in the body will be removed from the queue
    instead of added.

.EXAMPLE
    New-GCRoutingQueueMembers -QueueId '12345678-1234-1234-1234-123456789012' -Body @(@{ id = 'user-id-1' }, @{ id = 'user-id-2' })
    Adds the specified users to the queue.

.EXAMPLE
    New-GCRoutingQueueMembers -QueueId '12345678-1234-1234-1234-123456789012' -Body @(@{ id = 'user-id-1' }) -Delete $true
    Removes the specified user from the queue.

.NOTES
    Genesys Cloud API: POST /api/v2/routing/queues/{queueId}/members
#>

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

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

        [Parameter(Mandatory = $false)]
        [bool]$Delete
    )

    $queryParams = @{}
    if ($PSBoundParameters.ContainsKey('Delete')) { $queryParams['delete'] = $Delete }

    $endpoint = "routing/queues/$QueueId/members"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method POST -Body $Body -QueryParameters $queryParams
}