Implement TripService REST (2.1.3.1)

This commit is contained in:
2021-04-29 11:23:36 +02:00
parent f5298764ba
commit 15b6d0a4a5
2 changed files with 104 additions and 16 deletions
@@ -2,35 +2,48 @@ package dst.ass2.service.api.trip.rest;
import dst.ass2.service.api.trip.*;
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
/**
* This interface exposes the {@code ITripService} as a RESTful interface.
*/
@Path("trips")
public interface ITripServiceResource {
@POST
Response createTrip(@FormParam("riderId") Long riderId, @FormParam("pickupId") Long pickupId, @FormParam("destinationId") Long destinationId)
throws EntityNotFoundException, InvalidTripException;
// TODO annotate the class and methods with the correct javax.ws.rs annotations
@PATCH
@Path("{id}/confirm")
Response confirm(@PathParam("id") Long tripId) throws EntityNotFoundException, InvalidTripException;
Response createTrip(Long riderId, Long pickupId, Long destinationId)
throws EntityNotFoundException, InvalidTripException;
@GET
@Path("{id}")
Response getTrip(@PathParam("id") Long tripId) throws EntityNotFoundException;
Response confirm(Long tripId) throws EntityNotFoundException, InvalidTripException;
@DELETE
@Path("{id}")
Response deleteTrip(@PathParam("id") Long tripId) throws EntityNotFoundException;
Response getTrip(Long tripId) throws EntityNotFoundException;
@POST
@Path("{id}/stops")
Response addStop(@PathParam("id") Long tripId, @FormParam("locationId") Long locationId) throws InvalidTripException, EntityNotFoundException;
Response deleteTrip(Long tripId) throws EntityNotFoundException;
Response addStop(Long tripId, Long locationId) throws InvalidTripException, EntityNotFoundException;
Response removeStop(Long tripId, Long locationId) throws InvalidTripException, EntityNotFoundException;
Response match(Long tripId, MatchDTO matchDTO) throws EntityNotFoundException, DriverNotAvailableException;
Response complete(Long tripId, TripInfoDTO tripInfoDTO) throws EntityNotFoundException;
Response cancel(Long tripId) throws EntityNotFoundException;
@DELETE
@Path("{id}/stops")
Response removeStop(@PathParam("id") Long tripId, @FormParam("locationId") Long locationId) throws InvalidTripException, EntityNotFoundException;
@POST
@Path("{id}/match")
Response match(@PathParam("id") Long tripId, MatchDTO matchDTO) throws EntityNotFoundException, DriverNotAvailableException;
@POST
@Path("{id}/complete")
Response complete(@PathParam("id") Long tripId, TripInfoDTO tripInfoDTO) throws EntityNotFoundException;
@PATCH
@Path("{id}/cancel")
Response cancel(@PathParam("id") Long tripId) throws EntityNotFoundException;
}