Public/Set-GCUser.ps1

<#
.SYNOPSIS
    Updates an existing user in Genesys Cloud.

.DESCRIPTION
    Partially updates a user in Genesys Cloud using a PATCH request. Only the fields
    included in the body will be modified. Other fields remain unchanged.
    API Endpoint: PATCH /api/v2/users/{userId}

.PARAMETER UserId
    The unique identifier of the user to update.

.PARAMETER Body
    The request body containing the user properties to update. Accepts a hashtable or JSON string.

.EXAMPLE
    Set-GCUser -UserId '12345678-1234-1234-1234-123456789012' -Body @{ department = 'Sales' }
    Updates the department for the specified user.

.EXAMPLE
    Set-GCUser -UserId '12345678-1234-1234-1234-123456789012' -Body @{ title = 'Manager'; version = 3 }
    Updates the title of the specified user. The version field is required for concurrency control.

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

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

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

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