public interface TrainClient
A client for interacting with the CTA Train Tracker API.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for configuring and creatingTrainClientinstances. -
Method Summary
Modifier and TypeMethodDescriptionstatic TrainClient.Builderbuilder()Creates a newTrainClient.Builderfor configuring and building aTrainClient.getStationArrivals(String stationId) Retrieves aListof upcoming arrivals for a specific station.Retrieves information about a specific train by its run number.
-
Method Details
-
getStationArrivals
Retrieves aListof upcoming arrivals for a specific station.- Parameters:
stationId- the ID of the station- Returns:
- a
Listof upcoming arrivals for the specified station - Throws:
NullPointerException- if the specified station ID isnullCta4jException- if an error occurs while fetching the data
-
getTrain
Retrieves information about a specific train by its run number.- Parameters:
run- the run number of the train- Returns:
- an
Optionalcontaining the train information if found, or an emptyOptionalif not found - Throws:
NullPointerException- if the specified run number isnullCta4jException- if an error occurs while fetching the data
-
builder
Creates a newTrainClient.Builderfor configuring and building aTrainClient.- Returns:
- a new
TrainClient.Builderinstance
-