summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2017-12-16 20:38:49 +0000
committerdakkar <dakkar@thenautilus.net>2017-12-16 20:38:49 +0000
commitdb883a7201d57025a577f5973c8ab936c51fed21 (patch)
tree2051f205b10e65e0d970108dcdb1b478814ded59
parentrough server w/ serialisation (diff)
downloadUltramarine-db883a7201d57025a577f5973c8ab936c51fed21.tar.gz
Ultramarine-db883a7201d57025a577f5973c8ab936c51fed21.tar.bz2
Ultramarine-db883a7201d57025a577f5973c8ab936c51fed21.zip
also JSON serialiser
Subsonic's JSON response structure is just different enough from what XML::Writer wants, that making them both work is going to be *hard*
-rw-r--r--lib/Ultramarine/Serialiser/JSON.pm616
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Ultramarine/Serialiser/JSON.pm6 b/lib/Ultramarine/Serialiser/JSON.pm6
new file mode 100644
index 0000000..3928dc8
--- /dev/null
+++ b/lib/Ultramarine/Serialiser/JSON.pm6
@@ -0,0 +1,16 @@
+use v6.d.PREVIEW;
+use Cro::HTTP::BodySerializer;
+use XML::Writer;
+
+class Ultramarine::Serialiser::JSON
+ is Cro::HTTP::BodySerializer::JSON {
+
+ method serialize(Cro::HTTP::Message $message, $body --> Supply) {
+ nextwith $message, {
+ subsonic-response => {
+ :version<1.13.0>,
+ |$body,
+ },
+ };
+ }
+}