Public/Invoke-GCAnalyticsFlowsAggregatesQuery.ps1

<#
.SYNOPSIS
    Queries flow aggregate analytics.

.DESCRIPTION
    Executes an analytics query for flow aggregate metrics in Genesys Cloud.
    Returns aggregated architect flow data such as outcomes, milestones, and durations.
    Calls POST /api/v2/analytics/flows/aggregates/query.

.PARAMETER Body
    The mandatory request body containing the analytics query definition including interval,
    granularity, groupBy, filter, and metrics.

.EXAMPLE
    $query = @{
        interval = '2024-01-01T00:00:00Z/2024-01-02T00:00:00Z'
        granularity = 'PT1H'
        metrics = @('nFlow', 'tFlow', 'nFlowOutcome')
    }
    Invoke-GCAnalyticsFlowsAggregatesQuery -Body $query

.NOTES
    Genesys Cloud API: POST /api/v2/analytics/flows/aggregates/query
#>

function Invoke-GCAnalyticsFlowsAggregatesQuery {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [object]$Body
    )

    $endpoint = "analytics/flows/aggregates/query"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method POST -Body $Body
}