Public/Get-GCConversations.ps1

<#
.SYNOPSIS
    Retrieves a list of conversations.

.DESCRIPTION
    Gets a paginated list of conversations from the Genesys Cloud platform.
    Calls GET /api/v2/conversations.

.PARAMETER PageSize
    The number of results per page. Defaults to 25.

.PARAMETER PageNumber
    The page number to retrieve. Defaults to 1.

.PARAMETER CommunicationType
    Filter by communication type (e.g., call, callback, chat, email, message).

.EXAMPLE
    Get-GCConversations

.EXAMPLE
    Get-GCConversations -PageSize 50 -PageNumber 2

.EXAMPLE
    Get-GCConversations -CommunicationType 'call'

.NOTES
    Genesys Cloud API: GET /api/v2/conversations
#>

function Get-GCConversations {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $false)]
        [int]$PageSize = 25,

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

        [Parameter(Mandatory = $false)]
        [string]$CommunicationType
    )

    $endpoint = "conversations"
    $queryParams = @{
        pageSize   = $PageSize
        pageNumber = $PageNumber
    }

    if ($CommunicationType) {
        $queryParams['communicationType'] = $CommunicationType
    }

    return Invoke-GCApiRequest -Endpoint $endpoint -Method GET -QueryParameters $queryParams
}