Public/Remove-GCGroupMembers.ps1

<#
.SYNOPSIS
    Removes members from a group in Genesys Cloud.

.DESCRIPTION
    Removes one or more members from a specific group by sending a DELETE request with
    a body containing the member IDs to remove.
    API Endpoint: DELETE /api/v2/groups/{groupId}/members

.PARAMETER GroupId
    The unique identifier of the group.

.PARAMETER Body
    The request body containing the member IDs to remove. Accepts a hashtable or JSON string.
    Should include an array of member IDs.

.EXAMPLE
    Remove-GCGroupMembers -GroupId 'group-id' -Body @{ memberIds = @('user-id-1', 'user-id-2') }
    Removes the specified users from the group.

.NOTES
    Genesys Cloud API: DELETE /api/v2/groups/{groupId}/members
    Note: This endpoint uses DELETE with a request body containing the member IDs.
#>

function Remove-GCGroupMembers {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$GroupId,

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

    $endpoint = "groups/$GroupId/members"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method DELETE -Body $Body
}