-
Notifications
You must be signed in to change notification settings - Fork 3
/
openapi.yaml
995 lines (929 loc) · 24.8 KB
/
openapi.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
openapi: 3.0.3
info:
title: TooGoodToGo API
description: Attempt to reverse-engineer the TooGoodToGo API
version: 0.0.1
servers:
- url: https://apptoogoodtogo.com/api
description: Production (Nearest)
- url: https://euw1.apptoogoodtogo.com/api
description: Production (EU)
- url: https://use1.apptoogoodtogo.com/api
description: Production (US)
- url: https://backend-staging.apptoogoodtogo.com/api
description: Staging (Nearest)
- url: https://backend-staging-euw1.apptoogoodtogo.com/api
description: Staging (EU)
- url: https://backend-staging-use1.apptoogoodtogo.com/api
description: Staging (US)
- url: https://gold-backend-internal.dev-euw1.tgtg.ninja/api
description: Gold (EU) (Requires VPN)
- url: https://gold-backend-internal.dev-use1.tgtg.ninja/api
description: Gold (US) (Requires VPN)
- url: https://backend-test1.apptoogoodtogo.com/api
description: Test1 (EU)
- url: https://backend-test1-use1.apptoogoodtogo.com/api
description: Test1 (US)
- url: https://backend-test2.apptoogoodtogo.com/api
description: Test2 (EU)
- url: https://backend-test2-use1.apptoogoodtogo.com/api
description: Test2 (US)
- url: https://backend-test3.apptoogoodtogo.com/api
description: Test3 (EU)
- url: https://backend-test3-use1.apptoogoodtogo.com/api
description: Test3 (US)
- url: https://backend-test4.apptoogoodtogo.com/api
description: Test4 (EU)
- url: https://backend-test4-use1.apptoogoodtogo.com/api
description: Test4 (US)
- url: https://backend-test5.apptoogoodtogo.com/api
description: Test5 (EU)
- url: https://backend-test5-use1.apptoogoodtogo.com/api
description: Test5 (US)
- url: https://backend-test6.apptoogoodtogo.com/api
description: Test6 (EU)
- url: https://backend-test6-use1.apptoogoodtogo.com/api
description: Test6 (US)
- url: https://backend-test7.apptoogoodtogo.com/api
description: Test7 (EU)
- url: https://backend-test7-use1.apptoogoodtogo.com/api
description: Test7 (US)
- url: https://backend-test8.apptoogoodtogo.com/api
description: Test8 (EU)
- url: https://backend-test8-use1.apptoogoodtogo.com/api
description: Test8 (US)
- url: https://backend-test9.apptoogoodtogo.com/api
description: Test9 (EU)
- url: https://backend-test9-use1.apptoogoodtogo.com/api
description: Test9 (US)
tags:
- name: "app"
description: ""
- name: "auth"
description: ""
- name: "basket"
description: ""
- name: "gdpr"
description: ""
- name: "hiddenstore"
description: ""
- name: "item"
description: ""
- name: "location"
description: ""
- name: "map"
description: ""
- name: "order"
description: ""
- name: "payment"
description: ""
- name: "selfonboarding"
description: ""
- name: "store"
description: ""
- name: "support"
description: ""
- name: "tracking"
description: ""
- name: "user"
description: ""
- name: "voucher"
description: ""
paths:
/app/v1/app_settings:
post:
tags:
- app
summary: Get App settings
parameters:
- in: header
name: Accept-Language
schema:
type: string
required: true
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/AppSettings'
'400':
description: Bad request. The Accept-Language header is required.
/app/v1/user_settings:
post:
tags:
- app
summary: Get User settings
security:
- bearerAuth: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UserSettings'
'400':
description: Bad request. The Accept-Language header is required.
/auth/v2/loginByEmail:
post:
tags:
- auth
summary: Logs in a user by email.
requestBody:
$ref: '#/components/requestBodies/LoginByEmailRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
'400':
description: VALIDATION_ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
'403':
description: FAILED_LOGIN
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
/auth/v2/logout:
post:
tags:
- auth
summary: Logs out (destroys the tokens)
security:
- bearerAuth: []
responses:
'200':
description: OK
'401':
description: UNAUTHORIZED
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Errors'
- $ref: '#/components/schemas/Error'
/hiddenstore/v2/unlock:
post:
tags:
- hiddenstore
summary: Unlock a hidden store
security:
- bearerAuth: []
requestBody:
$ref: '#/components/requestBodies/UnlockHiddenStoreRequest'
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UnlockHiddenStoreResponse'
'400':
description: VALIDATION_ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
'401':
description: UNAUTHORIZED
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Errors'
- $ref: '#/components/schemas/Error'
'403':
description: FORBIDDEN
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
# happens if the given user_id doesn't match with the given bearer token
# UNAUTHORIZED
# Access is denied
/auth/v2/token/refresh:
post:
tags:
- auth
summary: Refresh the access token
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
refresh_token:
type: string
description: "Refresh token"
required:
- refresh_token
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/RefreshTokenResult'
'400':
description: VALIDATION_ERROR - refresh_token must not be blank
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
'401':
description: UNAUTHORIZED - Invalid token
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
/map/v1/listAllBusinessLocationPicker:
post:
tags:
- map
summary: List all business location picker
responses:
'200':
description: OK
content:
text/html:
schema:
$ref: '#/components/schemas/StoreLocationListResult'
/user/v1/:
post:
tags:
- user
summary: Get current user data
security:
- bearerAuth: []
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UserData'
'401':
description: UNAUTHORIZED
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Errors'
- $ref: '#/components/schemas/Error'
/user/v1/update:
post:
tags:
- user
summary: Update current user data
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/UserData' # user_id is required but not checked
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/UserData'
'400':
description: VALIDATION_ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
'401':
description: UNAUTHORIZED
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Errors'
- $ref: '#/components/schemas/Error'
/user/v1/changePassword:
post:
tags:
- user
summary: Change password
security:
- bearerAuth: []
requestBody:
$ref: '#/components/requestBodies/ChangePasswordRequest'
responses:
'200':
description: OK
'400':
description: VALIDATION_ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
'401':
description: UNAUTHORIZED
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Errors'
- $ref: '#/components/schemas/Error'
'403':
description: PASSWORD_INCORRECT
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
# PASSWORD_INCORRECT
# WrongPasswordException
/user/v1/resetPassword:
post:
tags:
- user
summary: Reset password
requestBody:
$ref: '#/components/requestBodies/ResetPasswordRequest'
responses:
'200':
description: 'OK'
'400':
description: VALIDATION_ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
/user/v1/resendWelcomeEmail:
post:
tags:
- user
summary: Resend the Welcome email
security:
- bearerAuth: []
requestBody:
$ref: '#/components/requestBodies/ResendWelcomeEmailRequest'
responses:
'200':
description: 'OK'
'400':
description: VALIDATION_ERROR
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
'401':
description: UNAUTHORIZED
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Errors'
- $ref: '#/components/schemas/Error'
'403':
description: FORBIDDEN
content:
application/json:
schema:
$ref: '#/components/schemas/Errors'
# happens if the given user_id doesn't match with the given bearer token
# UNAUTHORIZED
# Access is denied
components:
# Authentication
securitySchemes:
bearerAuth:
type: http
scheme: bearer
# Describing Requests
requestBodies:
LoginByEmailRequest:
required: true
content:
application/json:
schema:
type: object
properties:
device_type:
type: string
description: "Device type"
enum: [UNKNOWN, IOS, ANDROID]
email:
type: string
description: "User's email"
password:
type: string
format: password
description: "User's password"
example:
device_type: "ANDROID"
email: "john.doe@dev.local"
password: "p@ssw0rd"
required:
- device_type
- email
- password
ChangePasswordRequest:
required: true
content:
application/json:
schema:
type: object
properties:
old_password:
type: string
description: "Old password"
new_password:
type: string
description: "New password"
refresh_token:
type: string
description: "Refresh token"
required:
- old_password
- new_password
- refresh_token
ResetPasswordRequest:
required: true
content:
application/json:
schema:
type: object
properties:
email:
type: string
format: email
example: john.doe@dev.local
required:
- email
ResendWelcomeEmailRequest:
required: true
content:
application/json:
schema:
type: object
properties:
user_id:
type: string
example: "123456"
required:
- user_id
UnlockHiddenStoreRequest:
required: true
content:
application/json:
schema:
type: object
properties:
unlock_code:
type: string
user_id:
type: string
example: "123456"
required:
- unlock_code
- user_id
# Describing Responses
schemas:
Errors:
type: object
properties:
errors:
type: array
items:
type: object
properties:
code:
type: string
description: Error type
message:
type: string
description: Error message
required:
- code
required:
- errors
Error:
type: object
properties:
timestamp:
type: integer
example: 1622583457179
status:
type: integer
example: 401
error:
type: string
example: "Unauthorized"
message:
type: string
path:
type: string
example: "/api/auth/v2/logout"
required:
- timestamp
- status
- error
- message
- path
StoreLocationListResult:
type: object
properties:
info:
type: array
items:
type: object
properties:
latitude:
type: string
example: "23.45678912"
longitude:
type: string
example: "5.67890123"
msg:
type: string
example: "OK"
status_code:
type: string
example: "1"
required:
- info
- msg
- status_code
RefreshTokenResult:
type: object
properties:
access_token:
type: string
refresh_token:
type: string
required:
- access_token
- refresh_token
AppSettings:
type: object
properties:
on_app_open_message:
type: string
enum: [BLOCKING]
open_message_type:
type: string
enum: [BLOCKING]
open_message_url:
type: string
format: uri
example: 'https://space.toogoodtogo.com/app-update/android'
countries:
type: array
items:
type: object
properties:
country_iso_code:
type: string
minLength: 2
maxLength: 2
example: 'FR'
terms_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/terms-and-conditions'
privacy_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/privacy-policy'
required:
- country_iso_code
- terms_url
- privacy_url
minItems: 1
purchase_rating_start:
type: string
pattern: '^\d{2}:\d{2}:\d{2}$'
example: '06:00:00'
purchase_rating_end:
type: string
pattern: '^\d{2}:\d{2}:\d{2}$'
example: '23:00:00'
purchase_rating_delay:
type: number
format: double
example: "5400.000000000"
required:
- countries
- purchase_rating_start
- purchase_rating_end
- purchase_rating_delay
UserSettings:
type: object
properties:
country_iso_code:
type: string
minLength: 2
maxLength: 2
example: 'FR'
phone_country_code_suggestion:
type: string
example: '33'
is_user_email_verified:
type: boolean
terms_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/terms-and-conditions'
privacy_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/privacy-policy'
contact_form_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/support/consumer'
blog_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/blog'
careers_url:
type: string
format: uri
example: 'https://toogoodtogo.org/en/careers'
education_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/movement/education'
instagram_url:
type: string
format: uri
example: 'https://www.instagram.com/toogoodtogo.fr'
store_signup_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/business?webview=1&utm_medium=App&utm_source=App&utm_campaign='
store_contact_url:
type: string
format: uri
example: 'https://toogoodtogo.fr/fr/support/store'
bound_sw:
type: object
properties:
longitude:
type: number
format: float
example: -1.2345678
latitude:
type: number
format: float
example: 23.45678912
bound_ne:
type: object
properties:
longitude:
type: number
format: float
example: 5.67890123
latitude:
type: number
format: float
example: 45.678901
meals_saved:
type: object
properties:
country_iso_code:
type: string
minLength: 2
maxLength: 2
example: 'FR'
share_url:
type: string
format: uri
example: 'https://share.toogoodtogo.com/mealssaved/b4f64a9e4482f4e7ef449c66e51adc98?locale=fr_FR'
image_url:
type: string
format: uri
example: 'https://store.toogoodtogo.com/web/resource/v2/sharing/mealsSaved/mobile/4/fr_FR/b4f64a9e4482f4e7ef449c66e51adc98'
meals_saved_last_month:
type: integer
example: 915314
month:
type: integer
example: 4
year:
type: integer
example: 2021
bank_transaction_fee:
type: string
my_store_url:
type: string
order_id:
type: string
unrated_order_id:
type: string
panic_message:
type: string
has_any_vouchers:
type: boolean
can_show_best_before_explainer:
type: boolean
UserData:
type: object
properties:
user_id:
type: string
example: "123456"
name:
type: string
example: "John Doe"
country_id:
type: string
minLength: 2
maxLength: 2
example: 'FR'
email:
type: string
format: email
example: 'john.doe@dev.local'
phone_country_code:
type: string
example: '33'
phone_number:
type: string
example: '612345678'
role: # Not used in the mobile app
type: string
enum: [CONSUMER]
is_partner:
type: boolean
newsletter_opt_in:
type: boolean
push_notifications_opt_in:
type: boolean
required:
- user_id
- name
- phone_country_code
- phone_number
- newsletter_opt_in
- push_notifications_opt_in
Order:
type: object
properties:
cancel_until:
type: string
confirmation_email_sent_to:
type: string
food_handling_instructions:
type: string
buffet_instructions:
type: string
can_user_supply_packaging:
type: boolean
packaging_option:
type: string
is_rated:
type: boolean
item_collection_info:
type: string
item_cover_image:
type: string
item_id:
type: integer
item_logo:
type: string
item_name:
type: string
pickup_interval:
type: object
properties:
start:
type: string
end:
type: string
pickup_location:
type: string
price:
type: string
price_excluding_taxes:
type: string
price_including_taxes:
type: string
sales_taxes:
type: string
total_applied_taxes:
type: string
quantity:
type: integer
overall_rating:
type: string
order_id:
type: integer
redeem_interval:
type: string
order_state:
type: string
enum: [ACTIVE, REDEEMED, REFUNDED_OR_CANCELLED, UNREDEEMED, NOT_COLLECTED]
store_branch:
type: string
store_id:
type: integer
store_logo:
type: string
store_name:
type: string
time_of_purchase:
type: string
format: date-time
would_buy_again:
type: boolean
is_buffet:
type: boolean
can_show_best_before_explainer:
type: boolean
needsSync:
type: boolean
hasCollectionTimeChanged:
type: boolean
hasCollectionStateChanged:
type: boolean
ListOrders:
type: object
properties:
current_time:
type: string
format: date-time
example: "2021-06-01T00:24:58.768422Z"
has_more:
type: boolean
orders:
type: array
items:
$ref: '#/components/schemas/Order'
required:
- current_time
- has_more
- orders
Voucher:
type: object
properties:
id:
type: string
example: '1234'
name:
type: string
state:
type: string
enum: [PENDING, ACTIVE, USED, EXPIRED]
required:
- id
- name
- state
ListUserVoucher:
type: object
properties:
vouchers:
type: array
items:
$ref: '#/components/schemas/Voucher'
StartupResponse:
type: object
properties:
user:
$ref: '#/components/schemas/UserData'
app_settings:
$ref: '#/components/schemas/AppSettings'
user_settings:
$ref: '#/components/schemas/UserSettings'
orders:
$ref: '#/components/schemas/ListOrders'
vouchers:
$ref: '#/components/schemas/ListUserVoucher'
LoginResponse:
type: object
properties:
access_token:
type: string
refresh_token:
type: string
startup_data:
$ref: '#/components/schemas/StartupResponse'
user_count:
type: string
required:
- access_token
- refresh_token
- startup_data
UnlockHiddenStoreResponse:
type: object
properties:
state:
type: string
enum: [OK, CODE_INVALID, ALREADY_UNLOCKED]
required:
- state