From ae2478bb546b3151a26563245d117d8b14f13bcc Mon Sep 17 00:00:00 2001 From: badaix Date: Sat, 28 May 2016 12:25:49 +0200 Subject: [PATCH] added some json schemas --- doc/json_rpc_api/client.json | 28 ++++++ doc/json_rpc_api/client.schema.json | 112 +++++++++++++++++++++ doc/json_rpc_api/server.json | 15 +++ doc/json_rpc_api/server.schema.json | 60 +++++++++++ doc/json_rpc_api/server_status.json | 99 ++++++++++++++++++ doc/json_rpc_api/server_status.schema.json | 42 ++++++++ doc/json_rpc_api/stream.json | 18 ++++ doc/json_rpc_api/stream.schema.json | 72 +++++++++++++ 8 files changed, 446 insertions(+) create mode 100644 doc/json_rpc_api/client.json create mode 100644 doc/json_rpc_api/client.schema.json create mode 100644 doc/json_rpc_api/server.json create mode 100644 doc/json_rpc_api/server.schema.json create mode 100644 doc/json_rpc_api/server_status.json create mode 100644 doc/json_rpc_api/server_status.schema.json create mode 100644 doc/json_rpc_api/stream.json create mode 100644 doc/json_rpc_api/stream.schema.json diff --git a/doc/json_rpc_api/client.json b/doc/json_rpc_api/client.json new file mode 100644 index 00000000..a2737dc9 --- /dev/null +++ b/doc/json_rpc_api/client.json @@ -0,0 +1,28 @@ +{ + "config": { + "latency": 0, + "name": "Schlafzimmer", + "stream": "pipe:///tmp/snapfifo", + "volume": { + "muted": false, + "percent": 100 + } + }, + "connected": false, + "host": { + "arch": "armv6l", + "ip": "192.168.0.24", + "mac": "80:1f:02:ed:fd:e0", + "name": "wohnzimmer", + "os": "Raspbian GNU/Linux 8.0 (jessie)" + }, + "lastSeen": { + "sec": 1464339375, + "usec": 480894 + }, + "snapclient": { + "name": "Snapclient", + "protocolVersion": 2, + "version": "0.7.0" + } +} diff --git a/doc/json_rpc_api/client.schema.json b/doc/json_rpc_api/client.schema.json new file mode 100644 index 00000000..989f6e29 --- /dev/null +++ b/doc/json_rpc_api/client.schema.json @@ -0,0 +1,112 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "config": { + "type": "object", + "properties": { + "latency": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "stream": { + "type": "string" + }, + "volume": { + "type": "object", + "properties": { + "muted": { + "type": "boolean" + }, + "percent": { + "type": "integer" + } + }, + "required": [ + "muted", + "percent" + ] + } + }, + "required": [ + "latency", + "name", + "stream", + "volume" + ] + }, + "connected": { + "type": "boolean" + }, + "host": { + "type": "object", + "properties": { + "arch": { + "type": "string" + }, + "ip": { + "type": "string" + }, + "mac": { + "type": "string" + }, + "name": { + "type": "string" + }, + "os": { + "type": "string" + } + }, + "required": [ + "arch", + "ip", + "mac", + "name", + "os" + ] + }, + "lastSeen": { + "type": "object", + "properties": { + "sec": { + "type": "integer" + }, + "usec": { + "type": "integer" + } + }, + "required": [ + "sec", + "usec" + ] + }, + "snapclient": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "protocolVersion": { + "type": "integer" + }, + "version": { + "type": "string" + } + }, + "required": [ + "name", + "protocolVersion", + "version" + ] + } + }, + "required": [ + "config", + "connected", + "host", + "lastSeen", + "snapclient" + ] +} diff --git a/doc/json_rpc_api/server.json b/doc/json_rpc_api/server.json new file mode 100644 index 00000000..511b9931 --- /dev/null +++ b/doc/json_rpc_api/server.json @@ -0,0 +1,15 @@ +{ + "host": { + "arch": "x86_64", + "ip": "", + "mac": "", + "name": "elaine", + "os": "Linux Mint 17.3 Rosa" + }, + "snapserver": { + "controlProtocolVersion": 1, + "name": "Snapserver", + "protocolVersion": 1, + "version": "0.7.0" + } +} diff --git a/doc/json_rpc_api/server.schema.json b/doc/json_rpc_api/server.schema.json new file mode 100644 index 00000000..cfb638fc --- /dev/null +++ b/doc/json_rpc_api/server.schema.json @@ -0,0 +1,60 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "host": { + "type": "object", + "properties": { + "arch": { + "type": "string" + }, + "ip": { + "type": "string" + }, + "mac": { + "type": "string" + }, + "name": { + "type": "string" + }, + "os": { + "type": "string" + } + }, + "required": [ + "arch", + "ip", + "mac", + "name", + "os" + ] + }, + "snapserver": { + "type": "object", + "properties": { + "controlProtocolVersion": { + "type": "integer" + }, + "name": { + "type": "string" + }, + "protocolVersion": { + "type": "integer" + }, + "version": { + "type": "string" + } + }, + "required": [ + "controlProtocolVersion", + "name", + "protocolVersion", + "version" + ] + } + }, + "required": [ + "host", + "snapserver" + ] +} diff --git a/doc/json_rpc_api/server_status.json b/doc/json_rpc_api/server_status.json new file mode 100644 index 00000000..0640eecd --- /dev/null +++ b/doc/json_rpc_api/server_status.json @@ -0,0 +1,99 @@ +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "clients": [ + { + "config": { + "latency": 0, + "name": "Schlafzimmer", + "stream": "pipe:///tmp/snapfifo", + "volume": { + "muted": false, + "percent": 100 + } + }, + "connected": false, + "host": { + "arch": "armv6l", + "ip": "192.168.0.24", + "mac": "80:1f:02:ed:fd:e0", + "name": "wohnzimmer", + "os": "Raspbian GNU/Linux 8.0 (jessie)" + }, + "lastSeen": { + "sec": 1464339375, + "usec": 480894 + }, + "snapclient": { + "name": "Snapclient", + "protocolVersion": 2, + "version": "0.7.0" + } + }, + { + "config": { + "latency": 0, + "name": "Küche", + "stream": "pipe:///tmp/snapfifo", + "volume": { + "muted": false, + "percent": 100 + } + }, + "connected": true, + "host": { + "arch": "armv6l", + "ip": "192.168.0.31", + "mac": "80:1f:02:ff:79:6e", + "name": "kueche", + "os": "Raspbian GNU/Linux 8 (jessie)" + }, + "lastSeen": { + "sec": 1464358728, + "usec": 910393 + }, + "snapclient": { + "name": "Snapclient", + "protocolVersion": 2, + "version": "0.7.0" + } + } + ], + "server": { + "host": { + "arch": "x86_64", + "ip": "", + "mac": "", + "name": "elaine", + "os": "Linux Mint 17.3 Rosa" + }, + "snapserver": { + "controlProtocolVersion": 1, + "name": "Snapserver", + "protocolVersion": 1, + "version": "0.7.0" + } + }, + "streams": [ + { + "id": "pipe:///tmp/snapfifo", + "status": "playing", + "uri": { + "fragment": "", + "host": "", + "path": "/tmp/snapfifo", + "query": { + "buffer_ms": "20", + "codec": "flac", + "mode": "", + "name": "Radio", + "sampleformat": "48000:16:2" + }, + "raw": "pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2", + "scheme": "pipe" + } + } + ] + } +} diff --git a/doc/json_rpc_api/server_status.schema.json b/doc/json_rpc_api/server_status.schema.json new file mode 100644 index 00000000..764f73ce --- /dev/null +++ b/doc/json_rpc_api/server_status.schema.json @@ -0,0 +1,42 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "jsonrpc": { + "type": "string" + }, + "result": { + "type": "object", + "properties": { + "clients": { + "type": "array", + "items": { + "$ref": "https://raw.githubusercontent.com/badaix/snapcast/master/doc/json_rpc_api/client.schema.json" + } + }, + "server": { + "$ref": "https://raw.githubusercontent.com/badaix/snapcast/master/doc/json_rpc_api/server.schema.json" + }, + "streams": { + "type": "array", + "items": { + "$ref": "https://raw.githubusercontent.com/badaix/snapcast/master/doc/json_rpc_api/stream.schema.json" + } + } + }, + "required": [ + "clients", + "server", + "streams" + ] + } + }, + "required": [ + "id", + "jsonrpc", + "result" + ] +} diff --git a/doc/json_rpc_api/stream.json b/doc/json_rpc_api/stream.json new file mode 100644 index 00000000..60b1086f --- /dev/null +++ b/doc/json_rpc_api/stream.json @@ -0,0 +1,18 @@ +{ + "id": "pipe:///tmp/snapfifo", + "status": "playing", + "uri": { + "fragment": "", + "host": "", + "path": "/tmp/snapfifo", + "query": { + "buffer_ms": "20", + "codec": "flac", + "mode": "", + "name": "Radio", + "sampleformat": "48000:16:2" + }, + "raw": "pipe:///tmp/snapfifo?name=Radio&sampleformat=48000:16:2", + "scheme": "pipe" + } +} diff --git a/doc/json_rpc_api/stream.schema.json b/doc/json_rpc_api/stream.schema.json new file mode 100644 index 00000000..06d7fc54 --- /dev/null +++ b/doc/json_rpc_api/stream.schema.json @@ -0,0 +1,72 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "status": { + "type": "string" + }, + "uri": { + "type": "object", + "properties": { + "fragment": { + "type": "string" + }, + "host": { + "type": "string" + }, + "path": { + "type": "string" + }, + "query": { + "type": "object", + "properties": { + "buffer_ms": { + "type": "string" + }, + "codec": { + "type": "string" + }, + "mode": { + "type": "string" + }, + "name": { + "type": "string" + }, + "sampleformat": { + "type": "string" + } + }, + "required": [ + "buffer_ms", + "codec", + "mode", + "name", + "sampleformat" + ] + }, + "raw": { + "type": "string" + }, + "scheme": { + "type": "string" + } + }, + "required": [ + "fragment", + "host", + "path", + "query", + "raw", + "scheme" + ] + } + }, + "required": [ + "id", + "status", + "uri" + ] +}