Public/Set-GCConversationParticipant.ps1

<#
.SYNOPSIS
    Updates a conversation participant.

.DESCRIPTION
    Patches/updates a specific participant within a conversation in Genesys Cloud.
    Can be used to change participant state (e.g., hold, mute, disconnect).
    Calls PATCH /api/v2/conversations/{conversationId}/participants/{participantId}.

.PARAMETER ConversationId
    The unique identifier of the conversation.

.PARAMETER ParticipantId
    The unique identifier of the participant to update.

.PARAMETER Body
    The request body containing the participant properties to update (e.g., state, held, muted).

.EXAMPLE
    $updateBody = @{
        state = 'disconnected'
    }
    Set-GCConversationParticipant -ConversationId 'conv-id' -ParticipantId 'part-id' -Body $updateBody

.EXAMPLE
    $holdBody = @{
        held = $true
    }
    Set-GCConversationParticipant -ConversationId 'conv-id' -ParticipantId 'part-id' -Body $holdBody

.NOTES
    Genesys Cloud API: PATCH /api/v2/conversations/{conversationId}/participants/{participantId}
#>

function Set-GCConversationParticipant {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$ConversationId,

        [Parameter(Mandatory = $true)]
        [string]$ParticipantId,

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

    $endpoint = "conversations/$ConversationId/participants/$ParticipantId"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method PATCH -Body $Body
}