1 /**
2 * @oas [post] /admin/reservations
3 * operationId: PostReservations
4 * summary: Create Reservation
5 * description: Create a reservation.
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 * security:
21 * - api_token: []
22 * - cookie_auth: []
23 * - jwt_token: []
24 * requestBody:
25 * content:
26 * application/json:
27 * schema:
28 * $ref: "#/components/schemas/AdminCreateReservation"
29 * x-codeSamples:
30 * - lang: JavaScript
31 * label: JS SDK
32 * source: |-
33 * import Medusa from "@medusajs/js-sdk"
34 *
35 * export const sdk = new Medusa({
36 * baseUrl: import.meta.env.VITE_BACKEND_URL || "/",
37 * debug: import.meta.env.DEV,
38 * auth: {
39 * type: "session",
40 * },
41 * })
42 *
43 * sdk.admin.reservation.create({
44 * inventory_item_id: "iitem_123",
45 * location_id: "sloc_123",
46 * quantity: 10,
47 * })
48 * .then(({ reservation }) => {
49 * console.log(reservation)
50 * })
51 * - lang: Shell
52 * label: cURL
53 * source: |-
54 * curl -X POST '{backend_url}/admin/reservations' \
55 * -H 'Authorization: Bearer {jwt_token}' \
56 * -H 'Content-Type: application/json' \
57 * --data-raw '{
58 * "line_item_id": "{value}",
59 * "location_id": "{value}",
60 * "inventory_item_id": "{value}",
61 * "quantity": 3268935814217728,
62 * "description": "{value}",
63 * "metadata": {}
64 * }'
65 * tags:
66 * - Reservations
67 * responses:
68 * "200":
69 * description: OK
70 * content:
71 * application/json:
72 * schema:
73 * $ref: "#/components/schemas/AdminReservationResponse"
74 * "400":
75 * $ref: "#/components/responses/400_error"
76 * "401":
77 * $ref: "#/components/responses/unauthorized"
78 * "404":
79 * $ref: "#/components/responses/not_found_error"
80 * "409":
81 * $ref: "#/components/responses/invalid_state_error"
82 * "422":
83 * $ref: "#/components/responses/invalid_request_error"
84 * "500":
85 * $ref: "#/components/responses/500_error"
86 * x-workflow: createReservationsWorkflow
87 * x-events:
88 * - name: reservation-item.created
89 * payload: |-
90 * ```ts
91 * {
92 * id, // The ID of the reservation
93 * order_id, // (optional) The ID of the order, if the reservation was created by an order flow
94 * }
95 * ```
96 * description: Emitted when reservations are created.
97 * deprecated: false
98 * since: 2.18.0
99 *
100 */
101