1 /**
2 * @oas [get] /admin/campaigns
3 * operationId: GetCampaigns
4 * summary: List Campaigns
5 * description: Retrieve a list of campaigns. The campaigns can be filtered by fields such as `id`. The campaigns 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: with_deleted
49 * in: query
50 * description: Whether to include deleted records in the result.
51 * required: false
52 * schema:
53 * type: boolean
54 * title: with_deleted
55 * description: Whether to include deleted records in the result.
56 * - name: q
57 * in: query
58 * description: Apply a search query to the campaign's searchable properties.
59 * required: false
60 * schema:
61 * type: string
62 * title: q
63 * description: Apply a search query to the campaign's searchable properties.
64 * - name: campaign_identifier
65 * in: query
66 * description: Filter by a campaign identifier.
67 * required: false
68 * schema:
69 * type: string
70 * title: campaign_identifier
71 * description: Filter by a campaign identifier.
72 * - name: budget
73 * in: query
74 * description: Filter by the campaign's budget.
75 * required: false
76 * schema:
77 * type: object
78 * description: Filter by the campaign's budget.
79 * properties:
80 * currency_code:
81 * type: string
82 * title: currency_code
83 * description: The budget's currency code.
84 * example: usd
85 * - name: $and
86 * in: query
87 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
88 * required: false
89 * schema:
90 * type: array
91 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
92 * items:
93 * type: object
94 * title: $and
95 * - name: $or
96 * in: query
97 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
98 * required: false
99 * schema:
100 * type: array
101 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
102 * items:
103 * type: object
104 * title: $or
105 * security:
106 * - api_token: []
107 * - cookie_auth: []
108 * - jwt_token: []
109 * x-codeSamples:
110 * - lang: JavaScript
111 * label: JS SDK
112 * source: |-
113 * import Medusa from "@medusajs/js-sdk"
114 *
115 * export const sdk = new Medusa({
116 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
117 * debug: import.meta.env.DEV,
118 * auth: {
119 * type: "session",
120 * },
121 * })
122 *
123 * sdk.admin.campaign.list()
124 * .then(({ campaigns, count, limit, offset }) => {
125 * console.log(campaigns)
126 * })
127 * - lang: Shell
128 * label: cURL
129 * source: |-
130 * curl '{backend_url}/admin/campaigns' \
131 * -H 'Authorization: Bearer {jwt_token}'
132 * tags:
133 * - Campaigns
134 * responses:
135 * "200":
136 * description: OK
137 * content:
138 * application/json:
139 * schema:
140 * allOf:
141 * - type: object
142 * description: The paginated list of campaigns.
143 * required:
144 * - limit
145 * - offset
146 * - count
147 * properties:
148 * limit:
149 * type: number
150 * title: limit
151 * description: The maximum number of items retrieved.
152 * offset:
153 * type: number
154 * title: offset
155 * description: The number of its skipped before the returned items.
156 * count:
157 * type: number
158 * title: count
159 * description: The total number of items.
160 * - type: object
161 * description: The list of campaigns
162 * required:
163 * - campaigns
164 * properties:
165 * campaigns:
166 * type: array
167 * description: The list of campaigns.
168 * items:
169 * $ref: "#/components/schemas/CampaignResponse"
170 * "400":
171 * $ref: "#/components/responses/400_error"
172 * "401":
173 * $ref: "#/components/responses/unauthorized"
174 * "404":
175 * $ref: "#/components/responses/not_found_error"
176 * "409":
177 * $ref: "#/components/responses/invalid_state_error"
178 * "422":
179 * $ref: "#/components/responses/invalid_request_error"
180 * "500":
181 * $ref: "#/components/responses/500_error"
182 *
183 */
184