Public/Get-AvailableDevices.ps1

function Get-AvailableDevices {
  <#
  .SYNOPSIS
    List available devices for user
  .EXAMPLE
    PS C:\> Get-AvailableDevices -Username "blahblah"
  #>

  param(
    # Username
    [Parameter(Mandatory)]
    [string]
    $Username
  )

  Write-Verbose "Attempting to return available devices for user with username $Username"
  $Method = "Get"
  $Uri = "https://api.spotify.com/v1/me/player/devices"
  $UserAccessToken = Get-SpotifyUserAccessToken -Username $Username
  $Auth = @{
    Authorization = "Bearer $($UserAccessToken.access_token)"
  }

  $Response = Send-SpotifyCall -Method $Method -Uri $Uri -Header $Auth -ErrorAction Stop
  return $Response.devices
}