File tree Expand file tree Collapse file tree 1 file changed +56
-13
lines changed Expand file tree Collapse file tree 1 file changed +56
-13
lines changed Original file line number Diff line number Diff line change 1
1
# API Documentation
2
2
## User Management
3
+
3
4
``` POST /api/signup ```
4
5
5
6
Register a new user account.
@@ -8,7 +9,7 @@ Register a new user account.
8
9
9
10
username: Username string
10
11
password: Password string
11
- other user info fields
12
+
12
13
- Response:
13
14
14
15
201: User created successfully
@@ -22,11 +23,26 @@ Login with username and password.
22
23
23
24
username: Username string
24
25
password: Password string
26
+
25
27
- Response:
26
28
27
29
200: Login succeeded
28
30
401: Invalid credentials
29
- Chat
31
+
32
+ ``` POST /api/avatar ```
33
+
34
+ Set user avatar.
35
+
36
+ - Request Body:
37
+
38
+ avatar: Avatar ID int
39
+
40
+ - Response:
41
+
42
+ 200: Login succeeded
43
+ 401: Invalid credentials
44
+
45
+ ## Chat
30
46
31
47
``` POST /api/chat ```
32
48
@@ -35,61 +51,88 @@ Send a chat message.
35
51
- Request Body:
36
52
37
53
content: Chat message content
38
- userId: Sender user ID
39
- roomId: Chat room ID
54
+ receiver: receiver username string
55
+
40
56
- Response:
41
57
42
58
200: Message sent
43
59
404: User or chat room not found
44
- Friend Management
45
- POST /api/nfmgr
60
+
61
+ ``` POST /api/check ```
62
+
63
+ Send a chat message.
64
+
65
+ - Response:
66
+
67
+ 200: Message sent
68
+ 404: User or chat room not found
69
+
70
+ ## Friend Management
71
+
72
+ ``` POST /api/nfmgr ```
73
+
46
74
Manage friend requests.
47
75
48
76
- Request Body:
49
77
50
- action: add to send request, accept to accept request
51
- userId: Recipient user ID
78
+ info: add string
79
+ username: Recipient username
80
+
52
81
- Response:
53
82
54
83
200: Request success
55
84
404: User not found
56
- GET /api/newfriends
85
+
86
+ ``` GET /api/newfriends ```
87
+
57
88
Get list of pending friend requests.
58
89
59
90
- Response:
91
+
60
92
200: Array of friend request objects
61
93
401: Unauthorized
94
+
62
95
User Info
63
- GET /api/info
96
+
97
+ ``` GET /api/info ```
98
+
64
99
Get user profile information.
65
100
66
101
- Request Header:
67
102
68
103
Authorization: JWT token
104
+
69
105
- Response:
70
106
71
107
200: User info object
72
108
401: Invalid token
109
+
73
110
File Management
74
- POST /api/file/save
111
+
112
+ ``` POST /api/file/save ```
113
+
75
114
Save a file.
76
115
77
116
- Request Body:
78
117
79
118
file: File data
80
119
path: File path
81
120
filename: Filename
121
+
82
122
- Response:
83
123
84
124
201: File saved
85
125
500: Error saving file
86
- GET /api/file/get
126
+
127
+ ``` GET /api/file/get ```
128
+
87
129
Get a file.
88
130
89
131
- Request Parameter:
90
132
91
133
filePath: Path of file on server
134
+
92
135
Response:
93
136
94
137
200: File data
95
- 404: File not found
138
+ 404: File not found
You can’t perform that action at this time.
0 commit comments