mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 05:10:41 +03:00
API DOCS updated
This commit is contained in:
parent
b2081469b1
commit
56b55b042b
8 changed files with 49 additions and 80 deletions
16
README.md
16
README.md
|
@ -44,7 +44,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
||||||
| Send | 🟢 | HIGH |
|
| Send | 🟢 | HIGH |
|
||||||
| Delete | 🟢 | HIGH |
|
| Delete | 🟢 | HIGH |
|
||||||
| React | 🟢 | MEDIUM |
|
| React | 🟢 | MEDIUM |
|
||||||
| Edit | 🔴 | HIGH |
|
| Edit | 🔴 | MEDIUM |
|
||||||
|
|
||||||
### Threads
|
### Threads
|
||||||
| To do | Is done? | Priority |
|
| To do | Is done? | Priority |
|
||||||
|
@ -52,7 +52,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
||||||
| Ratelimit | 🟢 | HIGH |
|
| Ratelimit | 🟢 | HIGH |
|
||||||
| Create | 🟢 | HIGH |
|
| Create | 🟢 | HIGH |
|
||||||
| Delete | 🟢 | HIGH |
|
| Delete | 🟢 | HIGH |
|
||||||
| Edit | 🔴 | HIGH |
|
| Edit | 🔴 | MEDIUM |
|
||||||
|
|
||||||
### API
|
### API
|
||||||
| To do | Is done? | Priority |
|
| To do | Is done? | Priority |
|
||||||
|
@ -61,14 +61,8 @@ And, you can learn about API in `util/APIDOCS.md`.
|
||||||
| Send message | 🟢 | MEDIUM |
|
| Send message | 🟢 | MEDIUM |
|
||||||
| Create thread | 🟢 | MEDIUM |
|
| Create thread | 🟢 | MEDIUM |
|
||||||
| Get info about thread | 🟢 | MEDIUM |
|
| Get info about thread | 🟢 | MEDIUM |
|
||||||
<<<<<<< HEAD
|
| Delete message & thread | 🔴 | HIGH |
|
||||||
| Delete message & thread | 🔴 | MEDIUM |
|
| Edit message & thread | 🔴 | HIGH |
|
||||||
| Edit message & thread | 🔴 | MEDIUM |
|
|
||||||
|
|
||||||
=======
|
|
||||||
| Delete message | 🔴 | MEDIUM |
|
|
||||||
| React | 🟢 | MEDIUM |
|
|
||||||
>>>>>>> 9f10a32b7ce05cbb81acacb8277b68c25d4baa34
|
|
||||||
|
|
||||||
### Other
|
### Other
|
||||||
| To do | Is done? | Priority |
|
| To do | Is done? | Priority |
|
||||||
|
@ -77,7 +71,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
||||||
| Multi-theme support | 🔴 | LOW |
|
| Multi-theme support | 🔴 | LOW |
|
||||||
| Search | 🔴 | MEDIUM |
|
| Search | 🔴 | MEDIUM |
|
||||||
| Better view | 🟢 | MEDIUM |
|
| Better view | 🟢 | MEDIUM |
|
||||||
| Sending message etc. will use fetch API | 🔴 | HIGH |
|
| Sending message etc. will use fetch API | 🟡 | HIGH |
|
||||||
|
|
||||||
## Screenshot
|
## Screenshot
|
||||||
![akf-forum](https://user-images.githubusercontent.com/70021050/160255959-ef216cba-1348-4d4b-9347-fe67e21348e7.png)
|
![akf-forum](https://user-images.githubusercontent.com/70021050/160255959-ef216cba-1348-4d4b-9347-fe67e21348e7.png)
|
||||||
|
|
|
@ -14,7 +14,6 @@ print(r.json())
|
||||||
example_response = {
|
example_response = {
|
||||||
'status': 200,
|
'status': 200,
|
||||||
'result': {
|
'result': {
|
||||||
'authorID': 0,
|
|
||||||
'content': 'a',
|
'content': 'a',
|
||||||
'author': {
|
'author': {
|
||||||
'name': 'Akif9748',
|
'name': 'Akif9748',
|
||||||
|
@ -22,14 +21,14 @@ example_response = {
|
||||||
'time': 1649189944864,
|
'time': 1649189944864,
|
||||||
'admin': False,
|
'admin': False,
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'id': 0
|
'id': "0"
|
||||||
},
|
},
|
||||||
'time': 1649189950166,
|
'time': 1649189950166,
|
||||||
'threadID': 0,
|
'threadID': "0",
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'edited': False,
|
'edited': False,
|
||||||
# Reactions: {userid: isLike (Bool)}
|
# Reactions: {userid: isLike (Bool)}
|
||||||
'react': {'0': True},
|
'react': {'0': True},
|
||||||
'id': 0
|
'id': "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,12 +20,12 @@ example_response = {
|
||||||
"time": 1647895891332,
|
"time": 1647895891332,
|
||||||
"admin": False,
|
"admin": False,
|
||||||
"deleted": False,
|
"deleted": False,
|
||||||
"id": 0
|
"id": "0"
|
||||||
},
|
},
|
||||||
"title": "First Thread",
|
"title": "First Thread",
|
||||||
"messages": [0, 1, 2, 3],
|
"messages": ["0", "1", "2", "3"],
|
||||||
"time": 1647895907054,
|
"time": 1647895907054,
|
||||||
"deleted": False,
|
"deleted": False,
|
||||||
"id": 0
|
"id": "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@ example_response = {
|
||||||
'time': 1647895891332,
|
'time': 1647895891332,
|
||||||
'admin': True,
|
'admin': True,
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'id': 0
|
'id': "0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,24 +27,13 @@ example_response = {
|
||||||
'time': 1649009854217,
|
'time': 1649009854217,
|
||||||
'admin': False,
|
'admin': False,
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'id': 2
|
'id': "2"
|
||||||
},
|
},
|
||||||
'time': 1649010863471,
|
'time': 1649010863471,
|
||||||
'thread': {
|
'threadID': "1",
|
||||||
'author': {
|
|
||||||
'name': 'Akif9748',
|
|
||||||
'avatar': 'https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020',
|
|
||||||
'time': 1647895891332, 'admin': True, 'deleted': False, 'id': 0
|
|
||||||
},
|
|
||||||
'title': 'API TEST',
|
|
||||||
'messages': [4, 6],
|
|
||||||
'time': 1649010834064,
|
|
||||||
'deleted': False,
|
|
||||||
'id': 1
|
|
||||||
},
|
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'edited': False,
|
'edited': False,
|
||||||
'react': {},
|
'react': {},
|
||||||
'id': 6
|
'id': "6"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
17
tests/post_msg_react.py
Normal file
17
tests/post_msg_react.py
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
import requests
|
||||||
|
|
||||||
|
# Headers for login to Akf-forum
|
||||||
|
headers = {
|
||||||
|
"username": "testUser",
|
||||||
|
"password": "testPassword"
|
||||||
|
}
|
||||||
|
|
||||||
|
r = requests.post("http://localhost:3000/api/messages/0/react/like",
|
||||||
|
headers=headers)
|
||||||
|
|
||||||
|
print(r.json())
|
||||||
|
|
||||||
|
example_response = {
|
||||||
|
'status': 200,
|
||||||
|
'result': 1 # Number of likes
|
||||||
|
}
|
|
@ -20,31 +20,17 @@ print(r.json())
|
||||||
example_response = {
|
example_response = {
|
||||||
'status': 200,
|
'status': 200,
|
||||||
'result': {
|
'result': {
|
||||||
'content': 'This message sent via API',
|
|
||||||
'author': {
|
|
||||||
'name': 'testUser',
|
|
||||||
'avatar': '',
|
|
||||||
'time': 1649009854217,
|
|
||||||
'admin': False,
|
|
||||||
'deleted': False,
|
|
||||||
'id': 2
|
|
||||||
},
|
|
||||||
'time': 1649010863471,
|
|
||||||
'thread': {
|
|
||||||
'author': {
|
'author': {
|
||||||
'name': 'Akif9748',
|
'name': 'Akif9748',
|
||||||
'avatar': 'https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020',
|
'avatar': 'https://www.technopat.net/sosyal/data/avatars/o/298/298223.jpg?1644694020',
|
||||||
'time': 1647895891332, 'admin': True, 'deleted': False, 'id': 0
|
'time': 1647895891332, 'admin': True, 'deleted': False, 'id': "0"
|
||||||
},
|
},
|
||||||
'title': 'API TEST',
|
'title': 'API TEST',
|
||||||
'messages': [4, 6],
|
'messages': ["4", "6"],
|
||||||
'time': 1649010834064,
|
'time': 1649010834064,
|
||||||
'deleted': False,
|
'deleted': False,
|
||||||
'id': 1
|
|
||||||
},
|
|
||||||
'deleted': False,
|
|
||||||
'edited': False,
|
'edited': False,
|
||||||
'react': {},
|
'id': "1",
|
||||||
'id': 6
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,15 +16,12 @@ You need this headers for send request to API:
|
||||||
|
|
||||||
## How to request?
|
## How to request?
|
||||||
|
|
||||||
### Request type:
|
### Request types:
|
||||||
`GET /api/action`
|
- GET `/api/messages/:id`
|
||||||
|
- GET `/api/users/:id`
|
||||||
### "action" types:
|
- GET `/api/threads/:id`
|
||||||
- GET `messages/:id`
|
- POST `/api/messages`
|
||||||
- GET `users/:id`
|
- POST `/api/messages/:id/react/:type`
|
||||||
- GET `threads/:id`
|
|
||||||
- POST `messages`
|
|
||||||
|
|
||||||
|
|
||||||
### Example request:
|
### Example request:
|
||||||
```GET /api/message/1```
|
```GET /api/message/1```
|
||||||
|
@ -40,28 +37,15 @@ You need this headers for send request to API:
|
||||||
"deleted": false,
|
"deleted": false,
|
||||||
"edited": false,
|
"edited": false,
|
||||||
"react": {},
|
"react": {},
|
||||||
"id": 1,
|
"id": "1",
|
||||||
"author": {
|
"author": {
|
||||||
"name": "ForumcuCocuk",
|
"name": "ForumcuCocuk",
|
||||||
"avatar": "/images/guest.png",
|
"avatar": "/images/guest.png",
|
||||||
"time": 1647177723873,
|
"time": 1647177723873,
|
||||||
"admin": true,
|
"admin": true,
|
||||||
"id": 1
|
"id": "1"
|
||||||
},
|
},
|
||||||
"thread": {
|
"threadID":"0"
|
||||||
"author": {
|
|
||||||
"name": "Akif9748",
|
|
||||||
"avatar": "/images/guest.png",
|
|
||||||
"time": 1647177705200,
|
|
||||||
"admin": true,
|
|
||||||
"id": 0
|
|
||||||
},
|
|
||||||
"title": "First Thread",
|
|
||||||
"messages": [0, 1],
|
|
||||||
"time": 1647178870047,
|
|
||||||
"deleted": false,
|
|
||||||
"id": 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue