From 1e0fb0a8fab5c9f2f8a58c2637830522863ef04f Mon Sep 17 00:00:00 2001 From: Jokler Date: Sun, 9 Feb 2020 22:19:38 +0100 Subject: Webserver: Add API documentation and basic css --- templates/docs/api.htm | 126 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 templates/docs/api.htm (limited to 'templates/docs') diff --git a/templates/docs/api.htm b/templates/docs/api.htm new file mode 100644 index 0000000..a973272 --- /dev/null +++ b/templates/docs/api.htm @@ -0,0 +1,126 @@ +{% extends "base.htm" %} + +{% block title %}API Documentation{% endblock %} + +{% block content %} +

API Documentation

+ + +

Bot list

+

Show a list of all bots.

+ +

URL: /api/bots

+

Method: GET

+

Auth required: NO

+ +

Success Response

+ +

Code: 200 OK

+ +

Content example

+ + +
+[
+  {
+    "name": "MusicBot",
+    "state": "Playing",
+    "volume": 0.5,
+    "position": {
+      "secs": 10,
+      "nanos": 63573687
+    },
+    "currently_playing": {
+      "url": "<temp_url>",
+      "webpage_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
+      "title": "Rick Astley - Never Gonna Give You Up (Video)",
+      "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
+      "duration": {
+        "secs": 212,
+        "nanos": 0
+      }
+    },
+    "playlist": [
+      {
+        "url": "<temp_url>",
+        "webpage_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
+        "title": "Rick Astley - Never Gonna Give You Up (Video)",
+        "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
+        "duration": {
+          "secs": 212,
+          "nanos": 0
+        }
+      }
+    ]
+  }
+]
+
+ + +

Show Bot

+

Show a specific bot.

+ +

URL: /api/bots/:botname

+

Method: GET

+

Auth required: NO

+ +

Success Response

+

Code: 200 OK

+ +

Content example

+ + +
+{
+  "name": "MusicBot",
+  "state": "Playing",
+  "volume": 0.5,
+  "position": {
+    "secs": 142,
+    "nanos": 690911766
+  },
+  "currently_playing": {
+    "url": "<temp_url>",
+    "webpage_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
+    "title": "Rick Astley - Never Gonna Give You Up (Video)",
+    "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
+    "duration": {
+      "secs": 212,
+      "nanos": 0
+    }
+  },
+  "playlist": [
+    {
+      "url": "<temp_url>",
+      "webpage_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
+      "title": "Rick Astley - Never Gonna Give You Up (Video)",
+      "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
+      "duration": {
+        "secs": 212,
+        "nanos": 0
+      }
+    }
+  ]
+}
+
+ +

Error Response

+ +

Condition: If ':botname' is not connected to TeamSpeak.

+ +

Code: 404 NOT FOUND

+ +Content: + + +
+{
+  "error": "Not Found",
+  "description": "The requested resource was not found"
+}
+
+ +{% endblock %} -- cgit v1.2.3-70-g09d2