Public/New-GCGroupMembers.ps1

<#
.SYNOPSIS
    Adds members to a group in Genesys Cloud.

.DESCRIPTION
    Adds one or more members to a specific group by sending a POST request.
    API Endpoint: POST /api/v2/groups/{groupId}/members

.PARAMETER GroupId
    The unique identifier of the group.

.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.

.EXAMPLE
    New-GCGroupMembers -GroupId 'group-id' -Body @{ memberIds = @('user-id-1', 'user-id-2') }
    Adds the specified users to the group.

.NOTES
    Genesys Cloud API: POST /api/v2/groups/{groupId}/members
#>

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

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

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