Public/Get-GCUserMe.ps1

<#
.SYNOPSIS
    Retrieves the current authenticated user from Genesys Cloud.

.DESCRIPTION
    Queries the Genesys Cloud API to retrieve information about the currently
    authenticated user (the user associated with the access token).
    API Endpoint: GET /api/v2/users/me

.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-GCUserMe
    Retrieves the current authenticated user.

.EXAMPLE
    Get-GCUserMe -Expand @('presence', 'authorization')
    Retrieves the current user with expanded presence and authorization information.

.NOTES
    Genesys Cloud API: GET /api/v2/users/me
#>

function Get-GCUserMe {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $false)]
        [string[]]$Expand
    )

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

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