1 /**
2 * @oas [get] /admin/promotions
3 * operationId: GetPromotions
4 * summary: List Promotions
5 * description: Retrieve a list of promotions. The promotions can be filtered by fields such as `id`. The promotions can also be sorted or paginated.
6 * x-authenticated: true
7 * parameters:
8 * - name: fields
9 * in: query
10 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
11 * fields. without prefix it will replace the entire default fields.
12 * required: false
13 * schema:
14 * type: string
15 * title: fields
16 * description: Comma-separated fields that should be included in the returned data. if a field is prefixed with `+` it will be added to the default fields, using `-` will remove it from the default
17 * fields. without prefix it will replace the entire default fields.
18 * externalDocs:
19 * url: "#select-fields-and-relations"
20 * - name: offset
21 * in: query
22 * description: The number of items to skip when retrieving a list.
23 * required: false
24 * schema:
25 * type: number
26 * title: offset
27 * description: The number of items to skip when retrieving a list.
28 * externalDocs:
29 * url: "#pagination"
30 * - name: limit
31 * in: query
32 * description: Limit the number of items returned in the list.
33 * required: false
34 * schema:
35 * type: number
36 * title: limit
37 * description: Limit the number of items returned in the list.
38 * externalDocs:
39 * url: "#pagination"
40 * - name: order
41 * in: query
42 * description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.
43 * required: false
44 * schema:
45 * type: string
46 * title: order
47 * description: The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.
48 * - name: q
49 * in: query
50 * description: Search term to filter the promotion's searchable attributes.
51 * required: false
52 * schema:
53 * type: string
54 * title: q
55 * description: Search term to filter the promotion's searchable attributes.
56 * - name: code
57 * in: query
58 * required: false
59 * schema:
60 * oneOf:
61 * - type: string
62 * title: code
63 * description: Filter by a promotion code.
64 * - type: array
65 * description: Filter by promotion codes.
66 * items:
67 * type: string
68 * title: code
69 * description: A promotion code.
70 * - name: campaign_id
71 * in: query
72 * required: false
73 * schema:
74 * oneOf:
75 * - type: string
76 * title: campaign_id
77 * description: Filter by a campaign's ID to retrieve its associated promotions.
78 * - type: array
79 * description: Filter by campaign IDs to retrieve their associated promotions.
80 * items:
81 * type: string
82 * title: campaign_id
83 * description: A campaign's ID.
84 * - name: application_method
85 * in: query
86 * description: Apply filters on the application methods to retrieve the promotions of the matching application methods.
87 * required: false
88 * schema:
89 * type: object
90 * description: Apply filters on the application methods to retrieve the promotions of the matching application methods.
91 * properties:
92 * currency_code:
93 * oneOf:
94 * - type: string
95 * title: currency_code
96 * description: Filter by a currency code.
97 * - type: array
98 * description: Filter by currency codes.
99 * items:
100 * type: string
101 * title: currency_code
102 * description: A currency code.
103 * - name: created_at
104 * in: query
105 * description: Filter by a promotion's creation date.
106 * required: false
107 * schema:
108 * type: object
109 * description: Filter by a promotion's creation date.
110 * properties:
111 * $and:
112 * type: array
113 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
114 * items:
115 * type: object
116 * title: $and
117 * $or:
118 * type: array
119 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
120 * items:
121 * type: object
122 * title: $or
123 * $eq:
124 * oneOf:
125 * - type: string
126 * title: $eq
127 * description: Filter by an exact match.
128 * - type: array
129 * description: Filter by an exact match.
130 * items:
131 * type: string
132 * title: $eq
133 * description: Filter by an exact match.
134 * $ne:
135 * type: string
136 * title: $ne
137 * description: Filter by values not equal to this parameter.
138 * $in:
139 * type: array
140 * description: Filter by values in this array.
141 * items:
142 * type: string
143 * title: $in
144 * description: Filter by values in this array.
145 * $nin:
146 * type: array
147 * description: Filter by values not in this array.
148 * items:
149 * type: string
150 * title: $nin
151 * description: Filter by values not in this array.
152 * $not:
153 * oneOf:
154 * - type: string
155 * title: $not
156 * description: Filter by values not matching the conditions in this parameter.
157 * - type: object
158 * description: Filter by values not matching the conditions in this parameter.
159 * - type: array
160 * description: Filter by values not matching the conditions in this parameter.
161 * items:
162 * type: string
163 * title: $not
164 * description: Filter by values not matching the conditions in this parameter.
165 * $gt:
166 * type: string
167 * title: $gt
168 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
169 * $gte:
170 * type: string
171 * title: $gte
172 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
173 * $lt:
174 * type: string
175 * title: $lt
176 * description: Filter by values less than this parameter. Useful for numbers and dates only.
177 * $lte:
178 * type: string
179 * title: $lte
180 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
181 * $like:
182 * type: string
183 * title: $like
184 * description: Apply a `like` filter. Useful for strings only.
185 * $re:
186 * type: string
187 * title: $re
188 * description: Apply a regex filter. Useful for strings only.
189 * $ilike:
190 * type: string
191 * title: $ilike
192 * description: Apply a case-insensitive `like` filter. Useful for strings only.
193 * $fulltext:
194 * type: string
195 * title: $fulltext
196 * description: Filter to apply on full-text properties.
197 * $overlap:
198 * type: array
199 * description: Filter arrays that have overlapping values with this parameter.
200 * items:
201 * type: string
202 * title: $overlap
203 * description: Filter arrays that have overlapping values with this parameter.
204 * $contains:
205 * type: array
206 * description: Filter arrays that contain some of the values of this parameter.
207 * items:
208 * type: string
209 * title: $contains
210 * description: Filter arrays that contain some of the values of this parameter.
211 * $contained:
212 * type: array
213 * description: Filter arrays that contain all values of this parameter.
214 * items:
215 * type: string
216 * title: $contained
217 * description: Filter arrays that contain all values of this parameter.
218 * $exists:
219 * type: boolean
220 * title: $exists
221 * description: Filter by whether a value for this parameter exists (not `null`).
222 * title: created_at
223 * - name: updated_at
224 * in: query
225 * description: Filter by a promotion's update date.
226 * required: false
227 * schema:
228 * type: object
229 * description: Filter by a promotion's update date.
230 * properties:
231 * $and:
232 * type: array
233 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
234 * items:
235 * type: object
236 * title: $and
237 * $or:
238 * type: array
239 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
240 * items:
241 * type: object
242 * title: $or
243 * $eq:
244 * oneOf:
245 * - type: string
246 * title: $eq
247 * description: Filter by an exact match.
248 * - type: array
249 * description: Filter by an exact match.
250 * items:
251 * type: string
252 * title: $eq
253 * description: Filter by an exact match.
254 * $ne:
255 * type: string
256 * title: $ne
257 * description: Filter by values not equal to this parameter.
258 * $in:
259 * type: array
260 * description: Filter by values in this array.
261 * items:
262 * type: string
263 * title: $in
264 * description: Filter by values in this array.
265 * $nin:
266 * type: array
267 * description: Filter by values not in this array.
268 * items:
269 * type: string
270 * title: $nin
271 * description: Filter by values not in this array.
272 * $not:
273 * oneOf:
274 * - type: string
275 * title: $not
276 * description: Filter by values not matching the conditions in this parameter.
277 * - type: object
278 * description: Filter by values not matching the conditions in this parameter.
279 * - type: array
280 * description: Filter by values not matching the conditions in this parameter.
281 * items:
282 * type: string
283 * title: $not
284 * description: Filter by values not matching the conditions in this parameter.
285 * $gt:
286 * type: string
287 * title: $gt
288 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
289 * $gte:
290 * type: string
291 * title: $gte
292 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
293 * $lt:
294 * type: string
295 * title: $lt
296 * description: Filter by values less than this parameter. Useful for numbers and dates only.
297 * $lte:
298 * type: string
299 * title: $lte
300 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
301 * $like:
302 * type: string
303 * title: $like
304 * description: Apply a `like` filter. Useful for strings only.
305 * $re:
306 * type: string
307 * title: $re
308 * description: Apply a regex filter. Useful for strings only.
309 * $ilike:
310 * type: string
311 * title: $ilike
312 * description: Apply a case-insensitive `like` filter. Useful for strings only.
313 * $fulltext:
314 * type: string
315 * title: $fulltext
316 * description: Filter to apply on full-text properties.
317 * $overlap:
318 * type: array
319 * description: Filter arrays that have overlapping values with this parameter.
320 * items:
321 * type: string
322 * title: $overlap
323 * description: Filter arrays that have overlapping values with this parameter.
324 * $contains:
325 * type: array
326 * description: Filter arrays that contain some of the values of this parameter.
327 * items:
328 * type: string
329 * title: $contains
330 * description: Filter arrays that contain some of the values of this parameter.
331 * $contained:
332 * type: array
333 * description: Filter arrays that contain all values of this parameter.
334 * items:
335 * type: string
336 * title: $contained
337 * description: Filter arrays that contain all values of this parameter.
338 * $exists:
339 * type: boolean
340 * title: $exists
341 * description: Filter by whether a value for this parameter exists (not `null`).
342 * title: updated_at
343 * - name: deleted_at
344 * in: query
345 * description: Filter by a promotion's deletion date.
346 * required: false
347 * schema:
348 * type: object
349 * description: Filter by a promotion's deletion date.
350 * properties:
351 * $and:
352 * type: array
353 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
354 * items:
355 * type: object
356 * title: $and
357 * $or:
358 * type: array
359 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
360 * items:
361 * type: object
362 * title: $or
363 * $eq:
364 * oneOf:
365 * - type: string
366 * title: $eq
367 * description: Filter by an exact match.
368 * - type: array
369 * description: Filter by an exact match.
370 * items:
371 * type: string
372 * title: $eq
373 * description: Filter by an exact match.
374 * $ne:
375 * type: string
376 * title: $ne
377 * description: Filter by values not equal to this parameter.
378 * $in:
379 * type: array
380 * description: Filter by values in this array.
381 * items:
382 * type: string
383 * title: $in
384 * description: Filter by values in this array.
385 * $nin:
386 * type: array
387 * description: Filter by values not in this array.
388 * items:
389 * type: string
390 * title: $nin
391 * description: Filter by values not in this array.
392 * $not:
393 * oneOf:
394 * - type: string
395 * title: $not
396 * description: Filter by values not matching the conditions in this parameter.
397 * - type: object
398 * description: Filter by values not matching the conditions in this parameter.
399 * - type: array
400 * description: Filter by values not matching the conditions in this parameter.
401 * items:
402 * type: string
403 * title: $not
404 * description: Filter by values not matching the conditions in this parameter.
405 * $gt:
406 * type: string
407 * title: $gt
408 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
409 * $gte:
410 * type: string
411 * title: $gte
412 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
413 * $lt:
414 * type: string
415 * title: $lt
416 * description: Filter by values less than this parameter. Useful for numbers and dates only.
417 * $lte:
418 * type: string
419 * title: $lte
420 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
421 * $like:
422 * type: string
423 * title: $like
424 * description: Apply a `like` filter. Useful for strings only.
425 * $re:
426 * type: string
427 * title: $re
428 * description: Apply a regex filter. Useful for strings only.
429 * $ilike:
430 * type: string
431 * title: $ilike
432 * description: Apply a case-insensitive `like` filter. Useful for strings only.
433 * $fulltext:
434 * type: string
435 * title: $fulltext
436 * description: Filter to apply on full-text properties.
437 * $overlap:
438 * type: array
439 * description: Filter arrays that have overlapping values with this parameter.
440 * items:
441 * type: string
442 * title: $overlap
443 * description: Filter arrays that have overlapping values with this parameter.
444 * $contains:
445 * type: array
446 * description: Filter arrays that contain some of the values of this parameter.
447 * items:
448 * type: string
449 * title: $contains
450 * description: Filter arrays that contain some of the values of this parameter.
451 * $contained:
452 * type: array
453 * description: Filter arrays that contain all values of this parameter.
454 * items:
455 * type: string
456 * title: $contained
457 * description: Filter arrays that contain all values of this parameter.
458 * $exists:
459 * type: boolean
460 * title: $exists
461 * description: Filter by whether a value for this parameter exists (not `null`).
462 * title: deleted_at
463 * - name: $and
464 * in: query
465 * required: false
466 * schema:
467 * type: array
468 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
469 * items:
470 * type: object
471 * title: $and
472 * - name: $or
473 * in: query
474 * required: false
475 * schema:
476 * type: array
477 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
478 * items:
479 * type: object
480 * title: $or
481 * - name: with_deleted
482 * in: query
483 * description: Whether to include deleted records in the result.
484 * required: false
485 * schema:
486 * type: boolean
487 * title: with_deleted
488 * description: Whether to include deleted records in the result.
489 * - name: id
490 * in: query
491 * required: false
492 * description: Filter by a promotion's ID.
493 * schema:
494 * oneOf:
495 * - type: string
496 * title: id
497 * description: Filter by a promotion's ID.
498 * - type: array
499 * description: Filter by promotion IDs.
500 * items:
501 * type: string
502 * title: id
503 * description: The promotion's ID.
504 * - type: object
505 * description: Filter by a promotion's ID.
506 * properties:
507 * $and:
508 * type: array
509 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
510 * items:
511 * type: object
512 * title: $and
513 * $or:
514 * type: array
515 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
516 * items:
517 * type: object
518 * title: $or
519 * $eq:
520 * oneOf:
521 * - type: string
522 * title: $eq
523 * description: Filter by an exact match.
524 * - type: array
525 * description: Filter by an exact match.
526 * items:
527 * type: string
528 * title: $eq
529 * description: Filter by an exact match.
530 * $ne:
531 * type: string
532 * title: $ne
533 * description: Filter by values not equal to this parameter.
534 * $in:
535 * type: array
536 * description: Filter by values in this array.
537 * items:
538 * type: string
539 * title: $in
540 * description: Filter by values in this array.
541 * $nin:
542 * type: array
543 * description: Filter by values not in this array.
544 * items:
545 * type: string
546 * title: $nin
547 * description: Filter by values not in this array.
548 * $not:
549 * oneOf:
550 * - type: string
551 * title: $not
552 * description: Filter by values not matching the conditions in this parameter.
553 * - type: object
554 * description: Filter by values not matching the conditions in this parameter.
555 * - type: array
556 * description: Filter by values not matching the conditions in this parameter.
557 * items:
558 * type: string
559 * title: $not
560 * description: Filter by values not matching the conditions in this parameter.
561 * $gt:
562 * type: string
563 * title: $gt
564 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
565 * $gte:
566 * type: string
567 * title: $gte
568 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
569 * $lt:
570 * type: string
571 * title: $lt
572 * description: Filter by values less than this parameter. Useful for numbers and dates only.
573 * $lte:
574 * type: string
575 * title: $lte
576 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
577 * $like:
578 * type: string
579 * title: $like
580 * description: Apply a `like` filter. Useful for strings only.
581 * $re:
582 * type: string
583 * title: $re
584 * description: Apply a regex filter. Useful for strings only.
585 * $ilike:
586 * type: string
587 * title: $ilike
588 * description: Apply a case-insensitive `like` filter. Useful for strings only.
589 * $fulltext:
590 * type: string
591 * title: $fulltext
592 * description: Filter to apply on full-text properties.
593 * $overlap:
594 * type: array
595 * description: Filter arrays that have overlapping values with this parameter.
596 * items:
597 * type: string
598 * title: $overlap
599 * description: Filter arrays that have overlapping values with this parameter.
600 * $contains:
601 * type: array
602 * description: Filter arrays that contain some of the values of this parameter.
603 * items:
604 * type: string
605 * title: $contains
606 * description: Filter arrays that contain some of the values of this parameter.
607 * $contained:
608 * type: array
609 * description: Filter arrays that contain all values of this parameter.
610 * items:
611 * type: string
612 * title: $contained
613 * description: Filter arrays that contain all values of this parameter.
614 * $exists:
615 * type: boolean
616 * title: $exists
617 * description: Filter by whether a value for this parameter exists (not `null`).
618 * security:
619 * - api_token: []
620 * - cookie_auth: []
621 * - jwt_token: []
622 * x-codeSamples:
623 * - lang: JavaScript
624 * label: JS SDK
625 * source: |-
626 * import Medusa from "@medusajs/js-sdk"
627 *
628 * export const sdk = new Medusa({
629 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
630 * debug: import.meta.env.DEV,
631 * auth: {
632 * type: "session",
633 * },
634 * })
635 *
636 * sdk.admin.promotion.list()
637 * .then(({ promotions, count, limit, offset }) => {
638 * console.log(promotions)
639 * })
640 * - lang: Shell
641 * label: cURL
642 * source: |-
643 * curl '{backend_url}/admin/promotions' \
644 * -H 'Authorization: Bearer {jwt_token}'
645 * tags:
646 * - Promotions
647 * responses:
648 * "200":
649 * description: OK
650 * content:
651 * application/json:
652 * schema:
653 * allOf:
654 * - type: object
655 * description: The paginated list of promotions.
656 * required:
657 * - limit
658 * - offset
659 * - count
660 * properties:
661 * limit:
662 * type: number
663 * title: limit
664 * description: The maximum number of items returned.
665 * offset:
666 * type: number
667 * title: offset
668 * description: The number of items skipped before retrieving the returned items.
669 * count:
670 * type: number
671 * title: count
672 * description: The total number of items.
673 * - type: object
674 * description: The paginated list of promotions.
675 * required:
676 * - promotions
677 * properties:
678 * promotions:
679 * type: array
680 * description: The list of promotions.
681 * items:
682 * $ref: "#/components/schemas/AdminPromotion"
683 * "400":
684 * $ref: "#/components/responses/400_error"
685 * "401":
686 * $ref: "#/components/responses/unauthorized"
687 * "404":
688 * $ref: "#/components/responses/not_found_error"
689 * "409":
690 * $ref: "#/components/responses/invalid_state_error"
691 * "422":
692 * $ref: "#/components/responses/invalid_request_error"
693 * "500":
694 * $ref: "#/components/responses/500_error"
695 *
696 */
697