Reformatting of wiki:
* Adding endpoint docs and correcting some typesetting mistakes * Change qs params to match documentation * Splitting up articles to geneate the sidebar links properly' * Bad baseurl issue fixed in previous patch
This commit is contained in:
6
docs/content/endpoints/_index.md
Normal file
6
docs/content/endpoints/_index.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: JSON API Endpoints
|
||||
anchor: endpoints
|
||||
weight: 10
|
||||
---
|
||||
|
||||
27
docs/content/endpoints/auth.md
Normal file
27
docs/content/endpoints/auth.md
Normal file
@@ -0,0 +1,27 @@
|
||||
---
|
||||
title: Authorization
|
||||
anchor: auth-ep
|
||||
weight: 11
|
||||
---
|
||||
|
||||
To make things easy: user `id`, `secret`, and `jwt` values are to be put in the query string. Headers are largely ignored as they offer no guarantees in security. The biggest reason for this however is for simplicity of implementation for servers.
|
||||
|
||||
### `POST /login`
|
||||
|
||||
This route can be used to
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* secret: String
|
||||
|
||||
* Returns:
|
||||
|
||||
* jwt: String
|
||||
|
||||
|
||||
Example
|
||||
```
|
||||
> POST /login?id=123&secret=super-secret-token
|
||||
|
||||
< {"jwt": "asdf.asdf.asdf"}
|
||||
```
|
||||
94
docs/content/endpoints/channels.md
Normal file
94
docs/content/endpoints/channels.md
Normal file
@@ -0,0 +1,94 @@
|
||||
---
|
||||
title: Channels
|
||||
anchor: channels-ep
|
||||
weight: 13
|
||||
---
|
||||
|
||||
### `GET /channels/list`
|
||||
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* jwt: String
|
||||
|
||||
* Required Permissions
|
||||
|
||||
* None
|
||||
|
||||
* Returns:
|
||||
|
||||
* channels: Array\<Channel\>
|
||||
|
||||
Example
|
||||
```
|
||||
> GET /channels/list?id=123&jwt=...
|
||||
|
||||
< {
|
||||
< "channels": [
|
||||
< {
|
||||
< "id": 1
|
||||
< "name": "general",,
|
||||
< "kind": 2,
|
||||
< "description": "this could be null"
|
||||
< },
|
||||
< ...
|
||||
< ]
|
||||
< }
|
||||
```
|
||||
|
||||
### `POST /channels/create`
|
||||
|
||||
* Required Permissions:
|
||||
|
||||
* CREATE_CHANNEL
|
||||
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* jwt: String
|
||||
|
||||
* name: String
|
||||
* kind: u32
|
||||
|
||||
* Voice channel = 1
|
||||
* Text channel = 2
|
||||
|
||||
* description: String
|
||||
* Optional field
|
||||
|
||||
* Returns
|
||||
|
||||
* Channel
|
||||
* id: u64
|
||||
* name: String
|
||||
* description: String | null
|
||||
* kind: i32
|
||||
|
||||
```
|
||||
> POST /channels/create?id=123&jwt=...
|
||||
|
||||
< {
|
||||
< "id": 3,
|
||||
< "name": "new-channel",
|
||||
< "description": null,
|
||||
< "kind": 2
|
||||
< }
|
||||
```
|
||||
|
||||
### `DELETE /channels/delete`
|
||||
|
||||
* Required permissions:
|
||||
|
||||
* DELETE_CHANNEL
|
||||
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* jwt: String
|
||||
* channel_id: u64
|
||||
|
||||
* Returns:
|
||||
|
||||
* None
|
||||
|
||||
|
||||
78
docs/content/endpoints/invites.md
Normal file
78
docs/content/endpoints/invites.md
Normal file
@@ -0,0 +1,78 @@
|
||||
---
|
||||
title: Invites
|
||||
anchor: invites-ep
|
||||
weight: 15
|
||||
---
|
||||
|
||||
### `POST /invite/create`
|
||||
|
||||
* Required permissions:
|
||||
* CREATE_TMP_INVITES
|
||||
* Base requirement
|
||||
* CREATE_PERM_INVITES
|
||||
* Additional requirement for permanent invite codes
|
||||
|
||||
* Required query string parameters:
|
||||
* id: u64
|
||||
* jwt: string
|
||||
|
||||
* Returns
|
||||
* id: i64
|
||||
* uses: Optional<i64>
|
||||
This field is really meant for servers and really doesn't have much use to users. It just to keep track of whether or not an invite has been used too many times or not.
|
||||
|
||||
* expires: boolean
|
||||
|
||||
|
||||
Example
|
||||
```
|
||||
> POST /invite/create?id=123&jwt=
|
||||
|
||||
< {
|
||||
< "id": <unix-timestamp>,
|
||||
< "uses": 3,
|
||||
< "expires": true
|
||||
< }
|
||||
```
|
||||
|
||||
### `GET /join`
|
||||
|
||||
* Required Permissions
|
||||
* None
|
||||
|
||||
* Required query string parameters:
|
||||
* code: i64
|
||||
|
||||
* Returns a new member account - The account details are not behind a key in the JSON object, so the resulting data is completely flat, for JSON.
|
||||
* id: u64
|
||||
* secret: String
|
||||
* name: String
|
||||
* joindate: i64
|
||||
* status: i32
|
||||
* permissions: u64
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
* Default values
|
||||
* status: 0
|
||||
* permissions: 51
|
||||
* name: Anonymous
|
||||
* joindate: Current Unix time since epoch
|
||||
|
||||
|
||||
Example
|
||||
```
|
||||
> GET /join?code=123456
|
||||
|
||||
< {
|
||||
< "id": 123,
|
||||
< "secret": "super secret",
|
||||
< "name": "Anonymous",
|
||||
< "joindate": 134256,
|
||||
< "status": 0,
|
||||
< "permissions": 51
|
||||
< }
|
||||
```
|
||||
|
||||
147
docs/content/endpoints/members.md
Normal file
147
docs/content/endpoints/members.md
Normal file
@@ -0,0 +1,147 @@
|
||||
---
|
||||
title: Members
|
||||
anchor: members-ep
|
||||
weight: 14
|
||||
---
|
||||
|
||||
### `POST /members/me/nickname`
|
||||
|
||||
* Required permissions:
|
||||
|
||||
* CHANGE_NICK
|
||||
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* jwt: String
|
||||
* name: String
|
||||
* New nickname to change to(if allowed)
|
||||
|
||||
* Returns
|
||||
* None
|
||||
|
||||
### `GET /members/me`
|
||||
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* jwt: String
|
||||
|
||||
* Returns:
|
||||
|
||||
* Member
|
||||
* Contains all public data about your account on the server
|
||||
|
||||
Example
|
||||
```
|
||||
> GET /members/me?id=123&jwt=...
|
||||
|
||||
< {
|
||||
< "name": "nickname-here",
|
||||
< "id": 123,
|
||||
< "joindate": <unix-timestamp>,
|
||||
< "permissions": <64-bit-mask>
|
||||
< }
|
||||
```
|
||||
|
||||
### `GET /members/online`
|
||||
|
||||
* Required query string parameters:
|
||||
|
||||
* id: u64
|
||||
* jwt: String
|
||||
* limit: Optional<u64>
|
||||
* Internal default: 100
|
||||
|
||||
* Returns
|
||||
* members: Array<Members>
|
||||
* Each member contains: [`name`, `id`, `joindate`, `permissions`]
|
||||
|
||||
* count: u64
|
||||
|
||||
|
||||
Example
|
||||
```
|
||||
> GET /members/online?id=123&jwt=...
|
||||
|
||||
< { "members": [...] }
|
||||
```
|
||||
|
||||
## Messages
|
||||
|
||||
### `POST /message/send`
|
||||
|
||||
* Required permissions:
|
||||
* SEND_MESSAGES
|
||||
|
||||
* Required query string parameters:
|
||||
* id: u64
|
||||
* jwt: String
|
||||
|
||||
* channel_id: u64
|
||||
* type: String
|
||||
|
||||
Valid values:
|
||||
|
||||
* text
|
||||
* jpeg
|
||||
* png
|
||||
* webm
|
||||
* mp4
|
||||
|
||||
* Required body:
|
||||
* Content itself should always go in the body
|
||||
* Empty bodies result in an HTTP 400 response
|
||||
|
||||
* Returns:
|
||||
* None
|
||||
|
||||
### `GET /message/get_range`
|
||||
|
||||
* Required query string parameters:
|
||||
* id: u64
|
||||
* jwt: string
|
||||
|
||||
* channel_id: u64
|
||||
* start_time: i64
|
||||
* Unix timestamp (seconds)
|
||||
* end_time: i64
|
||||
* Unix timestamp (seconds)
|
||||
|
||||
* limit: Optional<u64>
|
||||
* Maximum = 1000
|
||||
|
||||
* Returns
|
||||
* messages: Array<Message>
|
||||
|
||||
|
||||
Example
|
||||
```
|
||||
> GET /message/get_range?id=123&jwt=...
|
||||
|
||||
< { "mesages": [...] }
|
||||
```
|
||||
|
||||
|
||||
### `GET /message/from_id`
|
||||
|
||||
* Required query string parameters:
|
||||
* id: u64
|
||||
* jwt: string
|
||||
|
||||
* channel_id: u64
|
||||
* start: u64
|
||||
* limit: Optional<u64>
|
||||
* Maximum = 1000
|
||||
|
||||
* Returns
|
||||
* messages: Array<Message>
|
||||
|
||||
Example
|
||||
```
|
||||
> GET /message/from_id?id=123&jwt=...
|
||||
|
||||
< { "mesages": [...] }
|
||||
```
|
||||
|
||||
|
||||
32
docs/content/endpoints/perms.md
Normal file
32
docs/content/endpoints/perms.md
Normal file
@@ -0,0 +1,32 @@
|
||||
---
|
||||
title: Permissions
|
||||
anchor: permissions
|
||||
weight: 12
|
||||
---
|
||||
|
||||
Due to the nature of many endpoints, some endpoints require a user to have certain permissions setup.
|
||||
|
||||
User permissions are stored as an `unsigned 64-bit` bit mask alongside other user data. So far the current implemented permissions are listed below as follows.
|
||||
|
||||
NOTE: due to the rapid changing of features this list is subject to change until
|
||||
the protocol reaches `1.0` status.
|
||||
|
||||
| Name | Value | Short Description
|
||||
:------|:-------------:|:----
|
||||
JOIN_VOICE| 0x01 | Ability to join a voice channel via
|
||||
SEND_MESSAGES| 0x02 | Ability to send text messages in any text channel
|
||||
CREATE_TMP_INVITES| 0x04 | Creation of invite codes which expire
|
||||
CREATE_PERM_INVITES| 0x08 | Create of invite codes which do not expire
|
||||
CHANGE_NICK | 0x10 | Can change nickname
|
||||
ALLOW_PFP|0x20 | Allowed to upload their own profile picture to the server
|
||||
CREATE_CHANNEL| 0x40 | Can create channels
|
||||
DELETE_CHANNEL| 0x80 | Can delete channels
|
||||
ADMIN| 0x4000000000000000 | Can modify any permission beneath them, but not other admins
|
||||
OWNER| 0x8000000000000000 | Can modify anything
|
||||
|
||||
Typically Admins and Owners will have every role beneath them alongside their own
|
||||
admin/owner flag for the sake of implementation simplicity although this is of
|
||||
no importance to those wanting to write their own client software.
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user