-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblog_lite_api.yaml
817 lines (817 loc) · 21.1 KB
/
blog_lite_api.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
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
openapi: 3.0.3
info:
title: Blog Lite - OpenAPI 3.0.3
description: |
This is API documentation made blog lite application
[db-diagram-io](https://dbdiagram.io/d/63c2e10c296d97641d79a958)
[db-schema-image-link](https://imgur.com/a/FiidZk1)
![db-schema](https://i.imgur.com/TtD0Hi2.png)
contact:
name: Indra Kumar Reddy Guvva
email: [email protected]
version: 1.0.11
servers:
- url: http://127.0.0.1:8000
tags:
- name: User_profile_API
description: create,edit,delete user and get user info
- name: Posts_API
description: create,edit,delete a Post and get post details
- name: Comments_API
description: make & delete comment, get all comments of a post
- name: Likes_API
description: like & unlike a post, get all likes of a post
- name: Follow_API
description: follow & unfollow, get followers and user's following
- name: Get_Feed_API
description: gets all posts made by users following
- name: Get_User_Posts_API
description: gets all posts of the user
- name: Search_API
description: gets the username,profile_image of the users matching search query
paths:
/api/User_profile:
post:
tags:
- User_profile_API
summary: Add a new user
description: Add a new user
operationId: addPet
requestBody:
description: New user information
content:
application/json:
schema:
$ref: '#/components/schemas/User_Input'
application/xml:
schema:
$ref: '#/components/schemas/User_Input'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User_Input'
required: true
responses:
'200':
description: User added to database
content:
application/json:
schema:
$ref: '#/components/schemas/User'
application/xml:
schema:
$ref: '#/components/schemas/User'
"400":
description: User_2 username not given, User_1 username already exists
content:
application/json:
schema:
type: object
properties:
error_code:
type: string
error_message:
type: string
/api/User_profile/{username}:
put:
tags:
- User_profile_API
summary: Edit user Information
description: Edit user Information
operationId: edituser
parameters:
- in: path
name: username
required: true
schema:
type: string
example: Johndoe
requestBody:
description: Edit user Information
content:
application/json:
schema:
$ref: '#/components/schemas/User_Input'
application/xml:
schema:
$ref: '#/components/schemas/User_Input'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/User_Input'
required: true
responses:
'200':
description: User Information Edited
content:
application/json:
schema:
$ref: '#/components/schemas/User'
application/xml:
schema:
$ref: '#/components/schemas/User'
"404":
description: User does not exist
get:
tags:
- User_profile_API
summary: Edit user Information
description: Edit user Information
operationId: getuserinformation
parameters:
- in: path
name: username
required: true
schema:
type: string
example: Johndoe
responses:
'200':
description: User Information is found
content:
application/json:
schema:
$ref: '#/components/schemas/User'
application/xml:
schema:
$ref: '#/components/schemas/User'
"404":
description: User does not exist
delete:
tags:
- User_profile_API
summary: Edit user Information
description: Edit user Information
operationId: deleteuser
parameters:
- in: path
name: username
required: true
schema:
type: string
example: Johndoe
responses:
'200':
description: user deleted
"404":
description: User does not exist
/api/Posts:
post:
tags:
- Posts_API
summary: Create a Post
description: This can only be done by the logged in user.
operationId: createpost
requestBody:
description: Post Information
content:
application/json:
schema:
$ref: '#/components/schemas/Posts_Input'
application/xml:
schema:
$ref: '#/components/schemas/Posts_Input'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Posts_Input'
responses:
'200':
description: User added to database
content:
application/json:
schema:
$ref: '#/components/schemas/Posts'
application/xml:
schema:
$ref: '#/components/schemas/Posts'
"400":
description: Post_2 title not given, Post_1 title already exists
content:
application/json:
schema:
type: object
properties:
error_code:
type: string
error_message:
type: string
/api/Posts/{p_id}:
put:
tags:
- Posts_API
summary: Edit a post
description: Edit a post
operationId: Editpost
parameters:
- in: path
name: p_id
required: true
schema:
type: integer
example: 1
requestBody:
description: Post Information
content:
application/json:
schema:
$ref: '#/components/schemas/Posts_Input'
application/xml:
schema:
$ref: '#/components/schemas/Posts_Input'
application/x-www-form-urlencoded:
schema:
$ref: '#/components/schemas/Posts_Input'
responses:
'200':
description: Edited Post
content:
application/json:
schema:
$ref: '#/components/schemas/Posts'
application/xml:
schema:
$ref: '#/components/schemas/Posts'
"404":
description: Post does not exist
"400":
description: pedit_1 post already exists with this title
content:
application/json:
schema:
type: object
properties:
error_code:
type: string
error_message:
type: string
get:
tags:
- Posts_API
summary: Gets post Information
description: Gets post Information
operationId: getpostbyid
parameters:
- in: path
name: p_id
required: true
schema:
type: integer
example: 1
responses:
'200':
description: User Information is found
content:
application/json:
schema:
$ref: '#/components/schemas/Posts'
application/xml:
schema:
$ref: '#/components/schemas/Posts'
"404":
description: Post not found
/api/Posts/{username}/{p_id}:
delete:
tags:
- Posts_API
summary: Deletes a post
description: Deletes a post
operationId: deletepost
parameters:
- in: path
name: username
required: true
schema:
type: string
example: Johndoe
- in: path
name: p_id
required: true
schema:
type: integer
example: 1
responses:
'200':
description: post deleted
"404":
description: User does not exist
/api/Comments/{p_id}:
post:
tags:
- Comments_API
summary: Make a comment
description: Make a comment
operationId: postcomment
parameters:
- in: path
name: p_id
required: true
schema:
type: integer
example: 1
requestBody:
description: Comment Information
content:
application/json:
schema:
type: object
properties:
post_id:
type: integer
example: 1
commenter:
type: string
example: johndoe
comment_description:
type: string
example: hey this is a comment
responses:
'200':
description: Edited Post
content:
application/json:
schema:
$ref: '#/components/schemas/Comments'
application/xml:
schema:
$ref: '#/components/schemas/Comments'
"404":
description: Post doesn't exist
get:
tags:
- Comments_API
summary: Gets all comments of API
description: Gets all comments of API
operationId: getcommentdetails
parameters:
- in: path
name: p_id
description: Post_id
required: true
schema:
type: integer
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/User'
'404':
description: There are no comments for this post
/api/Comments/{engaged_user}/{c_id}:
delete:
tags:
- Comments_API
summary: delete comment
description: delete comment
operationId: deletecomment
parameters:
- in: path
name: engaged_user
description: User_id
required: true
schema:
type: string
- in: path
name: c_id
description: Comment_id
required: true
schema:
type: integer
responses:
'200':
description: comment deleted
"400":
description: cmnt_01 user can't delete this post
content:
application/json:
schema:
type: object
properties:
error_code:
type: string
error_message:
type: string
'404':
description: There are no comments for this post
/api/Likes/{p_id}:
get:
tags:
- Likes_API
summary: Gets all Likes of a post
description: Gets all Likes of a post
operationId: getlikes
parameters:
- in: path
name: p_id
description: Post_id
required: true
schema:
type: integer
responses:
'200':
description: usernames of all the persons who liked the post
content:
application/json:
schema:
$ref: '#/components/schemas/Likes'
'404':
description: User not found
/api/Likes/{username}/{p_id}:
delete:
tags:
- Likes_API
summary: Removes a like
description: Removes a like
operationId: Removelike
parameters:
- in: path
name: username
required: true
schema:
type: string
example: Johndoe
- in: path
name: p_id
required: true
schema:
type: integer
example: 1
responses:
'200':
description: like entry deleted
"404":
description: user never liked this post
post:
tags:
- Likes_API
summary: like a post
description: Like a post
operationId: likepost
parameters:
- in: path
name: username
required: true
schema:
type: string
example: Johndoe
- in: path
name: p_id
required: true
schema:
type: integer
example: 1
responses:
'200':
description: User liked the post
"400":
description: Post/User not found
/api/Follow/{username}:
get:
tags:
- Follow_API
summary: Gets all followers of the user
description: Gets all followers of the user
operationId: getfollowers
parameters:
- in: path
name: username
description: username
required: true
schema:
type: string
responses:
'200':
description: List of all followers
content:
application/json:
schema:
$ref: '#/components/schemas/Follow'
'404':
description: User not found
/api/Follow/{follower_username}/{followed_username}:
delete:
tags:
- Follow_API
summary: unfollow a user
description: unfollow a user
operationId: unfollow
parameters:
- in: path
name: follower_username
required: true
schema:
type: string
example: Johndoe
- in: path
name: followed_username
required: true
schema:
type: string
example: PaulAlto
responses:
'200':
description: follower_user now doesn't follow followed_user
"400":
description: Like_1 follower_user doesn't follow followed_user
content:
application/json:
schema:
type: object
properties:
error_code:
type: string
error_message:
type: string
post:
tags:
- Follow_API
summary: follow a user
description: follow a user
operationId: follow
parameters:
- in: path
name: follower_username
required: true
schema:
type: string
example: Johndoe
- in: path
name: followed_username
required: true
schema:
type: string
example: PaulAlto
responses:
'200':
description: follow user follows followed_user
/api/Feed/{username}:
get:
tags:
- Get_Feed_API
summary: Gets dashboard feed of the user
description: Gets dashboard feed of the user
operationId: getfeed
parameters:
- in: path
name: username
description: username of the person
required: true
schema:
type: string
responses:
'200':
description: Users feed
content:
application/json:
schema:
$ref: '#/components/schemas/Posts'
/api/Posts_User/{username}:
get:
tags:
- Get_User_Posts_API
summary: Gets all posts created by the user
description: Gets all posts created by the user
operationId: getpostsbyuser
parameters:
- in: path
name: username
description: username of the person
required: true
schema:
type: string
responses:
'200':
description: Users feed
content:
application/json:
schema:
$ref: '#/components/schemas/Posts'
'201':
description: No posts made by user
/api/Search/{query}:
get:
tags:
- Search_API
summary: Gets all posts created by the user
description: Gets all posts created by the user
operationId: getmatchedusers
parameters:
- in: path
name: query
description: usernames of the person
required: true
schema:
type: string
responses:
'200':
description: Users feed
content:
application/json:
schema:
$ref: '#/components/schemas/Search'
'404':
description: No users found
components:
schemas:
User:
type: object
properties:
username:
type: string
example: JohnDoe
first_name:
type: string
example: John
second_name:
type: string
example: Doe
profile_image:
type: string
format: jdoe.jpg
email:
type: string
format: email
example: [email protected]
followers_count:
type: integer
format: int64
example: 0
following:
type: integer
format: int64
example: 0
total_posts:
type: integer
format: int64
example: 0
xml:
name: User
User_Input:
type: object
properties:
username:
type: string
example: JohnDoe
password:
type: string
format: password
first_name:
type: string
example: John
second_name:
type: string
example: Doe
email:
type: string
format: email
example: [email protected]
profile_image:
type: string
format: jdoe.jpg
xml:
name: User_Input
Posts:
type: object
properties:
p_id:
type: integer
format: int64
example: 1
author_name:
type: string
example: Palo Alto
title:
type: string
example: CA Blog
description:
type: string
example: CA's First Blog
post_image:
type: string
example: test.jpg
p_timestamp:
type: array
items:
type: string
example: ["14/01/2023",
"09:59 AM"]
total_comments:
type: integer
example: 0
total_likes:
type: integer
example: 0
author_image:
type: string
example: jdoe.jpg
xml:
name: Posts
Posts_Input:
type: object
properties:
author_name:
type: string
example: Palo Alto
title:
type: string
example: CA Blog
description:
type: string
example: CA's First Blog
post_image:
type: string
example: test.jpg
timestamp:
type: string
example: "2023_01_11_13_45_40"
xml:
name: Posts_Input
Comments:
type: object
properties:
c_id:
type: integer
format: int64
example: 1
post_id:
type: integer
example: 1
commenter:
type: string
example: JohnDoe
comment_description:
type: string
example: Test Comment
p_timestamp:
type: array
items:
type: string
example: ["14/01/2023",
"09:59 AM"]
commenter_image:
type: string
example: jdoe.jpg
xml:
name: Comments
Likes:
type: object
properties:
users_liked:
type: array
items:
type: string
example: ["JohnDoe","PaulAlto"]
xml:
name: Likes
Follow_Object:
type: object
properties:
username:
type: string
example: JohnDoe
profile_image:
type: string
example: jdoe.jpg
xml:
name: Follow_Object
Follow:
type: object
properties:
following:
type: array
items:
type: string
example: ["JohnDoe","PaulAlto"]
followers:
type: array
items:
type: string
example: ["JohnDoe","PaulAlto"]
following_objects:
type: array
items:
$ref: '#/components/schemas/Follow_Object'
followers_objects:
type: array
items:
$ref: '#/components/schemas/Follow_Object'
xml:
name: Follow
Search:
type: object
properties:
username:
type: string
example: JohnDoe
first_name:
type: string
example: John
last_name:
type: string
example: Doe
profile_image:
type: string
example: jdoe.jpg
xml:
name: 'Search'