Public/Get-GCUser.ps1

<#
.SYNOPSIS
    Retrieves a single user from Genesys Cloud by user ID.

.DESCRIPTION
    Queries the Genesys Cloud API to retrieve detailed information about a specific user.
    Supports expanding related resources in the response.
    API Endpoint: GET /api/v2/users/{userId}

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

.PARAMETER Expand
    An array of fields to expand in the response. Valid values include 'routingStatus',
    'presence', 'integrationPresence', 'conversationSummary', 'outOfOffice', 'geolocation',
    'station', 'authorization', 'lasttokenissued', 'dateLastLogin', 'team', 'profileSkills',
    'certifications', 'locations', 'groups', 'skills', 'languages', 'languagePreference'.

.EXAMPLE
    Get-GCUser -UserId '12345678-1234-1234-1234-123456789012'
    Retrieves the user with the specified ID.

.EXAMPLE
    Get-GCUser -UserId '12345678-1234-1234-1234-123456789012' -Expand @('presence', 'station')
    Retrieves the user with expanded presence and station information.

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

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

        [Parameter(Mandatory = $false)]
        [string[]]$Expand
    )

    $queryParams = @{}
    if ($Expand) { $queryParams['expand'] = $Expand -join ',' }

    $endpoint = "users/$UserId"
    return Invoke-GCApiRequest -Endpoint $endpoint -Method GET -QueryParameters $queryParams
}