Public/Get-GCLocations.ps1

<#
.SYNOPSIS
    Retrieves a list of locations.

.DESCRIPTION
    Returns a paginated list of locations from Genesys Cloud.
    Uses the GET /api/v2/locations endpoint.

.PARAMETER PageSize
    The number of results per page. Defaults to 25.

.PARAMETER PageNumber
    The page number to retrieve. Defaults to 1.

.PARAMETER SortOrder
    The sort direction: ascending or descending.

.EXAMPLE
    Get-GCLocations

.EXAMPLE
    Get-GCLocations -PageSize 50 -SortOrder 'asc'

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

function Get-GCLocations {
    [CmdletBinding()]
    param(
        [Parameter()]
        [int]$PageSize = 25,

        [Parameter()]
        [int]$PageNumber = 1,

        [Parameter()]
        [string]$SortOrder
    )

    $endpoint = "locations"
    $queryParams = @{
        pageSize   = $PageSize
        pageNumber = $PageNumber
    }

    if ($SortOrder) { $queryParams['sortOrder'] = $SortOrder }

    return Invoke-GCApiRequest -Endpoint $endpoint -Method GET -QueryParameters $queryParams
}