Package com.cta4j.train
Interface TrainApi
@NullMarked
public interface TrainApi
Primary entry point for interacting with the CTA Train Tracker API.
This interface provides grouped sub-APIs for different aspects of the Train Tracker API, such as stations, arrivals, train following, and locations.
Instances of TrainApi are immutable and thread-safe once built.
Use builder(String) to construct a configured instance.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceBuilder for constructingTrainApiinstances. -
Method Summary
Modifier and TypeMethodDescriptionarrivals()Provides access to arrival-related endpoints.static TrainApi.BuilderCreates a newTrainApi.Builderfor constructing aTrainApi.follow()Provides access to train follow-related endpoints.Provides access to location-related endpoints.stations()Provides access to station-related endpoints.
-
Method Details
-
stations
StationsApi stations()Provides access to station-related endpoints.- Returns:
- the
StationsApi
-
arrivals
ArrivalsApi arrivals()Provides access to arrival-related endpoints.- Returns:
- the
ArrivalsApi
-
follow
FollowApi follow()Provides access to train follow-related endpoints.- Returns:
- the
FollowApi
-
locations
LocationsApi locations()Provides access to location-related endpoints.- Returns:
- the
LocationsApi
-
builder
Creates a newTrainApi.Builderfor constructing aTrainApi.- Parameters:
apiKey- the CTA Train Tracker API key- Returns:
- a new
TrainApi.Builder - Throws:
NullPointerException- ifapiKeyisnull
-