Skip to content

Commit 7ea60ad

Browse files
Update API.md
1 parent a3968ac commit 7ea60ad

File tree

1 file changed

+56
-13
lines changed

1 file changed

+56
-13
lines changed

API.md

Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# API Documentation
22
## User Management
3+
34
```POST /api/signup```
45

56
Register a new user account.
@@ -8,7 +9,7 @@ Register a new user account.
89

910
username: Username string
1011
password: Password string
11-
other user info fields
12+
1213
- Response:
1314

1415
201: User created successfully
@@ -22,11 +23,26 @@ Login with username and password.
2223

2324
username: Username string
2425
password: Password string
26+
2527
- Response:
2628

2729
200: Login succeeded
2830
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
3046

3147
```POST /api/chat```
3248

@@ -35,61 +51,88 @@ Send a chat message.
3551
- Request Body:
3652

3753
content: Chat message content
38-
userId: Sender user ID
39-
roomId: Chat room ID
54+
receiver: receiver username string
55+
4056
- Response:
4157

4258
200: Message sent
4359
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+
4674
Manage friend requests.
4775

4876
- Request Body:
4977

50-
action: add to send request, accept to accept request
51-
userId: Recipient user ID
78+
info: add string
79+
username: Recipient username
80+
5281
- Response:
5382

5483
200: Request success
5584
404: User not found
56-
GET /api/newfriends
85+
86+
```GET /api/newfriends```
87+
5788
Get list of pending friend requests.
5889

5990
- Response:
91+
6092
200: Array of friend request objects
6193
401: Unauthorized
94+
6295
User Info
63-
GET /api/info
96+
97+
```GET /api/info```
98+
6499
Get user profile information.
65100

66101
- Request Header:
67102

68103
Authorization: JWT token
104+
69105
- Response:
70106

71107
200: User info object
72108
401: Invalid token
109+
73110
File Management
74-
POST /api/file/save
111+
112+
```POST /api/file/save```
113+
75114
Save a file.
76115

77116
- Request Body:
78117

79118
file: File data
80119
path: File path
81120
filename: Filename
121+
82122
- Response:
83123

84124
201: File saved
85125
500: Error saving file
86-
GET /api/file/get
126+
127+
```GET /api/file/get```
128+
87129
Get a file.
88130

89131
- Request Parameter:
90132

91133
filePath: Path of file on server
134+
92135
Response:
93136

94137
200: File data
95-
404: File not found
138+
404: File not found

0 commit comments

Comments
 (0)