Interface BusClient


public interface BusClient
A client for interacting with the CTA Bus Tracker API.
  • Method Details

    • getRoutes

      List<Route> getRoutes()
      Retrieves a List of all bus routes.
      Returns:
      a List of all bus routes
      Throws:
      Cta4jException - if an error occurs while fetching the data
    • getDirections

      List<String> getDirections(String routeId)
      Retrieves a List of directions for a specific bus route.
      Parameters:
      routeId - the ID of the bus route
      Returns:
      a List of directions for the specified bus route
      Throws:
      NullPointerException - if the specified bus route is null
      Cta4jException - if an error occurs while fetching the data
    • getStops

      List<Stop> getStops(String routeId, String direction)
      Retrieves a List of stops for a specific bus route and direction.
      Parameters:
      routeId - the ID of the bus route
      direction - the direction of the bus route
      Returns:
      a List of stops for the specified bus route and direction
      Throws:
      NullPointerException - if the specified bus route or direction is null
      Cta4jException - if an error occurs while fetching the data
    • getStopArrivals

      List<StopArrival> getStopArrivals(String routeId, String stopId)
      Retrieves a List of upcoming arrivals for a specific bus route and stop.
      Parameters:
      routeId - the ID of the bus route
      stopId - the ID of the bus stop
      Returns:
      a List of upcoming arrivals for the specified bus route and stop
      Throws:
      NullPointerException - if the specified bus route or stop is null
      Cta4jException - if an error occurs while fetching the data
    • getDetours

      List<Detour> getDetours(String routeId, String direction)
      Retrieves a List of detours for a specific bus route and direction.
      Parameters:
      routeId - the ID of the bus route
      direction - the direction of the bus route
      Returns:
      a List of detours for the specified bus route and direction
      Throws:
      NullPointerException - if the specified bus route or direction is null
      Cta4jException - if an error occurs while fetching the data
    • getBus

      Optional<Bus> getBus(String id)
      Retrieves information about a specific bus by its ID.
      Parameters:
      id - the ID of the bus
      Returns:
      an Optional containing the bus information if found, or an empty Optional if not found
      Throws:
      NullPointerException - if the specified bus ID is null
      Cta4jException - if an error occurs while fetching the data
    • builder

      static BusClient.Builder builder()
      Creates a new BusClient.Builder for configuring and building a BusClient.
      Returns:
      a new BusClient.Builder instance