@POST @Path("/createWithList") @ApiOperation(value = "Creates list of users with given input array") public Response createUsersWithListInput( @ApiParam(value = "List of user object", required = true) java.util.List<User> users) { for (User user : users) { userData.addUser(user); } return Response.ok().entity("").build(); }
@DELETE @Path("/{username}") @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.") @ApiResponses( value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public Response deleteUser( @ApiParam(value = "The name that needs to be deleted", required = true) @PathParam("username") String username) { userData.removeUser(username); return Response.ok().entity("").build(); }
@PUT @Path("/{username}") @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.") @ApiResponses( value = { @ApiResponse(code = 400, message = "Invalid user supplied"), @ApiResponse(code = 404, message = "User not found") }) public Response updateUser( @ApiParam(value = "name that need to be deleted", required = true) @PathParam("username") String username, @ApiParam(value = "Updated user object", required = true) User user) { userData.addUser(user); return Response.ok().entity("").build(); }
@GET @Path("/{username}") @ApiOperation(value = "Get user by user name", response = User.class) @ApiResponses( value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) public Response getUserByName( @ApiParam( value = "The name that needs to be fetched. Use user1 for testing. ", required = true) @PathParam("username") String username) throws ApiException { User user = userData.findUserByName(username); if (null != user) { return Response.ok().entity(user).build(); } else { throw new NotFoundException(404, "User not found"); } }
@POST @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.") public Response createUser(@ApiParam(value = "Created user object", required = true) User user) { userData.addUser(user); return Response.ok().entity("").build(); }