-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.yml
More file actions
1261 lines (1203 loc) · 35.8 KB
/
api.yml
File metadata and controls
1261 lines (1203 loc) · 35.8 KB
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.1"
info:
title: Promo Code API
version: "1.0"
servers:
- url: https://api.changeme.please/
paths:
/ping:
get:
description: Check that your application is running and ready to receive incoming requests. The response body can be arbitrary (at your discretion); the main point is to return status code 200.
tags:
- default
responses:
"200":
description: "OK"
content:
application/json:
schema:
type: object
properties:
status:
type: string
maxLength: 30
minLength: 1
example:
status: "PONG"
# B2B API
/business/auth/sign-up:
post:
tags:
- B2B
summary: Register a new company
description: |
Registers a new company and returns an access token.
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
name:
$ref: "#/components/schemas/CompanyNameCreate"
email:
$ref: "#/components/schemas/Email"
password:
$ref: "#/components/schemas/Password"
required:
- name
- email
- password
responses:
"200":
description: Company successfully registered.
content:
application/json:
schema:
type: object
properties:
token:
type: string
maxLength: 300
description: Access token for subsequent requests.
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjMiLCJuYW1lIjoiU2FtcGxlIENvbXBhbnkiLCJpYXQiOjE2MDAwMDAwMDB9.abcdef1234567890"
company_id:
$ref: "#/components/schemas/CompanyId"
"400":
$ref: "#/components/responses/Response400"
"409":
$ref: "#/components/responses/EmailAlreadyRegistered"
/business/auth/sign-in:
post:
tags:
- B2B
summary: Company authentication
description: |
Sign in a company using email and password to obtain an access token. Successful authentication invalidates any previously issued tokens.
requestBody:
$ref: "#/components/requestBodies/SignIn"
responses:
"200":
$ref: "#/components/responses/SignIn200"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/SignIn401"
/business/promo:
post:
tags:
- B2B
summary: Create a new promo code
description: |
Creates a new promo code for the company with targeting and code type settings.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PromoCreate"
responses:
"201":
description: Promo code successfully created.
content:
application/json:
schema:
type: object
properties:
id:
type: string
format: uuid
description: Unique identifier of the created promo code.
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
get:
tags:
- B2B
summary: List promo codes
description: |
Returns a list of the company's promo codes with filtering, sorting, and pagination.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/LimitQueryParam"
- $ref: "#/components/parameters/OffsetQueryParam"
- name: sort_by
in: query
schema:
type: string
description: Sort by promo code start/end date. Defaults to creation date. Always descending. Treat missing active_from as -inf and missing active_until as +inf.
enum:
- active_from
- active_until
- name: country
in: query
schema:
type: array
items:
$ref: "#/components/schemas/Country"
description: |
List of target audience countries in ISO 3166-1 alpha-2 to filter promo codes. Returns codes without a region or with a region in the list.
example: ["lu", "fr"]
responses:
"200":
description: Company promo codes list with applied filters.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PromoReadOnly"
headers:
X-Total-Count:
$ref: "#/components/headers/XTotalCount"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
/business/promo/{id}:
get:
tags:
- B2B
summary: Get a promo code
description: |
Retrieves promo code data by its ID. A company can only fetch its own codes.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
responses:
"200":
description: Promo code retrieved successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/PromoReadOnly"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"403":
$ref: "#/components/responses/NoAccessToPromo"
"404":
$ref: "#/components/responses/PromoNotFound"
patch:
tags:
- B2B
summary: Edit a promo code
description: |
Updates promo code data by its ID.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/PromoPatch"
responses:
"200":
description: Promo code updated successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/PromoReadOnly"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"403":
$ref: "#/components/responses/NoAccessToPromo"
"404":
$ref: "#/components/responses/PromoNotFound"
/business/promo/{id}/stat:
get:
tags:
- B2B
summary: Get promo code statistics
description: |
Returns usage statistics for the promo code by country. Only counts activations.
The country summary array must be sorted lexicographically by country code (case-insensitive, convert to lowercase).
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
responses:
"200":
description: Promo code statistics.
content:
application/json:
schema:
$ref: "#/components/schemas/PromoStat"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"403":
$ref: "#/components/responses/NoAccessToPromo"
"404":
$ref: "#/components/responses/PromoNotFound"
# B2C API
/user/auth/sign-up:
post:
tags:
- B2C
summary: Register a new user
description: |
Registers a new user and returns an access token.
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserRegister"
responses:
"200":
description: User successfully registered.
content:
application/json:
schema:
type: object
properties:
token:
type: string
example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjMiLCJuYW1lIjoiSmFuZSBTbWl0aCIsImlhdCI6MTYwMDAwMDAwMH0.abcdef1234567890"
"400":
$ref: "#/components/responses/Response400"
"409":
$ref: "#/components/responses/EmailAlreadyRegistered"
/user/auth/sign-in:
post:
tags:
- B2C
summary: User authentication
description: |
Sign in a user using email and password to obtain an access token. Successful authentication invalidates any previously issued tokens.
requestBody:
$ref: "#/components/requestBodies/SignIn"
responses:
"200":
$ref: "#/components/responses/SignIn200"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/SignIn401"
/user/profile:
get:
tags:
- B2C
summary: Get user profile
description: |
Returns the current user's profile data.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
responses:
"200":
description: User profile data.
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"401":
$ref: "#/components/responses/NoAuth401"
patch:
tags:
- B2C
summary: Update user settings
description: |
Updates the current user's settings. If a new password is specified, subsequent authentications must use it. Changing the password does not invalidate the token.
Fields not provided (or set to null) will not be updated.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UserPatch"
responses:
"200":
description: Profile updated.
content:
application/json:
schema:
$ref: "#/components/schemas/User"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
/user/feed:
get:
tags:
- B2C
summary: Get promo feed
description: |
Returns a feed of promo codes with pagination, filtering, and sorting. Only codes matching the user's targeting settings are returned. Sorted by creation date descending.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/LimitQueryParam"
- $ref: "#/components/parameters/OffsetQueryParam"
- name: category
in: query
schema:
type: string
example: cats
description: Returns promos in the specified category.
- name: active
in: query
schema:
type: boolean
example: true
description: If provided, filters by the `active` status. If absent, no active filter is applied.
responses:
"200":
description: Promo feed.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PromoForUser"
headers:
X-Total-Count:
$ref: "#/components/headers/XTotalCount"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
/user/promo/{id}:
get:
tags:
- B2C
summary: View promo by ID
description: |
Returns the promo code with the specified ID.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
responses:
"200":
description: Promo details.
content:
application/json:
schema:
$ref: "#/components/schemas/PromoForUser"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"404":
$ref: "#/components/responses/PromoNotFound"
/user/promo/{id}/like:
post:
tags:
- B2C
summary: Like a promo code
description: |
Adds a like to the specified promo code. Repeated likes have no effect; a successful response is returned.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
responses:
"200":
description: Like added successfully.
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "ok"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"404":
$ref: "#/components/responses/PromoNotFound"
delete:
tags:
- B2C
summary: Unlike a promo code
description: |
Removes a like from the specified promo code. If no like exists, a successful response is returned.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
responses:
"200":
description: Like removed successfully.
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "ok"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"404":
$ref: "#/components/responses/PromoNotFound"
/user/promo/{id}/comments:
post:
tags:
- B2C
summary: Add a comment to a promo code
description: |
Adds a comment to the specified promo code. A user may leave multiple comments on the same code.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
text:
$ref: "#/components/schemas/CommentText"
required:
- text
responses:
"201":
description: Comment added successfully.
content:
application/json:
schema:
$ref: "#/components/schemas/Comment"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"404":
$ref: "#/components/responses/PromoNotFound"
get:
tags:
- B2C
summary: Get comments for a promo code
description: |
Returns a list of comments for the specified promo code. Sorted by publication date descending.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/LimitQueryParam"
- $ref: "#/components/parameters/OffsetQueryParam"
- $ref: "#/components/parameters/Id"
responses:
"200":
description: List of comments.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Comment"
headers:
X-Total-Count:
$ref: "#/components/headers/XTotalCount"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"404":
$ref: "#/components/responses/PromoNotFound"
/user/promo/{id}/comments/{comment_id}:
get:
tags:
- B2C
summary: Get a specific comment
description: |
Returns the comment with the given ID.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
- $ref: "#/components/parameters/CommentId"
responses:
"200":
description: Comment details.
content:
application/json:
schema:
$ref: "#/components/schemas/Comment"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"404":
$ref: "#/components/responses/PromoOrCommentNotFound"
put:
tags:
- B2C
summary: Edit a comment
description: |
Updates the text of the comment with the given ID.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
- $ref: "#/components/parameters/CommentId"
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
text:
$ref: "#/components/schemas/CommentText"
required:
- text
responses:
"200":
description: Comment updated.
content:
application/json:
schema:
$ref: "#/components/schemas/Comment"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"403":
$ref: "#/components/responses/NoAccessToComment"
"404":
$ref: "#/components/responses/PromoOrCommentNotFound"
delete:
tags:
- B2C
summary: Delete a comment
description: |
Deletes the comment with the given ID.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/Id"
- $ref: "#/components/parameters/CommentId"
responses:
"200":
description: Comment deleted successfully.
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "ok"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"403":
$ref: "#/components/responses/NoAccessToComment"
"404":
$ref: "#/components/responses/PromoOrCommentNotFound"
/user/promo/{id}/activate:
post:
tags:
- B2C
summary: Activate a promo code
description: |
Activates a promo code by its ID.
parameters:
- $ref: "#/components/parameters/Id"
- $ref: "#/components/parameters/AuthorizationHeader"
responses:
"200":
description: Promo code successfully activated.
content:
application/json:
schema:
type: object
properties:
promo:
type: string
example: "sale-ACME-50"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
"403":
description: You cannot use this promo code.
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "error"
message:
type: string
example: "You are not allowed to use this promo code."
"404":
$ref: "#/components/responses/PromoNotFound"
/user/promo/history:
get:
tags:
- B2C
summary: Promo usage history
description: |
Returns this user's promo usage history with pagination. Sorted by activation date descending. The promo code value is not returned; codes may repeat if activated multiple times.
parameters:
- $ref: "#/components/parameters/AuthorizationHeader"
- $ref: "#/components/parameters/LimitQueryParam"
- $ref: "#/components/parameters/OffsetQueryParam"
responses:
"200":
description: Promo usage history.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/PromoForUser"
headers:
X-Total-Count:
$ref: "#/components/headers/XTotalCount"
"400":
$ref: "#/components/responses/Response400"
"401":
$ref: "#/components/responses/NoAuth401"
components:
requestBodies:
SignIn:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SignIn"
parameters:
Id:
name: id
in: path
required: true
schema:
$ref: "#/components/schemas/PromoId"
CommentId:
name: comment_id
in: path
required: true
schema:
$ref: "#/components/schemas/CommentId"
AuthorizationHeader:
name: Authorization
in: header
required: true
schema:
type: string
minLength: 5
maxLength: 300
description: Access token in the format "Bearer {token}".
example: "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.abcdef1234567890"
LimitQueryParam:
name: limit
in: query
schema:
type: integer
description: Maximum number of records
minimum: 0
default: 10
OffsetQueryParam:
name: offset
in: query
schema:
type: integer
description: Offset from the start
minimum: 0
default: 0
schemas:
PromoId:
type: string
format: uuid
description: Unique promo code ID issued by the server.
example: d8f9a687-4ff9-4976-a05c-f1bf1e5e2eec
CommentId:
type: string
format: uuid
example: d727c957-f7c0-4bff-a1ca-b18bd22db9ef
SignIn:
type: object
properties:
email:
$ref: "#/components/schemas/Email"
password:
$ref: "#/components/schemas/Password"
required:
- email
- password
Email:
type: string
format: email
minLength: 8
maxLength: 120
example: "user@example.edu.lu"
Password:
type: string
description: User/company password. Must contain Latin letters, at least one uppercase, one lowercase, one digit, and special characters.
pattern: "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[@$!%*?&])[A-Za-z\\d@$!%*?&]{8,}$"
minLength: 8
maxLength: 60
example: StrongPa$$w0rd!
Country:
type: string
format: iso-3166-alpha-2
description: User country code in ISO 3166-1 alpha-2 (case-insensitive).
example: lu
Target:
type: object
description: Target audience
properties:
age_from:
type: integer
description: Minimum age (inclusive).
minimum: 0
maximum: 100
example: 18
age_until:
type: integer
description: Maximum age (inclusive).
minimum: 0
maximum: 100
example: 30
country:
$ref: "#/components/schemas/Country"
categories:
type: array
maxLength: 20
items:
type: string
minLength: 2
maxLength: 20
description: Targeting categories.
example: [ios, cats, sports, teacher]
PromoDescription:
description: Promo code description
type: string
maxLength: 300
minLength: 10
example: "10% extra cashback for new bank clients!"
PromoImageURL:
description: URL to promo image
type: string
format: url
maxLength: 350
example: https://cdn2.thecatapi.com/images/3lo.jpg
PromoPatch:
type: object
description: Fields for editing a promo code
properties:
description:
$ref: "#/components/schemas/PromoDescription"
image_url:
$ref: "#/components/schemas/PromoImageURL"
target:
$ref: "#/components/schemas/Target"
max_count:
oneOf:
- type: integer
minimum: 0
maximum: 100000000
description: |
Maximum uses for COMMON mode. If current activations exceed this, returns an error. When equal, code becomes inactive. Increasing for an inactive code reactivates it.
- type: integer
minimum: 1
maximum: 1
description: Must be 1 for UNIQUE mode.
active_from:
type: string
format: date
description: Start date (inclusive).
active_until:
type: string
format: date
description: End date (inclusive).
PromoCreate:
properties:
mode:
type: string
enum:
- COMMON
- UNIQUE
description: Code mode.
promo_common:
type: string
minLength: 5
maxLength: 30
description: Required if mode=COMMON.
example: sale-10
promo_unique:
type: array
minLength: 1
maxLength: 5000
items:
type: string
minLength: 3
maxLength: 30
description: Required if mode=UNIQUE.
example:
- winter-sale-30-abc28f99qa
- winter-sale-30-299faab2c
- sale-100-winner
allOf:
- $ref: "#/components/schemas/PromoPatch"
required:
- description
- mode
- max_count
- target
PromoForUser:
type: object
description: Fields when returned to user
properties:
promo_id:
$ref: "#/components/schemas/PromoId"
company_id:
$ref: "#/components/schemas/CompanyId"
company_name:
$ref: "#/components/schemas/CompanyName"
description:
$ref: "#/components/schemas/PromoDescription"
image_url:
$ref: "#/components/schemas/PromoImageURL"
active:
$ref: "#/components/schemas/PromoIsActive"
is_activated_by_user:
type: boolean
description: Whether the user activated this code.
example: false
like_count:
type: integer
minimum: 0
description: Number of likes.
example: 0
is_liked_by_user:
type: boolean
description: Whether the user liked this code.
example: false
comment_count:
type: integer
minimum: 0
description: Number of comments.
example: 0
required:
- promo_id
- company_id
- company_name
- description
- active
- is_activated_by_user
- like_count
- is_liked_by_user
- comment_count
PromoReadOnly:
type: object
description: Promo code (read-only)
properties:
promo_id:
$ref: "#/components/schemas/PromoId"
company_id:
$ref: "#/components/schemas/CompanyId"
company_name:
$ref: "#/components/schemas/CompanyName"
like_count:
readOnly: true
type: integer
minimum: 0
example: 20
used_count:
readOnly: true
type: integer
minimum: 0
example: 7
active:
$ref: "#/components/schemas/PromoIsActive"
allOf:
- $ref: "#/components/schemas/PromoCreate"
required:
- promo_id
- company_id
- company_name
- like_count
- used_count
- active
PromoStat:
type: object
description: Promo code statistics
properties:
activations_count:
type: integer
minimum: 0
example: 10
readOnly: true
countries:
type: array
items:
type: object
readOnly: true
properties:
country:
$ref: "#/components/schemas/Country"
activations_count:
type: integer
minimum: 1
description: Number of activations in this country.
required:
- country
- activations_count
required:
- activations_count
UserTargetSettings:
type: object
description: User targeting settings
properties: