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 |
|
||||
| Delete | 🟢 | HIGH |
|
||||
| React | 🟢 | MEDIUM |
|
||||
| Edit | 🔴 | HIGH |
|
||||
| Edit | 🔴 | MEDIUM |
|
||||
|
||||
### Threads
|
||||
| To do | Is done? | Priority |
|
||||
|
@ -52,7 +52,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
|||
| Ratelimit | 🟢 | HIGH |
|
||||
| Create | 🟢 | HIGH |
|
||||
| Delete | 🟢 | HIGH |
|
||||
| Edit | 🔴 | HIGH |
|
||||
| Edit | 🔴 | MEDIUM |
|
||||
|
||||
### API
|
||||
| To do | Is done? | Priority |
|
||||
|
@ -61,14 +61,8 @@ And, you can learn about API in `util/APIDOCS.md`.
|
|||
| Send message | 🟢 | MEDIUM |
|
||||
| Create thread | 🟢 | MEDIUM |
|
||||
| Get info about thread | 🟢 | MEDIUM |
|
||||
<<<<<<< HEAD
|
||||
| Delete message & thread | 🔴 | MEDIUM |
|
||||
| Edit message & thread | 🔴 | MEDIUM |
|
||||
|
||||
=======
|
||||
| Delete message | 🔴 | MEDIUM |
|
||||
| React | 🟢 | MEDIUM |
|
||||
>>>>>>> 9f10a32b7ce05cbb81acacb8277b68c25d4baa34
|
||||
| Delete message & thread | 🔴 | HIGH |
|
||||
| Edit message & thread | 🔴 | HIGH |
|
||||
|
||||
### Other
|
||||
| To do | Is done? | Priority |
|
||||
|
@ -77,7 +71,7 @@ And, you can learn about API in `util/APIDOCS.md`.
|
|||
| Multi-theme support | 🔴 | LOW |
|
||||
| Search | 🔴 | MEDIUM |
|
||||
| Better view | 🟢 | MEDIUM |
|
||||
| Sending message etc. will use fetch API | 🔴 | HIGH |
|
||||
| Sending message etc. will use fetch API | 🟡 | HIGH |
|
||||
|
||||
## Screenshot
|
||||
![akf-forum](https://user-images.githubusercontent.com/70021050/160255959-ef216cba-1348-4d4b-9347-fe67e21348e7.png)
|
||||
|
|
|
@ -14,7 +14,6 @@ print(r.json())
|
|||
example_response = {
|
||||
'status': 200,
|
||||
'result': {
|
||||
'authorID': 0,
|
||||
'content': 'a',
|
||||
'author': {
|
||||
'name': 'Akif9748',
|
||||
|
@ -22,14 +21,14 @@ example_response = {
|
|||
'time': 1649189944864,
|
||||
'admin': False,
|
||||
'deleted': False,
|
||||
'id': 0
|
||||
'id': "0"
|
||||
},
|
||||
'time': 1649189950166,
|
||||
'threadID': 0,
|
||||
'threadID': "0",
|
||||
'deleted': False,
|
||||
'edited': False,
|
||||
# Reactions: {userid: isLike (Bool)}
|
||||
'react': {'0': True},
|
||||
'id': 0
|
||||
'id': "0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,12 +20,12 @@ example_response = {
|
|||
"time": 1647895891332,
|
||||
"admin": False,
|
||||
"deleted": False,
|
||||
"id": 0
|
||||
"id": "0"
|
||||
},
|
||||
"title": "First Thread",
|
||||
"messages": [0, 1, 2, 3],
|
||||
"messages": ["0", "1", "2", "3"],
|
||||
"time": 1647895907054,
|
||||
"deleted": False,
|
||||
"id": 0
|
||||
"id": "0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,6 @@ example_response = {
|
|||
'time': 1647895891332,
|
||||
'admin': True,
|
||||
'deleted': False,
|
||||
'id': 0
|
||||
'id': "0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,24 +27,13 @@ example_response = {
|
|||
'time': 1649009854217,
|
||||
'admin': False,
|
||||
'deleted': False,
|
||||
'id': 2
|
||||
'id': "2"
|
||||
},
|
||||
'time': 1649010863471,
|
||||
'thread': {
|
||||
'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
|
||||
},
|
||||
'threadID': "1",
|
||||
'deleted': False,
|
||||
'edited': False,
|
||||
'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 = {
|
||||
'status': 200,
|
||||
'result': {
|
||||
'content': 'This message sent via API',
|
||||
'author': {
|
||||
'name': 'testUser',
|
||||
'avatar': '',
|
||||
'time': 1649009854217,
|
||||
'admin': False,
|
||||
'deleted': False,
|
||||
'id': 2
|
||||
},
|
||||
'time': 1649010863471,
|
||||
'thread': {
|
||||
'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
|
||||
'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,
|
||||
'edited': False,
|
||||
'react': {},
|
||||
'id': 6
|
||||
'id': "1",
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,15 +16,12 @@ You need this headers for send request to API:
|
|||
|
||||
## How to request?
|
||||
|
||||
### Request type:
|
||||
`GET /api/action`
|
||||
|
||||
### "action" types:
|
||||
- GET `messages/:id`
|
||||
- GET `users/:id`
|
||||
- GET `threads/:id`
|
||||
- POST `messages`
|
||||
|
||||
### Request types:
|
||||
- GET `/api/messages/:id`
|
||||
- GET `/api/users/:id`
|
||||
- GET `/api/threads/:id`
|
||||
- POST `/api/messages`
|
||||
- POST `/api/messages/:id/react/:type`
|
||||
|
||||
### Example request:
|
||||
```GET /api/message/1```
|
||||
|
@ -40,28 +37,15 @@ You need this headers for send request to API:
|
|||
"deleted": false,
|
||||
"edited": false,
|
||||
"react": {},
|
||||
"id": 1,
|
||||
"id": "1",
|
||||
"author": {
|
||||
"name": "ForumcuCocuk",
|
||||
"avatar": "/images/guest.png",
|
||||
"time": 1647177723873,
|
||||
"admin": true,
|
||||
"id": 1
|
||||
"id": "1"
|
||||
},
|
||||
"thread": {
|
||||
"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
|
||||
}
|
||||
"threadID":"0"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue