Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions src/main/java/de/abstractolotl/azplace/rest/api/AuthAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
Expand All @@ -13,10 +12,6 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import org.springframework.web.servlet.resource.HttpResource;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import static org.springframework.http.MediaType.TEXT_HTML_VALUE;
Expand All @@ -41,7 +36,7 @@
public interface AuthAPI {

@Operation(summary = "Start login and redirect to CAS")
@GetMapping(path = "/login", produces = MediaType.TEXT_HTML_VALUE)
@GetMapping(path = "/login", produces = { MediaType.TEXT_HTML_VALUE, "text/v1+html" } )
String login(@RequestHeader(HttpHeaders.HOST) String hostName);

@Operation(
Expand All @@ -56,7 +51,7 @@ public interface AuthAPI {
- Backend caches SessionKey and User via Spring session
- It redirect to the frontend
""")
@GetMapping(path = "/verify", produces = MediaType.TEXT_HTML_VALUE)
@GetMapping(path = "/verify", produces = { MediaType.TEXT_HTML_VALUE, "text/v1+html" })
@ResponseBody
ResponseEntity<String> verify(@RequestParam("ticket") String ticket);

Expand All @@ -68,7 +63,7 @@ public interface AuthAPI {
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "OK")
})
@GetMapping(path = "/logout", produces = MediaType.TEXT_HTML_VALUE)
@GetMapping(path = "/logout", produces = { MediaType.TEXT_HTML_VALUE, "text/v1+html" })
@ResponseBody
ResponseEntity<String> logout(HttpSession httpSession);

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/abstractolotl/azplace/rest/api/BoardAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@RequestMapping("board")
public interface BoardAPI {

@PostMapping(value = "{canvasId}/place", consumes = APPLICATION_JSON_VALUE)
@PostMapping(value = "{canvasId}/place", consumes = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(
summary = "Place a Pixel",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
Expand All @@ -44,7 +44,7 @@ public interface BoardAPI {
)
void place(@PathVariable int canvasId, @RequestBody PlaceRequest request);

@GetMapping(value = "{canvasId}/pixel/{x}/{y}", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "{canvasId}/pixel/{x}/{y}", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get Information about a pixel")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "PixelInfo returned",
Expand All @@ -56,15 +56,15 @@ public interface BoardAPI {
@Operation(summary = "Get the current board data")
byte[] boardData(@PathVariable int canvasId);

@GetMapping(value = "/{canvasId}/cooldown", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/{canvasId}/cooldown", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get your current cooldown information" )
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Current user cooldown returned",
content = @Content(schema = @Schema(implementation = CooldownView.class)))
})
CooldownView cooldown(@PathVariable int canvasId);

@GetMapping(value = "/{canvasId}/config", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/{canvasId}/config", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get board configuration" )
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Current user cooldown returned",
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/de/abstractolotl/azplace/rest/api/BotAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@RequestMapping("bot")
public interface BotAPI {

@PostMapping(value = "/create")
@PostMapping(value = "/create", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Create a new bot token")
@ApiResponses(value = {
@ApiResponse(responseCode = "200",
Expand All @@ -43,7 +43,7 @@ public interface BotAPI {
})
BotView createBotToken();

@GetMapping(value = "/info")
@GetMapping(value = "/info", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get your current bot token")
@ApiResponses(value = {
@ApiResponse(responseCode = "200",
Expand All @@ -52,7 +52,7 @@ public interface BotAPI {
})
BotView getBotToken();

@PostMapping(value = "/refresh")
@PostMapping(value = "/refresh", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Regenerate your current bot token")
@ApiResponses(value = {
@ApiResponse(responseCode = "200",
Expand All @@ -61,7 +61,7 @@ public interface BotAPI {
})
BotView refreshToken();

@PostMapping(value = "/{canvasId}/place")
@PostMapping(value = "/{canvasId}/place", consumes = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(
summary = "Place a pixel via bot token",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
Expand Down
24 changes: 12 additions & 12 deletions src/main/java/de/abstractolotl/azplace/rest/api/OperationAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@RequestMapping(value = "operation")
public interface OperationAPI {

@GetMapping(value = "/canvas/{id}", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/canvas/{id}", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "GET", summary = "Get current canvas data")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Canvas found and returned",
Expand All @@ -45,8 +45,8 @@ public interface OperationAPI {
Canvas getCanvas(@PathVariable Integer id);

@PostMapping(value = "/canvas",
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
consumes = { APPLICATION_JSON_VALUE, "application/v1+json" },
produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "POST", summary = "Create new canvas",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
content = @Content(schema = @Schema(implementation = CanvasRequest.class))
Expand All @@ -60,8 +60,8 @@ public interface OperationAPI {
Canvas createCanvas(@RequestBody CanvasRequest canvasRequest);

@PatchMapping(value = "/canvas/{id}",
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
consumes = { APPLICATION_JSON_VALUE, "application/v1+json" },
produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "PATCH", summary = "Update an existing canvas",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
content = @Content(schema = @Schema(implementation = CanvasRequest.class))
Expand All @@ -74,15 +74,15 @@ public interface OperationAPI {
Canvas updateCanvas(@PathVariable Integer id, @RequestBody CanvasRequest canvasRequest);

@DeleteMapping(value = "/canvas/{id}",
produces = APPLICATION_JSON_VALUE)
produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "DELETE", summary = "Delete an existing canvas")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Canvas deleted successfully",
content = @Content(schema = @Schema(implementation = ResponseEntity.class))),
})
ResponseEntity<?> deleteCanvas(@PathVariable Integer id);

@GetMapping(value = "/palette/{id}", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/palette/{id}", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "GET", summary = "Get current palette data")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Palette found and returned",
Expand All @@ -91,8 +91,8 @@ public interface OperationAPI {
ColorPalette getPalette(@PathVariable Integer id);

@PostMapping(value = "/palette",
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
consumes = { APPLICATION_JSON_VALUE, "application/v1+json" },
produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "POST", summary = "Create new palette",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
content = @Content(schema = @Schema(implementation = PaletteRequest.class))
Expand All @@ -106,8 +106,8 @@ public interface OperationAPI {
ColorPalette createPalette(@RequestBody PaletteRequest paletteRequest);

@PatchMapping(value = "/palette/{id}",
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE)
consumes = { APPLICATION_JSON_VALUE, "application/v1+json" },
produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "PATCH", summary = "Update an existing palette",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
content = @Content(schema = @Schema(implementation = PaletteRequest.class))
Expand All @@ -120,7 +120,7 @@ public interface OperationAPI {
ColorPalette updatePalette(@PathVariable Integer id, @RequestBody PaletteRequest paletteRequest);

@DeleteMapping(value = "/palette/{id}",
produces = APPLICATION_JSON_VALUE)
produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(method = "DELETE", summary = "Delete an existing palette")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Palette deleted successfully",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ public interface PunishmentAPI {

@PostMapping(
value = "/ban",
consumes = APPLICATION_JSON_VALUE,
produces = APPLICATION_JSON_VALUE
consumes = { APPLICATION_JSON_VALUE, "application/v1+json" },
produces = { APPLICATION_JSON_VALUE, "application/v1+json" }
)
@Operation(
method = "POST",
Expand All @@ -62,7 +62,7 @@ public interface PunishmentAPI {

@PostMapping(
value = "/pardon/{banId}",
produces = APPLICATION_JSON_VALUE
produces = { APPLICATION_JSON_VALUE, "application/v1+json" }
)
@Operation(method = "POST", summary = "Pardon a user")
@ApiResponses(value = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
@RequestMapping("statistics")
public interface StatisticsAPI {

@GetMapping(value = "/pixels", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/pixels", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get placed pixels in the last 24h")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Pixel statistics calculated and returned",
content = @Content(schema = @Schema(implementation = CountView.class)))
})
CountView pixels();

@GetMapping(value = "/online", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/online", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get amount of currently online users")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Amount of currently online users returned",
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/de/abstractolotl/azplace/rest/api/UserAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@RequestMapping("user")
public interface UserAPI {

@GetMapping(value = "/", produces = APPLICATION_JSON_VALUE)
@GetMapping(value = "/", produces = { APPLICATION_JSON_VALUE, "application/v1+json" })
@Operation(summary = "Get Profile of current user")
@ApiResponses(value = {
@ApiResponse(
Expand All @@ -52,7 +52,7 @@ public interface UserAPI {
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Settings updated successfully")
})
@PutMapping(value = "/settings", consumes = APPLICATION_JSON_VALUE)
@PutMapping(value = "/settings", consumes = { APPLICATION_JSON_VALUE, "application/v1+json" })
void setSettings(@RequestBody UserSettings userSettings);

}