@RestController
@CrossOrigin(origins="*")
@RequestMapping(value="/api/v1/packs")
public class ServerPackController
extends java.lang.Object
/api/v1/packs.| Constructor and Description |
|---|
ServerPackController(ServerPackService injectedServerPackService)
Constructor responsible for our DI.
|
| Modifier and Type | Method and Description |
|---|---|
org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> |
downloadServerPack(int id)
GET request for downloading a server pack by the id in the database.
|
org.springframework.http.ResponseEntity<java.util.List<ServerPackModel>> |
getAllServerPacks()
GET request for retrieving a list of all available server packs.
|
org.springframework.http.ResponseEntity<java.lang.Object> |
voteForServerPack(java.lang.String voting)
GET request for voting whether a server pack works or not.
|
@Autowired public ServerPackController(ServerPackService injectedServerPackService)
injectedServerPackService - Instance of ServerPackService@GetMapping(value="/download/{id}",
produces="application/zip")
public org.springframework.http.ResponseEntity<org.springframework.core.io.Resource> downloadServerPack(@PathVariable
int id)
id - The id of the server pack in the database.@GetMapping(value="all") public org.springframework.http.ResponseEntity<java.util.List<ServerPackModel>> getAllServerPacks()
@GetMapping(value="vote/{voting}")
public org.springframework.http.ResponseEntity<java.lang.Object> voteForServerPack(@PathVariable(value="voting")
java.lang.String voting)
voting - The vote, consisting of the id of the server pack and whether the vote should be
incremented or decremented. Example 42,up or 23,down.