package cactusServer.resources; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import cactusServer.entities.Account; import cactusServer.models.Accounts; @Path("/AccountsRest") public class AccountsRest { @POST @Path("/login") @Produces(MediaType.APPLICATION_JSON) public Account loginAccount(@FormParam("userID") String userID, @FormParam("userPass") String userPass) { return Accounts.getInstance().loginAccount(userID, userPass); } @POST @Path("/logout") @Produces(MediaType.TEXT_PLAIN) public String logoutAccount(@FormParam("token") String token) { return Accounts.getInstance().logoutAccount(token); } @POST @Path("/createAccount") @Produces(MediaType.APPLICATION_JSON) public Account create(@FormParam("userID") String userID, @FormParam("userName") String userName, @FormParam("userPass") String userPass) { return Accounts.getInstance().createAcount(userID, userName, userPass); } @PUT @Path("/updateAccount") @Produces(MediaType.APPLICATION_JSON) public Account updateAccount(@FormParam("userID") String userID, @FormParam("userName") String userName, @FormParam("userPass") String userPass) { return Accounts.getInstance().updateAccount(userID, userName, userPass); } @GET @Path("/{userID}") @Produces(MediaType.APPLICATION_JSON) public Account getAccount(@PathParam("userID") String userID) { return Accounts.getInstance().getAccount(userID); } @DELETE @Path("/deleteAccount") @Produces(MediaType.TEXT_PLAIN) public String deleteAccount(@FormParam("userID") String userID) { return Accounts.getInstance().deleteAccount(userID); } }