Public/Get-GCGroupMembers.ps1

<#
.SYNOPSIS
    Retrieves the members of a group in Genesys Cloud.

.DESCRIPTION
    Queries the Genesys Cloud API to retrieve a paginated list of members belonging
    to a specific group.
    API Endpoint: GET /api/v2/groups/{groupId}/members

.PARAMETER GroupId
    The unique identifier of the group.

.PARAMETER PageSize
    The number of results per page. Default is 25.

.PARAMETER PageNumber
    The page number to retrieve. Default is 1.

.EXAMPLE
    Get-GCGroupMembers -GroupId '12345678-1234-1234-1234-123456789012'
    Retrieves the first page of members for the specified group.

.EXAMPLE
    Get-GCGroupMembers -GroupId '12345678-1234-1234-1234-123456789012' -PageSize 100
    Retrieves group members with 100 results per page.

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

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

        [Parameter(Mandatory = $false)]
        [int]$PageSize = 25,

        [Parameter(Mandatory = $false)]
        [int]$PageNumber = 1
    )

    $queryParams = @{
        pageSize   = $PageSize
        pageNumber = $PageNumber
    }

    $endpoint = "groups/$GroupId/members"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method GET -QueryParameters $queryParams
}