public interface BusClient
A client for interacting with the CTA Bus Tracker API.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA builder for configuring and creatingBusClientinstances. -
Method Summary
Modifier and TypeMethodDescriptionstatic BusClient.Builderbuilder()Creates a newBusClient.Builderfor configuring and building aBusClient.Retrieves information about a specific bus by its ID.getDetours(String routeId, String direction) Retrieves aListof detours for a specific bus route and direction.getDirections(String routeId) Retrieves aListof directions for a specific bus route.Retrieves aListof all bus routes.getStopArrivals(String routeId, String stopId) Retrieves aListof upcoming arrivals for a specific bus route and stop.Retrieves aListof stops for a specific bus route and direction.
-
Method Details
-
getRoutes
Retrieves aListof all bus routes.- Returns:
- a
Listof all bus routes - Throws:
Cta4jException- if an error occurs while fetching the data
-
getDirections
Retrieves aListof directions for a specific bus route.- Parameters:
routeId- the ID of the bus route- Returns:
- a
Listof directions for the specified bus route - Throws:
NullPointerException- if the specified bus route isnullCta4jException- if an error occurs while fetching the data
-
getStops
Retrieves aListof stops for a specific bus route and direction.- Parameters:
routeId- the ID of the bus routedirection- the direction of the bus route- Returns:
- a
Listof stops for the specified bus route and direction - Throws:
NullPointerException- if the specified bus route or direction isnullCta4jException- if an error occurs while fetching the data
-
getStopArrivals
Retrieves aListof upcoming arrivals for a specific bus route and stop.- Parameters:
routeId- the ID of the bus routestopId- the ID of the bus stop- Returns:
- a
Listof upcoming arrivals for the specified bus route and stop - Throws:
NullPointerException- if the specified bus route or stop isnullCta4jException- if an error occurs while fetching the data
-
getDetours
Retrieves aListof detours for a specific bus route and direction.- Parameters:
routeId- the ID of the bus routedirection- the direction of the bus route- Returns:
- a
Listof detours for the specified bus route and direction - Throws:
NullPointerException- if the specified bus route or direction isnullCta4jException- if an error occurs while fetching the data
-
getBus
Retrieves information about a specific bus by its ID.- Parameters:
id- the ID of the bus- Returns:
- an
Optionalcontaining the bus information if found, or an emptyOptionalif not found - Throws:
NullPointerException- if the specified bus ID isnullCta4jException- if an error occurs while fetching the data
-
builder
Creates a newBusClient.Builderfor configuring and building aBusClient.- Returns:
- a new
BusClient.Builderinstance
-