1 /**
2 * @oas [get] /admin/stock-locations
3 * operationId: GetStockLocations
4 * summary: List Stock Locations
5 * description: Retrieve a list of stock locations. The stock locations can be filtered by fields such as `id`. The stock locations 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 stock location's searchable properties.
51 * required: false
52 * schema:
53 * type: string
54 * title: q
55 * description: Search term to filter the stock location's searchable properties.
56 * - name: id
57 * in: query
58 * required: false
59 * schema:
60 * oneOf:
61 * - type: string
62 * title: id
63 * description: Filter by a stock location ID.
64 * - type: array
65 * description: Filter by stock location IDs.
66 * items:
67 * type: string
68 * title: id
69 * description: A stock location ID.
70 * - name: name
71 * in: query
72 * required: false
73 * schema:
74 * oneOf:
75 * - type: string
76 * title: name
77 * description: Filter by a stock location name.
78 * - type: array
79 * description: Filter by stock location names.
80 * items:
81 * type: string
82 * title: name
83 * description: A stock location name.
84 * - name: address_id
85 * in: query
86 * required: false
87 * schema:
88 * oneOf:
89 * - type: string
90 * title: address_id
91 * description: Filter by an address ID to retrieve its associated locations.
92 * - type: array
93 * description: Filter by address IDs to retrieve their associated locations.
94 * items:
95 * type: string
96 * title: address_id
97 * description: An address ID.
98 * - name: sales_channel_id
99 * in: query
100 * required: false
101 * schema:
102 * oneOf:
103 * - type: string
104 * title: sales_channel_id
105 * description: Filter by a sales channel ID to retrieve its associated locations.
106 * - type: array
107 * description: Filter by sales channel IDs to retrieve their associated locations.
108 * items:
109 * type: string
110 * title: sales_channel_id
111 * description: A sales channel ID
112 * - name: created_at
113 * in: query
114 * description: Filter by a stock location's creation date.
115 * required: false
116 * schema:
117 * type: object
118 * description: Filter by a stock location's creation date.
119 * properties:
120 * $and:
121 * type: array
122 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
123 * items:
124 * type: object
125 * title: $and
126 * $or:
127 * type: array
128 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
129 * items:
130 * type: object
131 * title: $or
132 * $eq:
133 * oneOf:
134 * - type: string
135 * title: $eq
136 * description: Filter by an exact match.
137 * - type: array
138 * description: Filter by an exact match.
139 * items:
140 * type: string
141 * title: $eq
142 * description: Filter by an exact match.
143 * $ne:
144 * type: string
145 * title: $ne
146 * description: Filter by values not equal to this parameter.
147 * $in:
148 * type: array
149 * description: Filter by values in this array.
150 * items:
151 * type: string
152 * title: $in
153 * description: Filter by values in this array.
154 * $nin:
155 * type: array
156 * description: Filter by values not in this array.
157 * items:
158 * type: string
159 * title: $nin
160 * description: Filter by values not in this array.
161 * $not:
162 * oneOf:
163 * - type: string
164 * title: $not
165 * description: Filter by values not matching the conditions in this parameter.
166 * - type: object
167 * description: Filter by values not matching the conditions in this parameter.
168 * - type: array
169 * description: Filter by values not matching the conditions in this parameter.
170 * items:
171 * type: string
172 * title: $not
173 * description: Filter by values not matching the conditions in this parameter.
174 * $gt:
175 * type: string
176 * title: $gt
177 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
178 * $gte:
179 * type: string
180 * title: $gte
181 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
182 * $lt:
183 * type: string
184 * title: $lt
185 * description: Filter by values less than this parameter. Useful for numbers and dates only.
186 * $lte:
187 * type: string
188 * title: $lte
189 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
190 * $like:
191 * type: string
192 * title: $like
193 * description: Apply a `like` filter. Useful for strings only.
194 * $re:
195 * type: string
196 * title: $re
197 * description: Apply a regex filter. Useful for strings only.
198 * $ilike:
199 * type: string
200 * title: $ilike
201 * description: Apply a case-insensitive `like` filter. Useful for strings only.
202 * $fulltext:
203 * type: string
204 * title: $fulltext
205 * description: Filter to apply on full-text properties.
206 * $overlap:
207 * type: array
208 * description: Filter arrays that have overlapping values with this parameter.
209 * items:
210 * type: string
211 * title: $overlap
212 * description: Filter arrays that have overlapping values with this parameter.
213 * $contains:
214 * type: array
215 * description: Filter arrays that contain some of the values of this parameter.
216 * items:
217 * type: string
218 * title: $contains
219 * description: Filter arrays that contain some of the values of this parameter.
220 * $contained:
221 * type: array
222 * description: Filter arrays that contain all values of this parameter.
223 * items:
224 * type: string
225 * title: $contained
226 * description: Filter arrays that contain all values of this parameter.
227 * $exists:
228 * type: boolean
229 * title: $exists
230 * description: Filter by whether a value for this parameter exists (not `null`).
231 * title: created_at
232 * - name: updated_at
233 * in: query
234 * description: Filter by a stock location's update date.
235 * required: false
236 * schema:
237 * type: object
238 * description: Filter by a stock location's update date.
239 * properties:
240 * $and:
241 * type: array
242 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
243 * items:
244 * type: object
245 * title: $and
246 * $or:
247 * type: array
248 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
249 * items:
250 * type: object
251 * title: $or
252 * $eq:
253 * oneOf:
254 * - type: string
255 * title: $eq
256 * description: Filter by an exact match.
257 * - type: array
258 * description: Filter by an exact match.
259 * items:
260 * type: string
261 * title: $eq
262 * description: Filter by an exact match.
263 * $ne:
264 * type: string
265 * title: $ne
266 * description: Filter by values not equal to this parameter.
267 * $in:
268 * type: array
269 * description: Filter by values in this array.
270 * items:
271 * type: string
272 * title: $in
273 * description: Filter by values in this array.
274 * $nin:
275 * type: array
276 * description: Filter by values not in this array.
277 * items:
278 * type: string
279 * title: $nin
280 * description: Filter by values not in this array.
281 * $not:
282 * oneOf:
283 * - type: string
284 * title: $not
285 * description: Filter by values not matching the conditions in this parameter.
286 * - type: object
287 * description: Filter by values not matching the conditions in this parameter.
288 * - type: array
289 * description: Filter by values not matching the conditions in this parameter.
290 * items:
291 * type: string
292 * title: $not
293 * description: Filter by values not matching the conditions in this parameter.
294 * $gt:
295 * type: string
296 * title: $gt
297 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
298 * $gte:
299 * type: string
300 * title: $gte
301 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
302 * $lt:
303 * type: string
304 * title: $lt
305 * description: Filter by values less than this parameter. Useful for numbers and dates only.
306 * $lte:
307 * type: string
308 * title: $lte
309 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
310 * $like:
311 * type: string
312 * title: $like
313 * description: Apply a `like` filter. Useful for strings only.
314 * $re:
315 * type: string
316 * title: $re
317 * description: Apply a regex filter. Useful for strings only.
318 * $ilike:
319 * type: string
320 * title: $ilike
321 * description: Apply a case-insensitive `like` filter. Useful for strings only.
322 * $fulltext:
323 * type: string
324 * title: $fulltext
325 * description: Filter to apply on full-text properties.
326 * $overlap:
327 * type: array
328 * description: Filter arrays that have overlapping values with this parameter.
329 * items:
330 * type: string
331 * title: $overlap
332 * description: Filter arrays that have overlapping values with this parameter.
333 * $contains:
334 * type: array
335 * description: Filter arrays that contain some of the values of this parameter.
336 * items:
337 * type: string
338 * title: $contains
339 * description: Filter arrays that contain some of the values of this parameter.
340 * $contained:
341 * type: array
342 * description: Filter arrays that contain all values of this parameter.
343 * items:
344 * type: string
345 * title: $contained
346 * description: Filter arrays that contain all values of this parameter.
347 * $exists:
348 * type: boolean
349 * title: $exists
350 * description: Filter by whether a value for this parameter exists (not `null`).
351 * title: updated_at
352 * - name: deleted_at
353 * in: query
354 * description: Filter by a stock location's deletion date.
355 * required: false
356 * schema:
357 * type: object
358 * description: Filter by a stock location's deletion date.
359 * properties:
360 * $and:
361 * type: array
362 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
363 * items:
364 * type: object
365 * title: $and
366 * $or:
367 * type: array
368 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
369 * items:
370 * type: object
371 * title: $or
372 * $eq:
373 * oneOf:
374 * - type: string
375 * title: $eq
376 * description: Filter by an exact match.
377 * - type: array
378 * description: Filter by an exact match.
379 * items:
380 * type: string
381 * title: $eq
382 * description: Filter by an exact match.
383 * $ne:
384 * type: string
385 * title: $ne
386 * description: Filter by values not equal to this parameter.
387 * $in:
388 * type: array
389 * description: Filter by values in this array.
390 * items:
391 * type: string
392 * title: $in
393 * description: Filter by values in this array.
394 * $nin:
395 * type: array
396 * description: Filter by values not in this array.
397 * items:
398 * type: string
399 * title: $nin
400 * description: Filter by values not in this array.
401 * $not:
402 * oneOf:
403 * - type: string
404 * title: $not
405 * description: Filter by values not matching the conditions in this parameter.
406 * - type: object
407 * description: Filter by values not matching the conditions in this parameter.
408 * - type: array
409 * description: Filter by values not matching the conditions in this parameter.
410 * items:
411 * type: string
412 * title: $not
413 * description: Filter by values not matching the conditions in this parameter.
414 * $gt:
415 * type: string
416 * title: $gt
417 * description: Filter by values greater than this parameter. Useful for numbers and dates only.
418 * $gte:
419 * type: string
420 * title: $gte
421 * description: Filter by values greater than or equal to this parameter. Useful for numbers and dates only.
422 * $lt:
423 * type: string
424 * title: $lt
425 * description: Filter by values less than this parameter. Useful for numbers and dates only.
426 * $lte:
427 * type: string
428 * title: $lte
429 * description: Filter by values less than or equal to this parameter. Useful for numbers and dates only.
430 * $like:
431 * type: string
432 * title: $like
433 * description: Apply a `like` filter. Useful for strings only.
434 * $re:
435 * type: string
436 * title: $re
437 * description: Apply a regex filter. Useful for strings only.
438 * $ilike:
439 * type: string
440 * title: $ilike
441 * description: Apply a case-insensitive `like` filter. Useful for strings only.
442 * $fulltext:
443 * type: string
444 * title: $fulltext
445 * description: Filter to apply on full-text properties.
446 * $overlap:
447 * type: array
448 * description: Filter arrays that have overlapping values with this parameter.
449 * items:
450 * type: string
451 * title: $overlap
452 * description: Filter arrays that have overlapping values with this parameter.
453 * $contains:
454 * type: array
455 * description: Filter arrays that contain some of the values of this parameter.
456 * items:
457 * type: string
458 * title: $contains
459 * description: Filter arrays that contain some of the values of this parameter.
460 * $contained:
461 * type: array
462 * description: Filter arrays that contain all values of this parameter.
463 * items:
464 * type: string
465 * title: $contained
466 * description: Filter arrays that contain all values of this parameter.
467 * $exists:
468 * type: boolean
469 * title: $exists
470 * description: Filter by whether a value for this parameter exists (not `null`).
471 * title: deleted_at
472 * - name: $and
473 * in: query
474 * required: false
475 * schema:
476 * type: array
477 * description: Join query parameters with an AND condition. Each object's content is the same type as the expected query parameters.
478 * items:
479 * type: object
480 * title: $and
481 * - name: $or
482 * in: query
483 * required: false
484 * schema:
485 * type: array
486 * description: Join query parameters with an OR condition. Each object's content is the same type as the expected query parameters.
487 * items:
488 * type: object
489 * title: $or
490 * - name: with_deleted
491 * in: query
492 * description: Whether to include deleted records in the result.
493 * required: false
494 * schema:
495 * type: boolean
496 * title: with_deleted
497 * description: Whether to include deleted records in the result.
498 * security:
499 * - api_token: []
500 * - cookie_auth: []
501 * - jwt_token: []
502 * x-codeSamples:
503 * - lang: JavaScript
504 * label: JS SDK
505 * source: |-
506 * import Medusa from "@medusajs/js-sdk"
507 *
508 * export const sdk = new Medusa({
509 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
510 * debug: import.meta.env.DEV,
511 * auth: {
512 * type: "session",
513 * },
514 * })
515 *
516 * sdk.admin.stockLocation.list()
517 * .then(({ stock_locations, count, limit, offset }) => {
518 * console.log(stock_locations)
519 * })
520 * - lang: Shell
521 * label: cURL
522 * source: |-
523 * curl '{backend_url}/admin/stock-locations' \
524 * -H 'Authorization: Bearer {jwt_token}'
525 * tags:
526 * - Stock Locations
527 * responses:
528 * "200":
529 * description: OK
530 * content:
531 * application/json:
532 * schema:
533 * $ref: "#/components/schemas/AdminStockLocationListResponse"
534 * "400":
535 * $ref: "#/components/responses/400_error"
536 * "401":
537 * $ref: "#/components/responses/unauthorized"
538 * "404":
539 * $ref: "#/components/responses/not_found_error"
540 * "409":
541 * $ref: "#/components/responses/invalid_state_error"
542 * "422":
543 * $ref: "#/components/responses/invalid_request_error"
544 * "500":
545 * $ref: "#/components/responses/500_error"
546 *
547 */
548