Public/Set-GCUserOutOfOffice.ps1

<#
.SYNOPSIS
    Sets the out of office settings for a user in Genesys Cloud.

.DESCRIPTION
    Replaces the out of office configuration for a specific user using a PUT request.
    API Endpoint: PUT /api/v2/users/{userId}/outofoffice

.PARAMETER UserId
    The unique identifier of the user.

.PARAMETER Body
    The request body containing the out of office settings. Accepts a hashtable or JSON string.
    Should include properties like 'active', 'startDate', 'endDate'.

.EXAMPLE
    Set-GCUserOutOfOffice -UserId '12345678-1234-1234-1234-123456789012' -Body @{ active = $true; startDate = '2024-12-20T00:00:00Z'; endDate = '2024-12-27T00:00:00Z' }
    Sets the out of office for the specified user.

.NOTES
    Genesys Cloud API: PUT /api/v2/users/{userId}/outofoffice
#>

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

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

    $endpoint = "users/$UserId/outofoffice"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method PUT -Body $Body
}