Skip to content

Find out how late your Met's going to be with Powershell.

Notifications You must be signed in to change notification settings

phlcrny/PSMetrolink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PSMetrolink

I was playing around with the TFGM/Metrolink API in the console, and after a while it seemed stupid to be re-using the same hacked together code when I could write something up.

Usage

Sign-up for a TFGM api key, then follow the example below:

# Install the module
Install-Module -Name "PSMetrolink" -Repository "PSGallery"

# Save your subscription key for ease of use - don't save it to your history
$OriginalSaveStyle = (Get-PSReadLineOption).HistorySaveStyle
Set-PSReadLineOption -HistorySaveStyle SaveNothing
$Key = "abcdefghi123456789"
Set-PSReadLineOption -HistorySaveStyle $OriginalSaveStyle

# Retrieve Metrolinks arriving at Bury.
Get-Metrolink -Station "Bury" -Key $Key
# or trams
Get-Tram -Key $Key
# or Mets
Get-Met -Station "Radcliffe" -Key $Key

# There's a generational difference.

Notes

The structure and build/publishing process borrows* heavily from Kevin Marquette's Micro Modules write-up on PowershellExplained.com.