Enable JSON output.
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Manuel Friedli 2023-04-14 01:36:32 +02:00
parent 4140d3531a
commit 914030841f
2 changed files with 14 additions and 1 deletions

View file

@ -2,6 +2,7 @@ package ch.fritteli.labyrinth.server;
import ch.fritteli.labyrinth.generator.model.Labyrinth;
import ch.fritteli.labyrinth.generator.renderer.html.HTMLRenderer;
import ch.fritteli.labyrinth.generator.renderer.json.JsonRenderer;
import ch.fritteli.labyrinth.generator.renderer.pdf.PDFRenderer;
import ch.fritteli.labyrinth.generator.renderer.text.TextRenderer;
import ch.fritteli.labyrinth.generator.serialization.SerializerDeserializer;
@ -28,6 +29,18 @@ public enum OutputType {
false,
"h",
"html"),
JSON("application/json",
"json",
labyrinth -> JsonRenderer.newInstance().render(labyrinth).getBytes(StandardCharsets.UTF_8),
false,
"j",
"json"),
JSONFILE("application/json",
"json",
labyrinth -> JsonRenderer.newInstance().render(labyrinth).getBytes(StandardCharsets.UTF_8),
true,
"s",
"jsonfile"),
PDF("application/pdf",
"pdf",
labyrinth -> PDFRenderer.newInstance().render(labyrinth).toByteArray(),