@medusajs/js-sdk 2.6.2-snapshot-20250328151043 → 2.7.0-preview-20250411080918

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@ export declare class DraftOrder {
24
24
  * To retrieve a draft order by its ID:
25
25
  *
26
26
  * ```ts
27
- * sdk.admin.draftOrder.retrieve("draft_order_123")
27
+ * sdk.admin.draftOrder.retrieve("order_123")
28
28
  * .then(({ draft_order }) => {
29
29
  * console.log(draft_order)
30
30
  * })
@@ -33,7 +33,7 @@ export declare class DraftOrder {
33
33
  * To specify the fields and relations to retrieve:
34
34
  *
35
35
  * ```ts
36
- * sdk.admin.draftOrder.retrieve("draft_order_123", {
36
+ * sdk.admin.draftOrder.retrieve("order_123", {
37
37
  * fields: "id,*items"
38
38
  * })
39
39
  * .then(({ draft_order }) => {
@@ -112,7 +112,7 @@ export declare class DraftOrder {
112
112
  * },
113
113
  * ],
114
114
  * region_id: "region_123",
115
- * sales_channel_id: "sales_channel_123",
115
+ * sales_channel_id: "sc_123",
116
116
  * })
117
117
  * .then(({ draft_order }) => {
118
118
  * console.log(draft_order)
@@ -133,7 +133,7 @@ export declare class DraftOrder {
133
133
  * To update a draft order:
134
134
  *
135
135
  * ```ts
136
- * sdk.admin.draftOrder.update("draft_order_123", {
136
+ * sdk.admin.draftOrder.update("order_123", {
137
137
  * email: "test@test.com",
138
138
  * })
139
139
  * .then(({ draft_order }) => {
@@ -142,5 +142,286 @@ export declare class DraftOrder {
142
142
  * ```
143
143
  */
144
144
  update(id: string, body: HttpTypes.AdminUpdateDraftOrder, query?: HttpTypes.AdminDraftOrderParams, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderResponse>;
145
+ /**
146
+ * This method converts a draft order to an order. It sends a request to the
147
+ * [Convert Draft Order to Order](https://docs.medusajs.com/api/admin#draft-orders_postdraftordersidconvert-to-order) API route.
148
+ *
149
+ * @param id - The draft order's ID.
150
+ * @param query - Configure the fields to retrieve in the order.
151
+ * @param headers - Headers to pass in the request.
152
+ *
153
+ * @example
154
+ * To convert a draft order to an order:
155
+ *
156
+ * ```ts
157
+ * sdk.admin.draftOrder.convertToOrder("order_123")
158
+ * .then(({ order }) => {
159
+ * console.log(order)
160
+ * })
161
+ */
162
+ convertToOrder(id: string, query?: HttpTypes.AdminDraftOrderParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderResponse>;
163
+ /**
164
+ * This method adds items to a draft order. It sends a request to the
165
+ * [Add Draft Order Items](https://docs.medusajs.com/api/admin#draft-orders_postordereditsiditems) API route.
166
+ *
167
+ * @param id - The draft order's ID.
168
+ * @param body - The data to add the items to the draft order.
169
+ * @param headers - Headers to pass in the request.
170
+ *
171
+ * @example
172
+ * To add items to a draft order:
173
+ *
174
+ * ```ts
175
+ * sdk.admin.draftOrder.addItems("order_123", {
176
+ * items: [
177
+ * {
178
+ * variant_id: "variant_123",
179
+ * quantity: 1,
180
+ * },
181
+ * ],
182
+ * })
183
+ * .then(({ draft_order_preview }) => {
184
+ * console.log(draft_order_preview)
185
+ * })
186
+ * ```
187
+ */
188
+ addItems(id: string, body: HttpTypes.AdminAddDraftOrderItems, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
189
+ /**
190
+ * This method updates an item that is part of an action in a draft order. It sends a request to the
191
+ * [Update Draft Order Item](https://docs.medusajs.com/api/admin#draft-orders_postordereditsiditemsaction_id) API route.
192
+ *
193
+ * @param id - The draft order's ID.
194
+ * @param actionId - The action ID.
195
+ * @param body - The data to update the item.
196
+ * @param headers - Headers to pass in the request.
197
+ *
198
+ * @example
199
+ * To update an item that is part of an action in a draft order:
200
+ *
201
+ * ```ts
202
+ * sdk.admin.draftOrder.updateActionItem("order_123", "action_123", {
203
+ * quantity: 2,
204
+ * })
205
+ * .then(({ draft_order_preview }) => {
206
+ * console.log(draft_order_preview)
207
+ * })
208
+ * ```
209
+ */
210
+ updateActionItem(id: string, actionId: string, body: HttpTypes.AdminUpdateDraftOrderItem, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
211
+ /**
212
+ * This method removes an item that is part of an action in a draft order. It sends a request to the
213
+ * [Remove Draft Order Item](https://docs.medusajs.com/api/admin#draft-orders_deleteordereditsiditemsaction_id) API route.
214
+ *
215
+ * @param id - The draft order's ID.
216
+ * @param actionId - The action ID.
217
+ * @param headers - Headers to pass in the request.
218
+ *
219
+ * @example
220
+ * To remove an item that is part of an action in a draft order:
221
+ *
222
+ * ```ts
223
+ * sdk.admin.draftOrder.removeActionItem("order_123", "action_123")
224
+ * .then(({ draft_order_preview }) => {
225
+ * console.log(draft_order_preview)
226
+ * })
227
+ * ```
228
+ */
229
+ removeActionItem(id: string, actionId: string, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
230
+ /**
231
+ * This method updates an item in a draft order. It sends a request to the
232
+ * [Update Draft Order Item](https://docs.medusajs.com/api/admin#draft-orders_postordereditsiditemsitem_id) API route.
233
+ *
234
+ * @param id - The draft order's ID.
235
+ * @param itemId - The item ID.
236
+ * @param body - The data to update the item.
237
+ * @param headers - Headers to pass in the request.
238
+ *
239
+ * @example
240
+ * To update an item in a draft order:
241
+ *
242
+ * ```ts
243
+ * sdk.admin.draftOrder.updateItem("order_123", "item_123", {
244
+ * quantity: 2,
245
+ * })
246
+ * .then(({ draft_order_preview }) => {
247
+ * console.log(draft_order_preview)
248
+ * })
249
+ * ```
250
+ */
251
+ updateItem(id: string, itemId: string, body: HttpTypes.AdminUpdateDraftOrderItem, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
252
+ /**
253
+ * This method adds promotions to a draft order. It sends a request to the
254
+ * [Add Draft Order Promotions](https://docs.medusajs.com/api/admin#draft-orders_postordereditsidpromotions) API route.
255
+ *
256
+ * @param id - The draft order's ID.
257
+ * @param body - The data to add the promotions to the draft order.
258
+ * @param headers - Headers to pass in the request.
259
+ *
260
+ * @example
261
+ * To add promotions to a draft order:
262
+ *
263
+ * ```ts
264
+ * sdk.admin.draftOrder.addPromotions("order_123", {
265
+ * promo_codes: ["PROMO_CODE_1", "PROMO_CODE_2"],
266
+ * })
267
+ * .then(({ draft_order_preview }) => {
268
+ * console.log(draft_order_preview)
269
+ * })
270
+ * ```
271
+ */
272
+ addPromotions(id: string, body: HttpTypes.AdminAddDraftOrderPromotions, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
273
+ /**
274
+ * This method removes promotions from a draft order. It sends a request to the
275
+ * [Remove Draft Order Promotions](https://docs.medusajs.com/api/admin#draft-orders_deleteordereditsidpromotions) API route.
276
+ *
277
+ * @param id - The draft order's ID.
278
+ * @param body - The data to remove the promotions from the draft order.
279
+ * @param headers - Headers to pass in the request.
280
+ *
281
+ * @example
282
+ * To remove promotions from a draft order:
283
+ *
284
+ * ```ts
285
+ * sdk.admin.draftOrder.removePromotions("order_123", {
286
+ * promo_codes: ["PROMO_CODE_1", "PROMO_CODE_2"],
287
+ * })
288
+ * ```
289
+ */
290
+ removePromotions(id: string, body: HttpTypes.AdminRemoveDraftOrderPromotions, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
291
+ /**
292
+ * This method adds a shipping method to a draft order. It sends a request to the
293
+ * [Add Draft Order Shipping Method](https://docs.medusajs.com/api/admin#draft-orders_postordereditsidshipping-methods) API route.
294
+ *
295
+ * @param id - The draft order's ID.
296
+ * @param body - The data to add the shipping method to the draft order.
297
+ * @param headers - Headers to pass in the request.
298
+ *
299
+ * @example
300
+ * To add a shipping method to a draft order:
301
+ *
302
+ * ```ts
303
+ * sdk.admin.draftOrder.addShippingMethod("order_123", {
304
+ * shipping_option_id: "shipping_option_123",
305
+ * })
306
+ * .then(({ draft_order_preview }) => {
307
+ * console.log(draft_order_preview)
308
+ * })
309
+ * ```
310
+ */
311
+ addShippingMethod(id: string, body: HttpTypes.AdminAddDraftOrderShippingMethod, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
312
+ /**
313
+ * This method updates a shipping method in a draft order. It sends a request to the
314
+ * [Update Draft Order Shipping Method](https://docs.medusajs.com/api/admin#draft-orders_postordereditsidshipping-methodsaction_id) API route.
315
+ *
316
+ * @param id - The draft order's ID.
317
+ * @param actionId - The action ID.
318
+ * @param body - The data to update the shipping method.
319
+ * @param headers - Headers to pass in the request.
320
+ *
321
+ * @example
322
+ * To update a shipping method in a draft order:
323
+ *
324
+ * ```ts
325
+ * sdk.admin.draftOrder.updateShippingMethod("order_123", "action_123", {
326
+ * shipping_option_id: "shipping_option_123",
327
+ * })
328
+ * .then(({ draft_order_preview }) => {
329
+ * console.log(draft_order_preview)
330
+ * })
331
+ * ```
332
+ */
333
+ updateActionShippingMethod(id: string, actionId: string, body: HttpTypes.AdminUpdateDraftOrderActionShippingMethod, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
334
+ /**
335
+ * This method removes a shipping method from a draft order. It sends a request to the
336
+ * [Remove Draft Order Shipping Method](https://docs.medusajs.com/api/admin#draft-orders_deleteordereditsidshipping-methodsaction_id) API route.
337
+ *
338
+ * @param id - The draft order's ID.
339
+ * @param actionId - The action ID.
340
+ * @param headers - Headers to pass in the request.
341
+ *
342
+ * @example
343
+ * To remove a shipping method from a draft order:
344
+ *
345
+ * ```ts
346
+ * sdk.admin.draftOrder.removeShippingMethod("order_123", "action_123")
347
+ * .then(({ draft_order_preview }) => {
348
+ * console.log(draft_order_preview)
349
+ * })
350
+ * ```
351
+ */
352
+ removeActionShippingMethod(id: string, actionId: string, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
353
+ updateShippingMethod(id: string, methodId: string, body: HttpTypes.AdminUpdateDraftOrderShippingMethod, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
354
+ /**
355
+ * This method begins an edit to a draft order. It sends a request to the
356
+ * [Begin Draft Order Edit](https://docs.medusajs.com/api/admin#draft-orders_postordereditsid) API route.
357
+ *
358
+ * @param id - The draft order's ID.
359
+ * @param headers - Headers to pass in the request.
360
+ *
361
+ * @example
362
+ * To begin an edit to a draft order:
363
+ *
364
+ * ```ts
365
+ * sdk.admin.draftOrder.beginEdit("order_123")
366
+ * .then(({ draft_order_preview }) => {
367
+ * console.log(draft_order_preview)
368
+ * })
369
+ * ```
370
+ */
371
+ beginEdit(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
372
+ /**
373
+ * This method cancels an edit to a draft order. It sends a request to the
374
+ * [Cancel Draft Order Edit](https://docs.medusajs.com/api/admin#draft-orders_deleteordereditsid) API route.
375
+ *
376
+ * @param id - The draft order's ID.
377
+ * @param headers - Headers to pass in the request.
378
+ *
379
+ * @example
380
+ * To cancel an edit to a draft order:
381
+ *
382
+ * ```ts
383
+ * sdk.admin.draftOrder.cancelEdit("order_123")
384
+ * .then(({ id, object, deleted }) => {
385
+ * console.log(id, object, deleted)
386
+ * })
387
+ * ```
388
+ */
389
+ cancelEdit(id: string, headers?: ClientHeaders): Promise<HttpTypes.DeleteResponse<"draft-order-edit">>;
390
+ /**
391
+ * This method requests an edit to a draft order. It sends a request to the
392
+ * [Request Draft Order Edit](https://docs.medusajs.com/api/admin#draft-orders_postordereditsidrequest) API route.
393
+ *
394
+ * @param id - The draft order's ID.
395
+ * @param headers - Headers to pass in the request.
396
+ *
397
+ * @example
398
+ * To request an edit to a draft order:
399
+ *
400
+ * ```ts
401
+ * sdk.admin.draftOrder.requestEdit("order_123")
402
+ * .then(({ draft_order_preview }) => {
403
+ * console.log(draft_order_preview)
404
+ * })
405
+ * ```
406
+ */
407
+ requestEdit(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
408
+ /**
409
+ * This method confirms an edit to a draft order. It sends a request to the
410
+ * [Confirm Draft Order Edit](https://docs.medusajs.com/api/admin#draft-orders_postordereditsidconfirm) API route.
411
+ *
412
+ * @param id - The draft order's ID.
413
+ * @param headers - Headers to pass in the request.
414
+ *
415
+ * @example
416
+ * To confirm an edit to a draft order:
417
+ *
418
+ * ```ts
419
+ * sdk.admin.draftOrder.confirmEdit("order_123")
420
+ * .then(({ draft_order_preview }) => {
421
+ * console.log(draft_order_preview)
422
+ * })
423
+ * ```
424
+ */
425
+ confirmEdit(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminDraftOrderPreviewResponse>;
145
426
  }
146
427
  //# sourceMappingURL=draft-order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"draft-order.d.ts","sourceRoot":"","sources":["../../src/admin/draft-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,UAAU;IACrB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,WAAW,CAAC,EAAE,SAAS,CAAC,yBAAyB,EACjD,OAAO,CAAC,EAAE,aAAa;IAWzB;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,qBAAqB,EACrC,KAAK,CAAC,EAAE,SAAS,CAAC,qBAAqB,EACvC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,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