Public/Set-GCWfmTimeOffRequest.ps1

<#
.SYNOPSIS
    Updates an existing time off request in a management unit in Genesys Cloud.

.DESCRIPTION
    Sends a PATCH request to the Genesys Cloud API to update a specific time off request
    within a management unit.
    API Endpoint: PATCH /api/v2/workforcemanagement/managementunits/{managementUnitId}/timeoffrequests/{timeOffRequestId}

.PARAMETER ManagementUnitId
    The unique identifier of the management unit containing the time off request.

.PARAMETER TimeOffRequestId
    The unique identifier of the time off request to update.

.PARAMETER Body
    The request body containing the fields to update on the time off request.
    Should conform to the Genesys Cloud time off request update schema.

.EXAMPLE
    $updateBody = @{
        status = 'APPROVED'
        notes = 'Approved by manager'
    }
    Set-GCWfmTimeOffRequest -ManagementUnitId 'mu-123' -TimeOffRequestId 'tor-456' -Body $updateBody
    Updates the status and notes of the specified time off request.

.NOTES
    Genesys Cloud API: PATCH /api/v2/workforcemanagement/managementunits/{managementUnitId}/timeoffrequests/{timeOffRequestId}
#>

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

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

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

    $endpoint = "workforcemanagement/managementunits/$ManagementUnitId/timeoffrequests/$TimeOffRequestId"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method PATCH -Body $Body
}