summaryrefslogtreecommitdiff
path: root/API.md
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-12-17 23:55:44 +0800
committerKeuin <[email protected]>2021-12-17 23:55:44 +0800
commit12ddbba66e6f2585e59d05d1782c0e8ce9fe6146 (patch)
tree0d98ee95c01c8509160658080523e351357d4a9b /API.md
parent7fc64f506ea7ebc68fcb0a9e98351deed7c1d212 (diff)
Use the latest Velocity API.
Implement API server for online players and server status. Implement core message routing abstraction and concrete BungeeCross, Velocity, Telegram endpoint impl. Load config from config file "crosslink/config.json". Test core components. Proxy API related stuff are not tested. Add README in English and Chinese. TODO: Add config hot reloading. More configurable system. PSMB endpoint impl.
Diffstat (limited to 'API.md')
-rw-r--r--API.md31
1 files changed, 31 insertions, 0 deletions
diff --git a/API.md b/API.md
new file mode 100644
index 0000000..32c8ef2
--- /dev/null
+++ b/API.md
@@ -0,0 +1,31 @@
+# CrossLink API documentation
+
+API Version: `1.0.0`
+
+Compatible CrossLink version: `1.0-SNAPSHOT`
+
+## `/online_players`
+
+- Method: `GET`
+- GET Parameters:
+ - `grouped` (**int**, **optional**) If set to `1`, returns online players grouped by the servers they currently on.
+ Otherwise, returns all online players in one list.
+- Returns: A non-null JSON dictionary, containing a non-null value `players`.
+ If `grouped=1`, `players` is a non-null dictionary. Otherwise, `players` is a non-null list.
+- Example:
+ - `GET /online_players`: `{"players":[]}`
+ - `GET /online_players`: `{"players":["fakeKeuin","trueKeuin"]}`
+ - `GET /online_players?grouped=1`: `{"players":[]}`
+ - `GET /online_players?grouped=1`: `{"players":{"server2":["fakeKeuin"],"server1":["trueKeuin"]}}`
+ - `GET /online_players?grouped=1`: `{"players":{"server2":["fakeKeuin", "trueKeuin"]}}`
+
+
+## `/server_status`
+
+- Method: `GET`
+- GET Parameters: none
+- Returns: A non-null JSON dictionary, containing `ServerName`(`string`) -> `ServerStatus`(`dictionary`) mapping.
+ A `ServerStatus` object contains `status` key, which is an **string** enum `Status`.
+- Range of enum `Status`: `UP`, `DOWN`, `TIMED OUT`
+- Example:
+ - `GET /server_status`: `{"servers":{"server1":{"status":"UP"},"server2":{"status":"UP"}}}` \ No newline at end of file