blob: f4e10025ac1573e6b6370c9d4868e645ce35ba44 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
# API
The api is available on `/api`.
GET `/`
Gets information about the server
- Return type: JSON
- Returns: <information>
GET `/ping`
Pings the server
- Return type: JSON
- Returns: pong
POST `/create_user/`
Creates a new user with name
- Data type: JSON
- Data: `String` of wanted username
- Return type: JSON
- Returns: `UID` of user
DELETE `/delete_user`
Deletes a user
- Data type: JSON
- Data: `UID`
- Return type: JSON
- Returns: `Result`
POST `set_user_data`
Sets data in the user fields
- Data type: JSON
- Data: `{user: UID, field: ReceiveDataField, data: String}`
- Return type: JSON
- Returns: `Result`
GET `/get_user/<id>`
Gets a user from id
- Return type: JSON
- Returns: <user>
GET `/get_user_by_name`
Gets a user from name
- Data type: JSON
- Data: `String`
- Return type: JSON
- Returns: <user>
GET `/get_message/<id>`
Gets a message by id
- Return type: JSON
- Returns: <message>
GET `/get_message_id_newest`
Gets the newest message id
- Return type: JSON
- Returns: <message_id>
GET `/get_message_id_list/<from_id>/<to_id>`
Gets a list of message ids from_id to to_id inclusive (limit 25)
- Return type: JSON
- Returns: <Array<message_id>>
GET `/get_message_list/<from_id>/<to_id>`
Gets a list of messages from_id to to_id inclusive (limit 25)
- Return type: JSON
- Returns: <Array<Message>>
POST `/send_message`
Sends a message
- Data type: JSON
- Data: ReceiveMessage
- Return type: JSON
- Returns: `UID` of message
DELETE `/delete_message`
Deletes a message
- Data type: JSON
- Data: `UID`
- Return type: JSON
- Returns: `Result`
# Types
- ReceiveDataField
- DisplayName
- StatusText
- Desc
- ReceiveMessage
- message: String
- sender: UID
- reply_to: Option<UID>
- UID
- u64
- Date
- u64 (date since epoch in UTC)
- Status
- Online
- Offline
- Away
- Busy
- User
- id: UID
- username: String (Max 20 chars)
- displayname: String (Max 30 chars)
- desc: String (Max 500 chars)
- statustext: String (Max 60 chars)
- status: Status
- deleted: bool
- Message
- id: UID
- message: String (Max 6000 chars)
- reply_to: UID (of another message)
- deleted: bool
- date: Date
- sender: UID (of a User)
|