-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.yaml
907 lines (875 loc) · 25.2 KB
/
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
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
swagger: "2.0"
info:
title: Fintech Blog
description: Comprehensive api documentation of fintech blog by Design Tek Empire
version: 1.0.1
contact:
email: [email protected]
license:
name: "Apache 2.0"
url: http://apache.org
servers:
-locaclurl: "http://localhost:3000"
Local-description: This is my local server
-liveurl: http://fintechblog.com
Live-description: This is the company website
schemes: [http, https]
# API ENDPOINTS
paths:
/secure/register:
post:
tags:
- Auth Routes
summary: Create a new User
description: This endpoint will create a new user and save to database
produces:
- application/json
consumes:
- application/json
parameters:
- in: body
name: creating a user
schema:
type: object
properties:
username:
type: string
required: true
email:
type: string
password:
type: string
responses:
201:
description: Success
401:
description: Unauthrized Action
422:
description: Action Not Allowed
500:
description: Internal Server Error
/secure/login:
post:
tags:
- Auth Routes
summary: Login a registered user
description: Only fully registered user can login through this route (Username Accepts Both Email and Username)
produces:
- application/json
consumes:
- application/json
parameters:
- in: body
name: Login (username or Email)
schema:
type: object
properties:
username:
type: string
required: true
password:
type: string
responses:
200:
description: Logged in successfullly
401:
description: Provide Missing details
403:
description: Unauthorized Action
500:
description: Internal Server Error
/secure/forgotpassword:
post:
tags:
- Auth Routes
summary: Forgot Password
description: Registered users can enter their email and receive OTP from their email
produces:
- application/json
consumes:
- application/json
parameters:
- in: body
name: Enter email
schema:
type: object
properties:
email:
type: string
required: true
responses:
200:
description: successfullly Sent you OTP
422:
description: User Error or Server Error
/secure/verifyotp:
post:
tags:
- Auth Routes
summary: Verify OTP
description: OTP received from user's email can be verified in this route, userId and the otp will be provided in the body before this verification process will be successfull
produces:
- application/json
consumes:
- application/json
parameters:
- in: body
name: Enter OTP
schema:
type: object
properties:
userId:
type: string
required: true
otp:
type: string
required: true
responses:
201:
description: successfull
422:
description: User Error or Server Error
/secure/resetpassword/{id}:
put:
tags:
- Auth Routes
summary: Reset Password
description: Here you'd be able to create new password after you've verified your OTP, password and password2 must match for the action to succeed, also password length must be morethan 6 characters
produces:
- application/json
consumes:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
- in: body
name: New Password
schema:
type: string
properties:
password:
type: string
password2:
type: string
responses:
201:
description: Success
403:
description: Unauthorized Action
404:
description: User not found
422:
description: User or Server Error
/secure/logout:
get:
tags:
- Auth Routes
summary: Logout a user and Kill a session
description: This endpoint kills a live session and logs a user out completely
responses:
200:
description: Logged out successfullly
500:
description: Internal Server Error
# Users Route
/users/:
get:
tags:
- User Routes
summary: Get array of all Users
description: Admins can see a list of all users of the application
produces:
application/json
responses:
200:
description: Success
403:
description: Only admins can see this
204:
description: No posts found
500:
description: Internal Server error
/users/{id}:
get:
tags:
- User Routes
summary: Get one single User
description: Returns a user with a specified Id
parameters:
- name: id
in: path
schema:
type: integer
responses:
200:
description: Success
403:
description: Only admins can see this
204:
description: No posts found
500:
description: Internal Server error
/users/edit/{id}:
put:
tags:
- User Routes
summary: Edit User Profile
description: Admins and the given user can edit.
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
- in: formData
name: image
type: file
description: Change profile picture
- in: formData
name: username
type: string
description: Username
- in: formData
name: firstname
type: string
description: First Name
- in: formData
name: lastname
type: string
description: Last Name
- in: formData
name: email
type: string
description: Email
- in: formData
name: password
type: string
description: Password
responses:
201:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/users/delete/{id}:
delete:
tags:
- User Routes
summary: Delete A user
description: Admins and the given user can delete.
parameters:
- name: id
in: path
schema:
type: integer
responses:
200:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/categories/:
get:
tags:
- Category Routes
summary: Return All Categories
description: This returns all the created categories from the database
produces:
- application/json
responses:
200:
description: Success
401:
description: Unauthrized Action
422:
description: Action Not Allowed
500:
description: Internal Server Error
/categories/create:
post:
tags:
- Category Routes
summary: Create a new category
description: Endpoint takes a category name as string and create a new category account in database
produces:
- application/json
consumes:
- application/json
parameters:
- in: body
name: creating a user
schema:
type: object
properties:
title:
type: string
responses:
201:
description: Success
403:
description: You're not authenticated
422:
description: Category Already Exists
500:
description: Internal Server Error
/categories/{id}:
get:
tags:
- Category Routes
summary: Get One category by its Id
description: This returns a category specified by its id in parameters
produces:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
responses:
200:
description: Success
403:
description: You're not authenticated
422:
description: Category Already Exists
500:
description: Internal Server Error
/categories/edit/{id}:
put:
tags:
- Category Routes
summary: Edit a category specified by it id
description: This endpoint edits any category as specified by its id in the params
produces:
- application/json
consumes:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
- in: body
name: Title
schema:
type: string
properties:
title:
type: string
responses:
201:
description: Success
403:
description: You're not authenticated
422:
description: Category Already Exists
500:
description: Internal Server Error
/categories/delete/{id}:
delete:
tags:
- Category Routes
summary: Delete a category specified by it id
description: This endpoint deletes any category as specified by its id in the params
parameters:
- name: id
in: path
schema:
type: integer
responses:
200:
description: Success
403:
description: You're not authenticated
422:
description: Category Already Exists
500:
description: Internal Server Error
/posts/create:
post:
tags:
- Post Routes
summary: Create Post
consumes:
- multipart/form-data
parameters:
- in: formData
name: image
type: file
description: file upload
- in: formData
name: title
type: string
required: true
description: Enter Post Title
- in: formData
name: category
type: string
enum: ["Educational", "Schooling", "Banking", "Finances"]
- in: formData
name: desc
type: string
responses:
200:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/posts/approve/{id}:
put:
tags:
- Post Routes
summary: Approve a Post
description: Admins and editors can approve a post from this route
parameters:
- name: id
in: path
schema:
type: integer
- in: formData
name: status
type: string
enum: ["Approved", "Declined", "Pending"]
responses:
201:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/posts/edit/{id}:
put:
tags:
- Post Routes
summary: Edit Post
description: Admins and post authors can edit post.
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
- in: formData
name: title
type: string
description: Enter new title
- in: formData
name: category
type: string
enum: ["Educational", "Schooling", "Banking", "Finances"]
- in: formData
name: desc
type: string
description: update content
format: textarea
responses:
201:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/posts/delete/{id}:
delete:
tags:
- Post Routes
summary: Delete a post specified by it id
description: Approaved Posts can only be deleted by Admins and Editors, If an Editor deletes, reason for deleting the post will be provided and the final deletion of the post will await admin approval else the deleted post will be trashed into recycle bin. While unapproved posts can be deleted by anyone including the post author.
parameters:
- name: id
in: path
schema:
type: integer
- in: formData
name: deleteReason
type: string
description: Enter reason for deleting the post
responses:
200:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/posts/restore/{id}:
put:
tags:
- Post Routes
summary: Restore a deleted post specified by it id
description: Admin reserves the privilege to restore a post previously deleted by an Editor
parameters:
- name: id
in: path
schema:
type: integer
- in: formData
name: restoreReason
type: string
description: Enter reason for restoring the post
responses:
200:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/posts/:
get:
tags:
- Post Routes
summary: Get all Posts & Query Posts by author or categories
description: Query the database for posts based on category or the author.
parameters:
- in: query
name: category
type: string
enum: ["Banking", "Finances", "Educational",]
- in: query
name: author
type: string
responses:
200:
description: Success
schema:
type: array
items:
type: object
204:
description: No posts found
500:
description: Internal server Error
# Get A single post
/posts/user/{userId}:
get:
tags:
- Post Routes
summary: Get a single User All Posts
description: Return a single post from the database
parameters:
- name: userId
in: path
schema:
type: integer
responses:
200:
description: Success
204:
description: No posts found
500:
description: Internal Server error
/posts/{slug}:
get:
tags:
- Post Routes
summary: Get a single Post specified by id
description: Return a single post from the database
parameters:
- name: slug
in: path
schema:
type: string
responses:
200:
description: Success
204:
description: No posts found
500:
description: Internal Server error
/posts/like:
post:
tags:
- Post Routes
summary: Like or Dislike a Post
description: This endpoint takes postId in the req body and controls likes and disliking of a post, it stores the id's of users who likes the post in an array.
consumes:
application/json
parameters:
- in: body
name: Like a post
schema:
type: object
properties:
postId:
type: string
responses:
200:
description: Success
# Bookmark a Post
/posts/bookmark:
post:
tags:
- Post Routes
summary: Bookmark a post
description: This endpoint allows you to bookmark a post for later reading, it takes the postId in the body.
consumes:
application/json
parameters:
- in: body
name: Bookmark
schema:
type: object
properties:
postId:
type: string
responses:
200:
description: Success
500:
description: Internal Server Error
# Return a single User's all bookmarked posts
/posts/bookmark/{userId}:
get:
tags:
- Post Routes
summary: Get all bookmarked posts of a particular user
description: This endpoint returns all all bookmarked posts of a particular user
produces:
- application/json
consumes:
- application/json
parameters:
- name: userId
in: path
schema:
type: integer
responses:
200:
description: Success
204:
description: "No Bookmark Found"
403:
description: You're not authenticated
500:
description: Internal Server Error
# Handle Comment Routes
/comments/create:
post:
tags:
- Comment Routes
summary: Drop a Comment
description: Both Logged in and Non Logged in user can drop a comment, a non logged in user will have to provide additional details of name and email particulars before they can submit a comment.
produces:
- application/json
consumes:
- application/json
parameters:
- name: postId
in: path
schema:
type: integer
- in: body
name: comment
schema:
type: string
properties:
full_name:
type: string
email:
type: string
comment:
type: string
responses:
201:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
# Edit Comment
/comments/edit/{id}:
put:
tags:
- Comment Routes
summary: Edit Comment
description: Admins/Editor and post authors can edit post.
produces:
- application/json
consumes:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
- in: body
name: comment
schema:
type: string
properties:
comment:
type: string
responses:
201:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
# Delete Comment
/comments/delete/{id}:
delete:
tags:
- Comment Routes
summary: Delete Comment
description: Admins/Editor and comment authors can delete post.
produces:
- application/json
consumes:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
responses:
200:
description: Success
403:
description: You're not authenticated
500:
description: Internal Server Error
/comments/all/{postId}:
get:
tags:
- Comment Routes
summary: All comments from a single Post
description: This endpoint returns all comments that was made on a singular post noted by postId
produces:
- application/json
consumes:
- application/json
parameters:
- name: postId
in: path
schema:
type: integer
responses:
200:
description: Success
204:
description: No post found
500:
description: Internal Server Error
# Trade Signal and Trade Indicators
/trades/create:
post:
tags:
- Trade Routes
summary: Create Trade Signal
description: This endpoint allows Admins or Partners to Create Trade signals.
consumes:
- application/json
produces:
- application/json
parameters:
- in: body
name: Create Signal
schema:
type: object
properties:
symbol:
type: string
stopLoss:
type: integer
takeProfit:
type: integer
entryTime:
type: string
endTime:
type: string
responses:
201:
description: Success
204:
description: No post found
403:
description: Partner Access required
500:
description: Internal Server Error
/trades/edit/{id}:
put:
tags:
- Trade Routes
summary: Edit Trade Signal
description: This endpoint allows the Partner that created the signal to edit.
consumes:
- application/json
produces:
- application/json
parameters:
- name: id
in: path
schema:
type: integer
- in: body
name: Edit Signal
schema:
type: object
properties:
symbol:
type: string
stopLoss:
type: integer
takeProfit:
type: integer
entryTime:
type: string
endTime:
type: string
responses:
201:
description: Success
204:
description: No post found
403:
description: Partner Access required
500:
description: Internal Server Error
/trades/delete/{id}:
delete:
tags:
- Trade Routes
summary: Delete Trade Signal
description: This endpoint allows the Partner or an Admin that created the signal to Delete.
parameters:
- name: id
in: path
schema:
type: integer
responses:
201:
description: Success
204:
description: No post found
403:
description: Partner Access required
500:
description: Internal Server Error
/trades/all:
get:
tags:
- Trade Routes
summary: Get All trade Signals
description: This endpoint returns All trade Signals and its open to both logged in and non-logged in users
produces:
- application/json
responses:
200:
description: Success
204:
description: No Signal found
403:
description: Partner Access required
500:
description: Internal Server Error