generated from peter-evans/swagger-github-pages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathswagger.yaml
1475 lines (1359 loc) · 41.6 KB
/
swagger.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
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: MyTexty API Documentation
description: A secure REST API for the MyTexty app suite
version: 0.0.1
contact:
name: "Jack Considine"
email: "[email protected]"
servers:
- url: https://mytexty.koptional.com/api
# 1) Define the key name and location
components:
securitySchemes:
bearerAuth: # arbitrary name for the security scheme
type: http
scheme: bearer
bearerFormat: JWT
schemas:
PaginationData:
properties:
current_page:
type: integer
format: int64
minimum: 1
first_page_url:
type: string
from:
type: integer
format: int64
minimum: 1
last_page:
type: integer
format: int64
minimum: 1
last_page_url:
type: string
next_page_url:
type: string
path:
type: string
per_page:
type: integer
format: int64
minimum: 1
prev_page_url:
type: string
to:
type: integer
format: int64
total:
type: integer
format: int64
Contact:
properties:
id:
type: integer
example: 32
format: int64
description: The contact's user id
contact_id:
type: integer
example: 32
format: int64
dob:
type: string
example: "01/20/1995"
zip_code:
type: string
example: "78701"
gender:
type: string
enum: ['male', 'female', 'other']
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
email:
type: string
example: "[email protected]"
full_name:
type: string
example: "Arthur Lemur"
phone_number:
type: string
example: "+18476448892"
has_card:
type: boolean
example: true
stripe_id:
type: string
example: cus_INYzkQuqeYvQWT
required:
- full_name
phone_number
email
created_at
updated_at
has_card
id
stripe_customer_id
influencer:
properties:
id:
type: integer
example: 3
format: int64
has_onboarded:
type: boolean
example: false
name:
type: string
example: "Elon Musk"
message_rule:
type: string
example: "everyone"
enum: ["everyone", "subscribers"]
gender:
type: string
example: "male"
enum: ["male", "female"]
email:
type: string
example: [email protected]
profession:
type: string
example: College Counselor
bio:
type: string
example: Hi, I’m Paul George. I will be your college counsellor. Neuro-linguistic programming is a pseudoscientific approach to communication, personal development, and psychotherapy created by Richard Bandler and John Grinder in United States in the 1970s
dob:
type: string
example: "01/20/1995"
description: "Format MM/DD/YYYY"
zip:
type: string
example: "60091"
description: "Format NNNNN"
marital_status:
type: string
example: "Singled"
personal_phone:
type: string
example: "+18476438892"
twilio_phone_number:
type: string
example: "+18476438891"
twilio_phone_id:
type: string
example: "sid_askdfjlkdsflkdsf"
profile_image_url:
type: string
example: "https://via.placeholder.com/400x400"
required: [email, id, name]
Influencer-Request:
required: [name]
properties:
has_onboarded:
type: boolean
example: false
description: Whether this influencer has appropriately updated his profile
name:
type: string
example: "Elon Musk"
push_token:
type: string
example: dmYENnyg70jIlSRi7YSo4v:APA91bFQ0yXmSeS_BXGE8dXBgkQ2tcVlTqRTf8ozM_D4v_ARmzUeTLJtegIqTEU1Oq7cXoLjO_xYdhNWC11sPg2GQqGJb8qu7PSBp8DTY43LFZ6XClX837EDrIi-x-ZR2eEvJtZca9v7
message_rule:
type: string
example: "everyone"
enum: ["everyone", "subscribers"]
gender:
type: string
example: "male"
enum: ["male", "female", "other"]
dob:
type: string
example: "01/20/1995"
description: "Format MM/DD/YYYY"
zip:
type: string
example: "60091"
description: "Format NNNNN"
marital_status:
type: string
example: "Singled"
email:
type: string
example: [email protected]
profession:
type: string
example: College Counselor
bio:
type: string
example: Hi, I’m Paul George. I will be your college counsellor. Neuro-linguistic programming is a pseudoscientific approach to communication, personal development, and psychotherapy created by Richard Bandler and John Grinder in United States in the 1970s
personal_phone:
type: string
example: "+18476438892"
twilio_phone_number:
type: string
example: "+18476438891"
twilio_phone_id:
type: string
example: "sid_askdfjlkdsflkdsf"
profile_image_url:
type: string
example: "https://via.placeholder.com/400x400"
Custom-Question:
properties:
id:
type: integer
example: 32
format: int64
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
title:
example: College
type: string
question:
type: string
example: What college are you studying in
influencer_id:
type: number
format: int64
example: 23
required: [title, question, influencer_id, created_at, updated_at]
Stripe-Plan:
required: ["id", "price_id", "unit_amount", 'created_at', 'product', 'updated_at', 'type', 'stripe_product_id', 'nickname', 'currency', 'billing_scheme', 'active']
properties:
id:
type: number
format: int64
example: 33
price_id:
type: string
example: "price_1Hl7AXGcPac2E5DndUfHl0KA"
description: The stripe price id
created_at:
type: string
format: date
example: "2020-11-17 02:20:47"
updated_at:
type: string
format: date
example: "2020-11-17 02:20:47"
currency:
type: string
enum: ['usd']
nickname:
type: string
enum: [null]
description: Ignore this nickname, use the product nickname
unit_amount:
type: number
format: int64
description: Monthly cost in cents
example: 399
stripe_product_id:
type: number
format: int64
description: Internal, the foreign key to the product
example: 9
type:
type: string
example: "recurring"
enum: ["recurring"]
product:
type: object
properties:
id:
type: number
format: int64
example: 9
prod_id:
type: string
example: 'prod_ILom0t1pZRtkBj'
name:
type: string
example: 'Basic- 30'
description:
type: string
example: '30 Messages Per Month'
messages:
type: number
format: int64
example: 30
description: The number of messages this plan offers. If absent, it's infinite
active:
type: boolean
enum: [true]
created_at:
type: string
format: date
example: "2020-11-17 02:20:47"
updated_at:
type: string
format: date
example: "2020-11-17 02:20:47"
product_id:
type: string
example: "prod_IH8AlVWwXSGxTw"
Message:
required: [id, created_at, updated_at, contact_id, text, direction]
properties:
id:
type: integer
example: 3
format: int64
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
contact_id:
type: number
format: int64
example: 1231
text:
type: string
example: "Howdy!"
direction:
type: string
enum: ["to_influencer", "from_influencer"]
example: "from_influencer"
Chats:
properties:
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
influencer_id:
type: number
format: int64
example: 233
contact_id:
type: number
format: int64
example: 123
last_message:
$ref: "#/components/schemas/Message"
required: [influencer_id, contact_id, last_message, created_at, updated_at]
Subscription:
description: "This is a subscription of a contact to an influencer, with a specific plan selected. Note: currently you could technically subscribe to multiple plans of the same influencer"
required:
- id
contact_id
stripe_price_id
influencer_id
influencer
properties:
id:
type: number
format: int64
example: 6
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
contact_id:
type: number
format: int64
example: 7
stripe_price_id:
type: string
example: price_1Hl7AXGcPac2E5DndUfHl0KA
description: The price_id in Stripe that the contact subscribed to
influencer_id:
type: number
format: int64
example: 3
influencer:
$ref: "#/components/schemas/influencer"
InfluencerContact:
description: This is a contact, but the server will return the contacts plan_id *relative to the influencer*. So we treat this schema differently than the contact endpoints
allOf:
- $ref: '#/components/schemas/Contact'
- type: object
properties:
plan_id:
type: string
example: "plan_askdjfihasfdkhaskjd"
questions:
type: array
items:
$ref: "#/components/schemas/Custom-Question"
plan:
$ref: '#/components/schemas/Stripe-Plan'
required:
- full_name
phone_number
plan_id
email
created_at
updated_at
id
DashboardOverview:
type: object
properties:
net_earnings:
type: number
format: int64
description: The number of \*cents\* that this influencer has earned
example: 5000000
num_subscribers:
type: number
format: int64
example: 200
num_messages:
type: number
format: int64
example: 200
num_chats:
type: number
format: int64
example: 200
PaymentToInfluencer:
description: The payments made from a contact to an influencer. Not necessarily a model but will be returned as an API
type: object
properties:
created_at:
type: string
format: date-time
updated_at:
type: string
format: date-time
plan_id:
type: string
example: "plan_xzmvncbqiewladsf"
contact:
$ref: '#/components/schemas/InfluencerContact'
amount_cents:
example: 2500
type: number
format: int64
required: [contact, amount_cents]
paths:
/twilio-webhook/{influencer_id}:
parameters:
- in: path
name: influencer_id
schema:
type: string
required: true
description: The ID of the influencer that has received a message. This is determined when the webhook is SET as the phone is initially allocated and the webhook created
post:
tags:
- Webhooks
summary: Receives webhook requests from Twilio as messages are received via SMS
description: This will create the message on the backend and send a push notification to the influencer on file
responses:
"200":
description: "An empty affirmation that the message was recorded"
content:
text/plain:
schema:
type: string
enum: ['']
/influencers:
get:
tags:
- Public
responses:
"200":
description: "A paginated list of Influencers"
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/influencer"
/influencers/{influencerId}:
parameters:
- in: path
name: influencerId
schema:
type: string
required: true
description: Id of the influencer who is being fetched
get:
tags:
- Public
responses:
"200":
description: "A paginated list of Influencers"
content:
application/json:
schema:
$ref: "#/components/schemas/influencer"
/influencers/{influencerId}/plans:
get:
tags:
- Public
parameters:
- in: path
name: influencerId
schema:
type: string
required: true
description: Id of the influencer whose plans we're fetching
responses:
"200":
description: "A paginated list of plans an influencer plan offerings"
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: "#/components/schemas/Stripe-Plan"
/contacts/login:
post:
description: Authenticates a contact user
summary: Authenticates a contact user
tags:
- Contact Authentication
responses:
"200":
description: "The authenticated contact"
content:
application/json:
schema:
type: object
properties:
user:
$ref: "#/components/schemas/Contact"
token:
type: string
description: "A JWT token"
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
"401":
description: "Invalid credentials"
/contacts/signup:
post:
description: Creates a new contact user account and authenticates as that user
summary: Creates a new contact user account and authenticates as that user
tags:
- Contact Authentication
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
password
phone
name
properties:
email:
example: "[email protected]"
type: string
description: the contact's email address
name:
example: "Arthur Lemur"
type: string
description: the contact's full name
password:
example: "testing123#"
type: string
description: The influencer's password
phone:
example: "+18476448892"
type: string
description: The influencer's phone number
responses:
"200":
description: "The authenticated contact"
content:
application/json:
schema:
type: object
properties:
user:
$ref: "#/components/schemas/Contact"
token:
type: string
description: "A JWT token"
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
/contact/me:
get:
security:
- bearerAuth: []
description: Returns the contact account of the authenticated user
summary: Returns the contact account of the authenticated user
tags:
- Contact Authentication
responses:
"200":
description: "The authenticated contact"
content:
application/json:
schema:
$ref: "#/components/schemas/Contact"
"401":
description: "No authenticated contact"
/contact/stripe-checkout-session:
post:
security:
- bearerAuth: []
description: Creates a Stripe session from the contact which will be necessary to capture their payment credentials
summary: Creates a Stripe session from the contact which will be necessary to capture their payment credentials
tags:
- Contact Billing
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- success_url
cancel_url
properties:
success_url:
type: string
example: "http://localhost:8101/payment-success"
description: The URL stripe should redirect to when payment information was successfully captured. It will include a sessionId parameter!
cancel_url:
type: string
example: "http://localhost:8101/home"
description: The URL stripe should redirect to when payment information was not captured. Ideally, this will be the last page the contact was visiting
responses:
"200":
description: "The authenticated contact"
content:
application/json:
schema:
properties:
session_id:
type: string
example: "cs_test_c13A2ER1ic5Ns7I8Ogonfo3H197dyG0XjvXxFjnrxSqMe6Zrm92IIxd8ms"
/contact/stripe-payment-method:
put:
security:
- bearerAuth: []
description: Sets the payment method on a customer, using the sessionId in the URL returned by stripe
summary: Sets the payment method on a customer, using the sessionId in the URL returned by stripe
tags:
- Contact Billing
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- session_id
properties:
session_id:
type: string
example: "cs_test_c13A2ER1ic5Ns7I8Ogonfo3H197dyG0XjvXxFjnrxSqMe6Zrm92IIxd8ms"
description: The sessionId returned in the URL after Stripe captures the user's payment method. It will look like `{successUrl}/?sessionId=x`
responses:
"200":
description: A success message indicating the payment method has been set
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
enum: [true]
/contact/subscriptions:
get:
security:
- bearerAuth: []
tags:
- Contact Subscriptions
description: Returns a list of the influencers this contact currently subscribes to, possibly along wiht some subscription information
summary: Returns a list of the influencers this contact currently subscribes to
responses:
"200":
description: success
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
allOf:
- $ref: "#/components/schemas/Subscription"
post:
security:
- bearerAuth: []
tags:
- Contact Subscriptions
description: Subscribes to a plan (requires payment info to be attached to the contact)
summary: Subscribes to a plan (requires payment info to be attached to the contact)
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- stripe_price_id
influencer_id
properties:
stripe_price_id:
type: string
example: "price_1Hl7AXGcPac2E5DndUfHl0KA"
description: The Stripe-price ID for the product that the user is subscribing to
influencer_id:
type: number
example: 3
description: The ID of the influencer for whom we're signing up
responses:
"400":
description: "No payment information"
"200":
description: "user profile + token"
content:
application/json:
schema:
$ref: "#/components/schemas/Subscription"
delete:
security:
- bearerAuth: []
tags:
- Contact Subscriptions
description: Unsubscribes from this influencers plan
summary: Unsubscribes from this influencers plan (Must be subscribed to the plan in the first place)
responses:
"400":
description: "Not subscribed to this influencer"
"200":
description: "user profile + token"
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
enum: [true]
/influencers/signup:
post:
tags:
- Influencer Authentication
summary: Signs up an influencer
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- email
password
phone
name
properties:
email:
type: string
description: the influencers's email address
example: "[email protected]"
password:
type: string
description: The influencer's password
phone:
type: string
description: The influencer's phone number
example: "8472125602"
name:
type: string
description: The influencer's full name
example: "James VIdale"
responses:
"200":
description: "A signup token with the influencer"
content:
application/json:
schema:
type: object
properties:
token:
type: string
description: the
influencer:
$ref: "#/components/schemas/influencer"
/influencers/login:
post:
tags:
- Influencer Authentication
summary: Authenticates User
requestBody:
required: true
content:
application/json:
schema:
type: object
required:
- description
title
url
properties:
email:
type: string
description: the user's email address
password:
type: string
description: The user's password
responses:
"401":
description: "Invalid credentials"
"200":
description: "user profile + token"
content:
application/json:
schema:
type: object
properties:
token:
type: string
description: the
influencer:
$ref: "#/components/schemas/influencer"
/logout:
post:
tags:
- Logging Out - Any User
summary: Logs a user out
responses:
"200":
description: "OK"
content:
application/json:
schema:
type: object
properties:
success:
type: boolean
enum: [true]
/influencer/available-phones:
parameters:
- in: query
name: count
required: false
description: "An optional count for how many available phones to pull. Defaults to 10"
schema:
type: number
- in: query
name: area_code
required: false
example: "847"
description: "An optional 3 digit number to search area codes by"
schema:
type: number
get:
tags:
- Phone Allocation
summary: Lists phone numbers that are available to be allocated to the influencer
description: Lists phone numbers that are available to be allocated to the influencer
security:
- bearerAuth: []
responses:
"200":
description: "Success"
content:
application/json:
schema:
type: array
items:
type: object
properties:
friendly_name:
type: string
example: "(847) 719-6508"
description: The standarad readable format for a phone number
number:
type: string
example: "+18477196508"
description: "The standard machine format for a phone number"
/influencer/provision-phone:
post:
security:
- bearerAuth: []
tags:
- Phone Allocation
requestBody:
required: false
content:
application/json:
schema:
required: [phone_number]
properties:
phone_number:
type: string
example: "+13158738808"
responses:
"400":
description: "Phone number unavailable"
content:
application/json:
schema:
properties: