Search in sources :

Example 1 with ApiStopTimesInPattern

use of org.opentripplanner.api.model.ApiStopTimesInPattern in project OpenTripPlanner by opentripplanner.

the class IndexAPI method getStoptimesForStopAndDate.

/**
 * Return upcoming vehicle arrival/departure times at the given stop.
 * @param date in YYYYMMDD or YYYY-MM-DD format
 */
@GET
@Path("/stops/{stopId}/stoptimes/{date}")
public List<ApiStopTimesInPattern> getStoptimesForStopAndDate(@PathParam("stopId") String stopId, @PathParam("date") String date, @QueryParam("omitNonPickups") boolean omitNonPickups) {
    RoutingService routingService = createRoutingService();
    Stop stop = getStop(routingService, stopId);
    ServiceDate serviceDate = parseServiceDate("date", date);
    List<StopTimesInPattern> stopTimes = routingService.getStopTimesForStop(stop, serviceDate, omitNonPickups);
    return StopTimesInPatternMapper.mapToApi(stopTimes);
}
Also used : ServiceDate(org.opentripplanner.model.calendar.ServiceDate) ApiStop(org.opentripplanner.api.model.ApiStop) Stop(org.opentripplanner.model.Stop) RoutingService(org.opentripplanner.routing.RoutingService) StopTimesInPattern(org.opentripplanner.model.StopTimesInPattern) ApiStopTimesInPattern(org.opentripplanner.api.model.ApiStopTimesInPattern) Path(javax.ws.rs.Path) GET(javax.ws.rs.GET)

Example 2 with ApiStopTimesInPattern

use of org.opentripplanner.api.model.ApiStopTimesInPattern in project OpenTripPlanner by opentripplanner.

the class StopTimesInPatternMapper method mapToApi.

public static ApiStopTimesInPattern mapToApi(StopTimesInPattern domain) {
    if (domain == null) {
        return null;
    }
    ApiStopTimesInPattern api = new ApiStopTimesInPattern();
    api.pattern = TripPatternMapper.mapToApiShort(domain.pattern);
    api.times = TripTimeMapper.mapToApi(domain.times);
    return api;
}
Also used : ApiStopTimesInPattern(org.opentripplanner.api.model.ApiStopTimesInPattern)

Aggregations

ApiStopTimesInPattern (org.opentripplanner.api.model.ApiStopTimesInPattern)2 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 ApiStop (org.opentripplanner.api.model.ApiStop)1 Stop (org.opentripplanner.model.Stop)1 StopTimesInPattern (org.opentripplanner.model.StopTimesInPattern)1 ServiceDate (org.opentripplanner.model.calendar.ServiceDate)1 RoutingService (org.opentripplanner.routing.RoutingService)1