Interface StopsApi


@NullMarked public interface StopsApi
Provides access to stop-related endpoints of the CTA BusTime API.

This API allows retrieval of stops by route ID and direction, as well as by stop IDs.

  • Method Details

    • findByRouteIdAndDirection

      List<Stop> findByRouteIdAndDirection(String routeId, String direction)
      Retrieves stops by route ID and direction.
      Parameters:
      routeId - the route ID
      direction - the direction (e.g., "Northbound", "Southbound")
      Returns:
      a List of Stops corresponding to the provided route ID and direction, or an empty List if no stops are found
      Throws:
      NullPointerException - if routeId or direction is null
    • findByIds

      List<Stop> findByIds(Collection<String> stopIds)
      Retrieves stops by their IDs.
      Parameters:
      stopIds - a Collection of stop IDs
      Returns:
      a List of Stops corresponding to the provided stop IDs, or an empty List if no stops are found
      Throws:
      NullPointerException - if stopIds is null or contains null elements
    • findById

      default Optional<Stop> findById(String stopId)
      Retrieves a stop by its ID.
      Parameters:
      stopId - the stop ID
      Returns:
      an Optional containing the Stop if found, or an empty Optional if no stop exists with the given ID
      Throws:
      NullPointerException - if stopId is null
      Cta4jException - if multiple stops are found for the given ID