-
Notifications
You must be signed in to change notification settings - Fork 0
/
request_api.txt
129 lines (88 loc) · 5.17 KB
/
request_api.txt
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
120
121
122
123
124
125
126
127
128
129
Request Backend (API):
Address_backend = http://localhost:5001/
interface:
Authentification:
- login_success = { login: string, userCreate: boolean, twofa: boolean, apiToken: string, exDate: Date }
- refresh_token = { token: string, exDate: Date };
Users:
- User_entity = { id: number, login: string, name: string, role: 'admin'/'user', nbWins: number, nbLoses: number, isTwoFa : boolean, avatarUrl: string, status: string, total_games: number, win_loss_ratio: number };
- User_profile = { login: string, name: string, nbWins: number, nbLoses: number, isTwoFa: boolean, avatarUrl: string, totalGame: number, kda: number, status: string };
- User_public = { login: string , name: string, nbWins: number, nbLoses: number, avatarUrl: string };
- User_profile_setting = { login: name, name: string, isTwoFa: boolean, avatarUrl: string };
Friends:
- Friends_entity = { id: number, sender: string, receiver: string, status: 'none'/'pending'/'accepted' };
- Friends_invite = { sender: string, receiver: string, status: 'none'/'pending'/'accepted' };
GameHistory:
- GameHistory_entity = { id: number, winner: string, loser: string, winnerScore: number, loserScore: number, timeStamp: string }
- GameHistory_DTO (Data transfer object) = { winner: string, loser: string, winnerScore: number, loserScore: number, timeStamp: string, }
}
Authentification:
- GET Address_backend + /auth/get_token : Query { code=accessToken }
return login_success
- GET Address_backend + /auth/refresh_token: header { Authorization: 'Bearer + apiToken'}
return refresh_token
- GET Address_backend + auth/twofa/get_token: Query { login=userLogin, code=TwofaCode }
return login_success by checking twofa
Users:
- GET Address_backend + /users
return User_public[]
- GET Address_backend + /users/admin : header { Authorization: 'Bearer + apiToken'}
return User_entity[]
- GET Address_backend + /users/profile/:login : header { Authorization: 'Bearer + apiToken'}
:login is user login
return User_profile interface
- GET Address_backend + /users/public/:login : header { Authorization: 'Bearer + apiToken'}
:login is user login
return User_public interface
- GET Address_backend + /users/checkName : header { Authorization: 'Bearer + apiToken'}, Query {name=XXX}
return boolean
- POST Address_backend + /users/edit: header { Authorization: 'Bearer + apiToken'}, Body {User_profile_setting}
edit profil parameter
- POST Address_backend + /users/game : header { Authorization: 'Bearer + apiToken'}, Body { winnerLogin: string, loserLogin : string }
update game score
- POST Address_backend + /users/editAll : header { Authorization: 'Bearer + apiToken', }
requirement : form-data {
file: image,
param: {
name: string,
twofa: boolean,
}
}
upload All param
- DELETE Address_backend + /users/delete:
delete all User_entity
Friends:
- GET Address_backend + /friends: header { Authorization: 'Bearer + apiToken'}
return User_public[]
- GET Address_backend + /friends/logins: header { Authorization: 'Bearer + apiToken'}
return user login table
- GET Address_backend + /friends/get_invite: header { Authorization: 'Bearer + apiToken'}
return Friends_invite[] to invite
- GET Address_backend + /friends/geet_receive: header { Authorization: 'Bearer + apiToken'}
return Friends_invite[] to receiver
- GET Address_backend + /friends/admin: header { Authorization: 'Bearer + apiToken'}
if user role is admin then return Friends_entity[]
- POST Address_backend + /friends/send: header { Authorization: 'Bearer + apiToken'}, Query { to=userLogin }
send invite to user
- POST Address_backend + /friends/accept: header { Authorization: 'Bearer + apiToken'}, Query { to=userLogin }
accept invite to user
- POST Address_backend + /friends/deny: header { Authorization: 'Bearer + apiToken'}, Query { to=userLogin }
deny invite to user
- DELETE Address_backend + /friends
delete all Friends_entity
Block:
- GET Address_backend + /block/:login: header { Authorization: 'Bearer + apiToken'}
:login is user login
return string table with the names of the blockers by user
- POST Address_backend + /block/block: header { Authorization: 'Bearer + apiToken'}, Query { to=userLogin }
send request to block user (user = to)
- POST Address_backend + /block/unblock: header { Authorization: 'Bearer + apiToken'}, Query { to=userLogin }
send request to unblock user (user = to)
GameHistory:
- GET Address_backend + /game-history/history: header { Authorization: 'Bearer + apiToken'}
return GameHistory_entity table or undifine
- GET Address_backend + /game-history/history/:login: header { Authorization: 'Bearer + apiToken'}
:login is user login
return GameHistory_entity table of the user
- POST Address_backend + /game-history/newGame: header { Authorization: 'Bearer + apiToken'}, Body { GameHistory_DTO }
send new game to history