Public/Invoke-GCConversationParticipantTransfer.ps1

<#
.SYNOPSIS
    Transfers or replaces a conversation participant.

.DESCRIPTION
    Initiates a transfer or replacement of a participant within a conversation.
    Calls POST /api/v2/conversations/{conversationId}/participants/{participantId}/replace.

.PARAMETER ConversationId
    The unique identifier of the conversation.

.PARAMETER ParticipantId
    The unique identifier of the participant to transfer/replace.

.PARAMETER Body
    The request body containing transfer target details (e.g., userId, address, queueId).

.EXAMPLE
    $transferBody = @{
        queueId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    }
    Invoke-GCConversationParticipantTransfer -ConversationId 'conv-id' -ParticipantId 'part-id' -Body $transferBody

.EXAMPLE
    $transferBody = @{
        userId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'
    }
    Invoke-GCConversationParticipantTransfer -ConversationId 'conv-id' -ParticipantId 'part-id' -Body $transferBody

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

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

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

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

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