Package com.cta4j.bus.vehicle
Interface VehiclesApi
@NullMarked
public interface VehiclesApi
Provides access to vehicle-related endpoints of the CTA BusTime API.
This API allows retrieval of vehicles by their IDs or by associated route IDs.
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves a vehicle by its ID.findByIds(Collection<String> ids) Retrieves vehicles by their IDs.findByRouteId(String routeId) Retrieves all vehicles for the specified route ID.findByRouteIds(Collection<String> routeIds) Retrieves all vehicles for the specified route IDs.
-
Method Details
-
findByIds
Retrieves vehicles by their IDs.- Parameters:
ids- aCollectionof vehicle IDs- Returns:
- a
ListofVehicles corresponding to the provided IDs, or an emptyListif no vehicles are found - Throws:
NullPointerException- ifidsisnullor containsnullelements
-
findById
Retrieves a vehicle by its ID.- Parameters:
id- the vehicle ID- Returns:
- an
Optionalcontaining theVehicleif found, or an emptyOptionalif no vehicle exists with the given ID - Throws:
NullPointerException- ifidisnullCta4jException- if multiple vehicles are found for the given ID
-
findByRouteIds
Retrieves all vehicles for the specified route IDs.- Parameters:
routeIds- aCollectionof route IDs- Returns:
- a
ListofVehicles associated with the route IDs, or an emptyListif no vehicles exist for the route IDs - Throws:
NullPointerException- ifrouteIdsisnullor containsnullelements
-
findByRouteId
Retrieves all vehicles for the specified route ID.- Parameters:
routeId- the route ID- Returns:
- a
ListofVehicles associated with the route ID, or an emptyListif no vehicles exist for the route ID - Throws:
NullPointerException- ifrouteIdisnull
-