-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapi-schemas.yaml
438 lines (433 loc) · 11.4 KB
/
api-schemas.yaml
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
swagger: '2.0'
info:
title: Authentication Service Backend
description: Handles storage of users and authentication of their identities.
termsOfService: https://www.google.com/policies/terms/
contact:
email: israelvictory87@gmail.com
version: v1
host: 127.0.0.1:3030
schemes:
- http
basePath: /api/v1
consumes:
- application/json
produces:
- application/json
securityDefinitions:
Basic:
type: basic
security:
- Basic: []
paths:
/change_password/:
put:
operationId: change_password_update
description: |-
If the current password is correct,
and the new password equals the repeat new password,
update the user password and save to database
:param request: This is the request object that is sent to the API
:type request: Request
:return: A response object with a payload of data and a status code.
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/UserChangePassword'
responses:
'200':
description: ''
schema:
$ref: '#/definitions/UserChangePassword'
tags:
- change_password
parameters: []
/google_oauth2_login/:
post:
operationId: google_oauth2_login_create
summary: We are validating the id_token that is sent in the header of the request.
description: |-
If the id_token is valid, we are creating a response object and then calling the jwt_login
function
:param request: This is the request object that is sent to the server
:type request: Request
:return: The response object is being returned.
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/GoogleOAuth2'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/GoogleOAuth2'
tags:
- google_oauth2_login
parameters: []
/login/:
post:
operationId: login_create
description: Inherits TokenObtainPairView from rest_framework simplejwt
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/UserLoginObtainPair'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/UserLoginObtainPair'
tags:
- login
parameters: []
/login/refresh/:
post:
operationId: login_refresh_create
description: Inherits TokenRefreshView from rest_framework simplejwt
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/TokenRefresh'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/TokenRefresh'
tags:
- login
parameters: []
/logout/:
post:
operationId: logout_create
summary: It logs out the user and returns a 204 status code
description: |-
:param request: This is the request object that is passed to the view
:type request: Request
:return: A response object with a status code of 204 and no content.
parameters: []
responses:
'201':
description: ''
tags:
- logout
parameters: []
/register/:
post:
operationId: register_create
summary: |-
The function creates a user, generates a verification link,
and sends an email to the user.
description: |-
:param request: The request object
:type request: Request
:return: A response object with a payload of data and a status code.
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/RegisterUser'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/RegisterUser'
tags:
- register
parameters: []
/request_email_uid_token/:
post:
operationId: request_email_uid_token_create
description: |-
It takes in a request object, validates the email address,
gets the inactive user, generates a
uid and token, and sends an email to the user.
:param request: The request object
:type request: Request
:return: A response object with a payload of data and a status code.
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/UserEmail'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/UserEmail'
tags:
- request_email_uid_token
parameters: []
/reset_password/:
post:
operationId: reset_password_create
summary: |-
It takes in a request object,
validates the email address,
generates a uid and token, and sends
an email to the user.
description: |-
:param request: The request object
:type request: Request
:return: A response object with a payload of data and a status code.
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/UserEmail'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/UserEmail'
tags:
- reset_password
parameters: []
/reset_password/{uidb64}/{token}/:
get:
operationId: reset_password_read
summary: |-
It takes a uidb64 and token,
decodes the uidb64,
and checks if the token is valid for the user
description: |-
:param request: The request object
:type request: Request
:param uidb64: The base64 encoded uuid of the user
:param token: The token generated by the default_token_generator
:return: A response object with a payload of data and a status code.
parameters: []
responses:
'200':
description: ''
tags:
- reset_password
post:
operationId: reset_password_create
description: |-
The function takes in a request,
decodes the base64 encoded user id,
gets the user with the id,
sets the user's password to the new password,
and saves the user to the database.
:param request: The request object that was sent to the view
:type request: Request
:param uidb64: The base64 encoded user id
:param token: The token that was sent to the user's email
:return: A response object with a payload of data and a status code.
parameters:
- name: data
in: body
required: true
schema:
$ref: '#/definitions/UserResetPassword'
responses:
'201':
description: ''
schema:
$ref: '#/definitions/UserResetPassword'
tags:
- reset_password
parameters:
- name: token
in: path
required: true
type: string
- name: uidb64
in: path
required: true
type: string
/suspend_user/{user_email}/:
put:
operationId: suspend_user_update
summary: This function suspends a user
description: |-
:param request: The request object
:type request: Request
:param user_email: The email of the user to be suspended
:type user_email: str
:return: A response object with a payload of data and a status code.
parameters: []
responses:
'200':
description: ''
tags:
- suspend_user
parameters:
- name: user_email
in: path
required: true
type: string
/verify_email/{uidb64}/{token}/:
post:
operationId: verify_email_create
description: |-
It takes in a uidb64 and token, decodes the uidb64,
gets the user with the uid, checks if the
token is valid, and if it is,
sets the user's is_email_active and is_active to True.
:param request: The request object
:type request: Request
:param uidb64: The base64 encoded uuid of the user
:param token: The token generated by the default_token_generator
:return: A response object with a payload of data and a status code.
parameters: []
responses:
'201':
description: ''
tags:
- verify_email
parameters:
- name: token
in: path
required: true
type: string
- name: uidb64
in: path
required: true
type: string
definitions:
UserChangePassword:
required:
- email
- current_password
- new_password
- repeat_new_password
type: object
properties:
email:
title: Email
type: string
format: email
minLength: 1
current_password:
title: Current password
type: string
minLength: 1
new_password:
title: New password
type: string
minLength: 1
repeat_new_password:
title: Repeat new password
type: string
minLength: 1
GoogleOAuth2:
required:
- email
type: object
properties:
email:
title: Email
type: string
format: email
minLength: 1
first_name:
title: First name
type: string
default: ''
minLength: 1
last_name:
title: Last name
type: string
default: ''
minLength: 1
UserLoginObtainPair:
required:
- email
- password
type: object
properties:
email:
title: Email
type: string
minLength: 1
password:
title: Password
type: string
minLength: 1
TokenRefresh:
required:
- refresh
type: object
properties:
refresh:
title: Refresh
type: string
minLength: 1
access:
title: Access
type: string
readOnly: true
minLength: 1
RegisterUser:
required:
- username
- email
- password
type: object
properties:
firstname:
title: Firstname
description: What's your firstname?
type: string
maxLength: 255
x-nullable: true
lastname:
title: Lastname
description: What's your lastname?
type: string
maxLength: 255
x-nullable: true
username:
title: Username
description: What's your preferred username?
type: string
maxLength: 255
minLength: 1
email:
title: Email
description: What's your email address?
type: string
format: email
maxLength: 255
minLength: 1
password:
title: Password
type: string
maxLength: 128
minLength: 1
UserEmail:
required:
- email
type: object
properties:
email:
title: Email
type: string
format: email
minLength: 1
UserResetPassword:
required:
- new_password
- repeat_new_password
type: object
properties:
new_password:
title: New password
type: string
minLength: 1
repeat_new_password:
title: Repeat new password
type: string
minLength: 1