Skip to content
/ mta Public

The library that provides an interface to MTA Real-Time Data Feeds.

License

Notifications You must be signed in to change notification settings

errornil/mta

Repository files navigation

mta

main

mta is the library that provides an interface to MTA Real-Time Data Feeds.

Subway (GTFS-realtime feeds)

Read and Accept agreement

Example

import "github.com/errornil/mta/v2"

client, err := mta.NewSubwayClient(
    &http.Client{
        Timeout: 30 * time.Second,
    },
    "53b2c13dbc574e8cb4bf964dd2a215e253b2c13d", // API Key (this is a fake one)
    "github.com/errornil/mta:v2.0",
)

resp, err := client.GetFeedMessage(mta.Line123456S)
// check err

resp has type FeedMessage (generated).

ProtoBuf

MTA uses realtime-GTFS with their own extension for subway feeds. To re-regenerate generatated code run following command with protoc:

cd proto
protoc --go_out=../transit_realtime gtfs-realtime.proto nyct-subway.proto

Bus Times

Read and Accept agreement

Example

import "github.com/errornil/mta/v2"

client, err := mta.NewBusTimeClient(
    &http.Client{
        Timeout: 30 * time.Second,
    },
    "fa05aa30-3c71-4953-91c8-65b46c6e5f78", // API Key (this is a fake one)
    "github.com/errornil/mta:v2.0",
)

resp, err := client.GetStopMonitoring(400933) // 400933 is the stop ID for "AV OF THE AMERICANS/W 34 ST" bus stop
// check err

resp has type StopMonitoringResponse.

Legal

This repository is not endorsed by, directly affiliated with, maintained, authorized, or sponsored by MTA. All product and company names are the registered trademarks of their original owners. The use of any trade name or trademark is for identification and reference purposes only and does not imply any association with the trademark owner.

About

The library that provides an interface to MTA Real-Time Data Feeds.

Resources

License

Stars

Watchers

Forks

Packages

No packages published