Coder Social home page Coder Social logo

przbadu / mtaservicestatus Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cheesemacfly/mtaservicestatus

0.0 1.0 0.0 27 KB

C# library to get the latest MTA service status

Home Page: https://www.nuget.org/packages/MTAServiceStatus

License: MIT License

C# 100.00%

mtaservicestatus's Introduction

Build Status Build status NuGet

What?

Simple C# library to get the latest MTA service status.
Available as a nuget package here: https://www.nuget.org/packages/MTAServiceStatus
or running the command: PM> Install-Package MTAServiceStatus

How?

If you need to get the status per subway line, you can use the MTASubwayStatus class.

var status = new MTASubwayStatus();
var lines = await status.GetLinesAsync();
foreach(var line in lines)
{
	Console.WriteLine("Line {0} current status: {1}", line.Name, line.Status);
}
// Displays:
// Line 1 current status: GOOD_SERVICE
// Line 2 current status: DELAYS
// Line A current status: PLANNED_WORK

If you are looking for buses or other trains, you have to use the MTARepository class:

var repo = new MTARepository();
var status = await repo.GetServiceAsync();
var goodService = from s in status.Bus
                  where s.Status == ServiceStatus.GOOD_SERVICE
                  select s;

Console.WriteLine("Currently {0} bus line groups with \"GOOD SERVICE\"", goodService.Count());
//Displays "Currently 4 bus line groups with "GOOD SERVICE""

Available groups available through this class are: BT, Bus, LIRR, MetroNorth and Subway.

I am planning on getting the same process used for subway (per line status versus per group) applied to the other groups in a later release.

mtaservicestatus's People

Contributors

cheesemacfly avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.