aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorMax Kusatz <max@trialserver.de>2020-08-22 14:08:46 +0200
committerMax Kusatz <max@trialserver.de>2020-08-22 14:08:46 +0200
commit598218e9e1d6e97b7793b0cff2c0d50cab879fa4 (patch)
treeb0c80ca9c038195f4f473a34cb99d0c01479676a /README.md
parent537a243882f49cd95b304ecf283de950440fd66a (diff)
downloadn_core-598218e9e1d6e97b7793b0cff2c0d50cab879fa4.tar.gz
n_core-598218e9e1d6e97b7793b0cff2c0d50cab879fa4.zip
Mensa working sort of with JSON
Diffstat (limited to 'README.md')
-rw-r--r--README.md61
1 files changed, 60 insertions, 1 deletions
diff --git a/README.md b/README.md
index cf03635..6f416ec 100644
--- a/README.md
+++ b/README.md
@@ -5,4 +5,63 @@ Hier kommt noch Kram
Benötigte Libraries:
Mongoose https://github.com/Gregwar/mongoose-cpp
-Der Server läuft lokal auf Port 8080 \ No newline at end of file
+Der Server läuft lokal auf Port 8080
+
+
+Niklas Halle
+## N protocol
+### request
+Each message sent to the N core server must be valid JSON and have a `command` field. It contains the command for N to handle, sanitizied (i.e. no leading '/' or trailing username etc).
+The arguments field contains the remaining text just as was send to the bridge.
+All messages may optionally include an `session` field. When you authorize against N core or switch to a menu, you will be returned (see next section) a session id which you can then send with this field to follow up on the inital command.
+
+| Field | Type | Required? | Description |
+|-------|------|-----------|-------------|
+| `command` | string | yes | The command N core should handle |
+| `arguments` | string | no | The arguments to the command (i.e. all remaining text in the message |
+| `session` | string | no | The session id, defaults to `null` |
+
+### answer
+The answer consists of an array of `reply` objects, an `success`-flag and a `session`-id provided by N core.
+The reply objects enable N core to request certain formatting from the bridges, which they should try to implement as close as the underlying platform supports it. In any case, the plain text stringed together from all replies `text` field should be enough to get the message to the user, annotations should be fully optional.
+The session id can be ignored by bridges, but this will opt the bridge out of more complex (context specific) commands.
+JSON object overview:
+
+| Field | Type | Required? | Description |
+|-------|------|-----------|-------------|
+| `reply` | array of `reply`-objects | yes | The reply from N core |
+| `success` | bool | yes | Whether the command was successful |
+| `session` | string | yes | A session id, defaults to `null` |
+
+#### `reply`
+The `reply` object:
+
+| Field | Type | Required? | Description |
+|-------|------|-----------|-------------|
+| `text` | string | yes | A part of the answer |
+| `annotations` | yes | array of `annotation`-objects | The annotations to this answer part |
+
+#### `annotation`
+The `annotation` object:
+
+| Field | Type | Required? | Description |
+|-------|------|-----------|-------------|
+| `type` | string | yes | A part of the answer |
+| `extra` | string | no | Extra content specific to the annotation type |
+
+The currently specified annotation types are enumerated below:
+
+##### `bold`
+The text should be printed as bold. No extra content.
+
+##### `italic`
+The text should be printed as italic. No extra content.
+
+##### `strikethrough`
+The text should be printed as strikethrough. No extra content.
+
+##### `underline`
+The text should be printed as underline. No extra content.
+
+##### `link`
+The text should be formatted as a link. Extra content: the uri to link. \ No newline at end of file