1 import { HttpTypes } from "@medusajs/types"
2
3 import { Client } from "../client.js"
4 import { ClientHeaders } from "../types.js"
5
6 export class Claim {
7 /**
8 * @ignore
9 */
10 private client: Client
11 /**
12 * @ignore
13 */
14 constructor(client: Client) {
15 this.client = client
16 }
17
18 /**
19 * This method retrieves a paginated list of claims. It sends a request to the
20 * [List Claims](https://docs.medusajs.com/api/admin/claims/list-claims) API route.
21 *
22 * @param query - Filters and pagination configurations.
23 * @param headers - Headers to pass in the request.
24 * @returns The paginated list of claims.
25 *
26 * @example
27 * To retrieve the list of claims:
28 *
29 * ```ts
30 * sdk.admin.claim.list()
31 * .then(({ claims, count, limit, offset }) => {
32 * console.log(claims)
33 * })
34 * ```
35 *
36 * To configure the pagination, pass the `limit` and `offset` query parameters.
37 *
38 * For example, to retrieve only 10 items and skip 10 items:
39 *
40 * ```ts
41 * sdk.admin.claim.list({
42 * limit: 10,
43 * offset: 10
44 * })
45 * .then(({ claims, count, limit, offset }) => {
46 * console.log(claims)
47 * })
48 * ```
49 *
50 * Using the `fields` query parameter, you can specify the fields and relations to retrieve
51 * in each claim:
52 *
53 * ```ts
54 * sdk.admin.claim.list({
55 * fields: "id,*additional_items"
56 * })
57 * .then(({ claims, count, limit, offset }) => {
58 * console.log(claims)
59 * })
60 * ```
61 *
62 * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store/select-fields-and-relations).
63 */
64 async list(query?: HttpTypes.AdminClaimListParams, headers?: ClientHeaders) {
65 return await this.client.fetch<HttpTypes.AdminClaimListResponse>(
66 `/admin/claims`,
67 {
68 query,
69 headers,
70 }
71 )
72 }
73
74 /**
75 * This method retrieves a claim. It sends a request to the
76 * [Get Claim](https://docs.medusajs.com/api/admin/claims/get-a-claim) API route.
77 *
78 * @param id - The claim's ID.
79 * @param query - Configure the fields to retrieve in the claim.
80 * @param headers - Headers to pass in the request
81 * @returns The claim's details.
82 *
83 * @example
84 * To retrieve a claim by its ID:
85 *
86 * ```ts
87 * sdk.admin.claim.retrieve("claim_123")
88 * .then(({ claim }) => {
89 * console.log(claim)
90 * })
91 * ```
92 *
93 * To specify the fields and relations to retrieve:
94 *
95 * ```ts
96 * sdk.admin.claim.retrieve("claim_123", {
97 * fields: "id,*additional_items"
98 * })
99 * .then(({ claim }) => {
100 * console.log(claim)
101 * })
102 * ```
103 *
104 * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store/select-fields-and-relations).
105 */
106 async retrieve(
107 id: string,
108 query?: HttpTypes.SelectParams,
109 headers?: ClientHeaders
110 ) {
111 return await this.client.fetch<HttpTypes.AdminClaimResponse>(
112 `/admin/claims/${id}`,
113 {
114 query,
115 headers,
116 }
117 )
118 }
119
120 /**
121 * This method creates a claim. It sends a request to the
122 * [Create Claim](https://docs.medusajs.com/api/admin/claims/create-a-claim) API route.
123 *
124 * @param body - The claim's details.
125 * @param query - Configure the fields to retrieve in the claim.
126 * @param headers - Headers to pass in the request
127 * @returns The claim and order's details.
128 *
129 * @example
130 * sdk.admin.claim.create({
131 * type: "refund",
132 * order_id: "order_123",
133 * })
134 * .then(({ claim }) => {
135 * console.log(claim)
136 * })
137 */
138 async create(
139 body: HttpTypes.AdminCreateClaim,
140 query?: HttpTypes.SelectParams,
141 headers?: ClientHeaders
142 ) {
143 return await this.client.fetch<HttpTypes.AdminClaimOrderResponse>(
144 `/admin/claims`,
145 {
146 method: "POST",
147 headers,
148 body,
149 query,
150 }
151 )
152 }
153
154 /**
155 * This method cancels a claim. It sends a request to the
156 * [Cancel Claim](https://docs.medusajs.com/api/admin/claims/cancel-a-claim) API route.
157 *
158 * @param id - The claim's ID.
159 * @param query - Configure the fields to retrieve in the claim.
160 * @param headers - Headers to pass in the request
161 * @returns The claim's details.
162 *
163 * @example
164 * sdk.admin.claim.cancel("claim_123")
165 * .then(({ claim }) => {
166 * console.log(claim)
167 * })
168 */
169 async cancel(
170 id: string,
171 query?: HttpTypes.SelectParams,
172 headers?: ClientHeaders
173 ) {
174 return await this.client.fetch<HttpTypes.AdminClaimResponse>(
175 `/admin/claims/${id}/cancel`,
176 {
177 method: "POST",
178 headers,
179 query,
180 }
181 )
182 }
183
184 /**
185 * This method adds items to the claim. It sends a request to the
186 * [Add Items](https://docs.medusajs.com/api/admin/claims/add-claim-items) API route.
187 *
188 * @param id - The ID of the claim to add the items to.
189 * @param body - The items' details.
190 * @param query - Configure the fields to retrieve in the claim.
191 * @param headers - Headers to pass in the request
192 * @returns The claim's details with a preview of the order when the claim is applied.
193 *
194 * @example
195 * sdk.admin.claim.addItems("claim_123", {
196 * items: [
197 * {
198 * id: "orli_123",
199 * quantity: 1
200 * }
201 * ]
202 * })
203 * .then(({ claim }) => {
204 * console.log(claim)
205 * })
206 */
207 async addItems(
208 id: string,
209 body: HttpTypes.AdminAddClaimItems,
210 query?: HttpTypes.SelectParams,
211 headers?: ClientHeaders
212 ) {
213 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
214 `/admin/claims/${id}/claim-items`,
215 {
216 method: "POST",
217 headers,
218 body,
219 query,
220 }
221 )
222 }
223
224 /**
225 * This method updates a claim item by the ID of the item's `WRITE_OFF_ITEM` action. It
226 * sends a request to the [Update Claim Item](https://docs.medusajs.com/api/admin/claims/update-a-claim-item) API route.
227 *
228 * Every item has an `actions` property, whose value is an array of actions.
229 * You can check the action's name using its `action` property, and use the value of the `id` property.
230 *
231 * @param id - The claim's ID.
232 * @param actionId - The id of the order item's `WRITE_OFF_ITEM` action.
233 * @param body - The details to update.
234 * @param query - Configure the fields to retrieve in the claim.
235 * @param headers - Headers to pass in the request
236 * @returns The claim's details with a preview of the order when the claim is applied.
237 *
238 * @example
239 * sdk.admin.claim.updateItem(
240 * "claim_123",
241 * "ordchact_123",
242 * {
243 * quantity: 1
244 * }
245 * )
246 * .then(({ claim }) => {
247 * console.log(claim)
248 * })
249 */
250 async updateItem(
251 id: string,
252 actionId: string,
253 body: HttpTypes.AdminUpdateClaimItem,
254 query?: HttpTypes.SelectParams,
255 headers?: ClientHeaders
256 ) {
257 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
258 `/admin/claims/${id}/claim-items/${actionId}`,
259 {
260 method: "POST",
261 headers,
262 body,
263 query,
264 }
265 )
266 }
267
268 /**
269 * This method removes a claim item from a claim by the ID of the item's `WRITE_OFF_ITEM` action.
270 * It sends a request to the [Remove Claim Item](https://docs.medusajs.com/api/admin/claims/remove-claim-item)
271 * API route.
272 *
273 * Every item has an `actions` property, whose value is an array of actions.
274 * You can check the action's name using its `action` property, and use the value of the `id` property.
275 *
276 * @param id - The claim's ID.
277 * @param actionId - The id of the order item's `WRITE_OFF_ITEM` action.
278 * @param query - Configure the fields to retrieve in the claim.
279 * @param headers - Headers to pass in the request
280 * @returns The claim's details with a preview of the order when the claim is applied.
281 *
282 * @example
283 * sdk.admin.claim.removeItem(
284 * "claim_123",
285 * "ordchact_123",
286 * )
287 * .then(({ claim }) => {
288 * console.log(claim)
289 * })
290 */
291 async removeItem(
292 id: string,
293 actionId: string,
294 query?: HttpTypes.SelectParams,
295 headers?: ClientHeaders
296 ) {
297 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
298 `/admin/claims/${id}/claim-items/${actionId}`,
299 {
300 method: "DELETE",
301 headers,
302 query,
303 }
304 )
305 }
306
307 /**
308 * This method adds inbound (or return) items to the claim. These inbound items will have a `RETURN_ITEM` action.
309 *
310 * This method sends a request to the [Add Inbound Items](https://docs.medusajs.com/api/admin/claims/add-inbound-items)
311 * API route.
312 *
313 * @param id - The ID of the claim to add the inbound items to.
314 * @param body - The inbound items' details.
315 * @param query - Configure the fields to retrieve in the return.
316 * @param headers - Headers to pass in the request
317 * @returns The details of the return associated with the claim, with a preview of the order when the claim is applied.
318 *
319 * @example
320 * sdk.admin.claim.addInboundItems(
321 * "claim_123",
322 * {
323 * items: [
324 * {
325 * id: "orli_123",
326 * quantity: 1
327 * }
328 * ]
329 * },
330 * )
331 * .then(({ return: returnData }) => {
332 * console.log(returnData)
333 * })
334 */
335 async addInboundItems(
336 id: string,
337 body: HttpTypes.AdminAddClaimInboundItems,
338 query?: HttpTypes.SelectParams,
339 headers?: ClientHeaders
340 ) {
341 return await this.client.fetch<HttpTypes.AdminClaimReturnPreviewResponse>(
342 `/admin/claims/${id}/inbound/items`,
343 {
344 method: "POST",
345 headers,
346 body,
347 query,
348 }
349 )
350 }
351
352 /**
353 * This method updates an inbound (or return) item of a claim using the ID of the item's `RETURN_ITEM` action.
354 * It sends a request to the [Update Inbound Item](https://docs.medusajs.com/api/admin/claims/update-inbound-items)
355 * API route.
356 *
357 * Every item has an `actions` property, whose value is an array of actions.
358 * You can check the action's name using its `action` property, and use the value of the `id` property.
359 *
360 * @param id - The claim's ID.
361 * @param actionId - The id of the return item's `RETURN_ITEM` action.
362 * @param body - The details to update in the inbound item.
363 * @param query - Configure the fields to retrieve in the return.
364 * @param headers - Headers to pass in the request
365 * @returns The details of the return associated with the claim, with a preview of the order when the claim is applied.
366 *
367 * @example
368 * sdk.admin.claim.updateInboundItem(
369 * "claim_123",
370 * "ordchact_123",
371 * {
372 * quantity: 1
373 * },
374 * )
375 * .then(({ return: returnData }) => {
376 * console.log(returnData)
377 * })
378 */
379 async updateInboundItem(
380 id: string,
381 actionId: string,
382 body: HttpTypes.AdminUpdateClaimInboundItem,
383 query?: HttpTypes.SelectParams,
384 headers?: ClientHeaders
385 ) {
386 return await this.client.fetch<HttpTypes.AdminClaimReturnPreviewResponse>(
387 `/admin/claims/${id}/inbound/items/${actionId}`,
388 {
389 method: "POST",
390 headers,
391 body,
392 query,
393 }
394 )
395 }
396
397 /**
398 * This method removes an inbound (or return) item from a claim using the ID of the item's `RETURN_ITEM` action.
399 * It sends a request to the [Remove Inbound Item](https://docs.medusajs.com/api/admin/claims/remove-inbound-item)
400 * API route.
401 *
402 * Every item has an `actions` property, whose value is an array of actions.
403 * You can check the action's name using its `action` property, and use the value of the `id` property.
404 *
405 * @param id - The claim's ID.
406 * @param actionId - The ID of the return item's `RETURN_ITEM` action.
407 * @param query - Configure the fields to retrieve in the return.
408 * @param headers - Headers to pass in the request
409 * @returns The details of the return associated with the claim, with a preview of the order when the claim is applied.
410 *
411 * @example
412 * sdk.admin.claim.removeInboundItem(
413 * "claim_123",
414 * "ordchact_123",
415 * )
416 * .then(({ return: returnData }) => {
417 * console.log(returnData)
418 * })
419 */
420 async removeInboundItem(
421 id: string,
422 actionId: string,
423 query?: HttpTypes.SelectParams,
424 headers?: ClientHeaders
425 ) {
426 return await this.client.fetch<HttpTypes.AdminClaimReturnPreviewResponse>(
427 `/admin/claims/${id}/inbound/items/${actionId}`,
428 {
429 method: "DELETE",
430 headers,
431 query,
432 }
433 )
434 }
435
436 /**
437 * This method adds an inbound (or return) shipping method to a claim.
438 * The inbound shipping method will have a `SHIPPING_ADD` action.
439 *
440 * This method sends a request to the [Add Inbound Shipping](https://docs.medusajs.com/api/admin/claims/add-inbound-shipping)
441 * API route.
442 *
443 * @param id - The claim's ID.
444 * @param body - The shipping method's details.
445 * @param query - Configure the fields to retrieve in the return.
446 * @param headers - Headers to pass in the request
447 * @returns The details of the return associated with the claim, with a preview of the order when the claim is applied.
448 *
449 * @example
450 * sdk.admin.claim.addInboundShipping(
451 * "claim_123",
452 * {
453 * shipping_option_id: "so_123",
454 * custom_amount: 10
455 * },
456 * )
457 * .then(({ return: returnData }) => {
458 * console.log(returnData)
459 * })
460 */
461 async addInboundShipping(
462 id: string,
463 body: HttpTypes.AdminClaimAddInboundShipping,
464 query?: HttpTypes.SelectParams,
465 headers?: ClientHeaders
466 ) {
467 return await this.client.fetch<HttpTypes.AdminClaimReturnPreviewResponse>(
468 `/admin/claims/${id}/inbound/shipping-method`,
469 {
470 method: "POST",
471 headers,
472 body,
473 query,
474 }
475 )
476 }
477
478 /**
479 * This method updates a shipping method for returning items in the claim using the ID of the method's `SHIPPING_ADD` action.
480 * It sends a request to the [Update Inbound Shipping](https://docs.medusajs.com/api/admin/claims/update-inbound-shipping)
481 * API route.
482 *
483 * Every shipping method has an `actions` property, whose value is an array of actions.
484 * You can check the action's name using its `action` property, and use the value of the `id` property.
485 *
486 * @param id - The claim's ID.
487 * @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
488 * @param body - The details to update in the shipping method
489 * @param query - Configure the fields to retrieve in the claim.
490 * @param headers - Headers to pass in the request
491 * @returns The details of the claim, with a preview of the order when the claim is applied.
492 *
493 * @example
494 * sdk.admin.claim.updateInboundShipping(
495 * "claim_123",
496 * "ordchact_123",
497 * {
498 * custom_amount: 10
499 * },
500 * )
501 * .then(({ claim }) => {
502 * console.log(claim)
503 * })
504 */
505 async updateInboundShipping(
506 id: string,
507 actionId: string,
508 body: HttpTypes.AdminClaimUpdateInboundShipping,
509 query?: HttpTypes.SelectParams,
510 headers?: ClientHeaders
511 ) {
512 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
513 `/admin/claims/${id}/inbound/shipping-method/${actionId}`,
514 {
515 method: "POST",
516 headers,
517 body,
518 query,
519 }
520 )
521 }
522
523 /**
524 * This method deletes a shipping method for returning items in the claim using the ID of the method's `SHIPPING_ADD` action.
525 * It sends a request to the [Remove Inbound Shipping](https://docs.medusajs.com/api/admin/claims/remove-inbound-shipping-method)
526 * API route.
527 *
528 * Every shipping method has an `actions` property, whose value is an array of actions.
529 * You can check the action's name using its `action` property, and use the value of the `id` property.
530 *
531 * @param id - The claim's ID.
532 * @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
533 * @param query - Configure the fields to retrieve in the return.
534 * @param headers - Headers to pass in the request
535 * @returns The details of the return associated with the claim, with a preview of the order when the claim is applied.
536 *
537 * @example
538 * sdk.admin.claim.deleteInboundShipping(
539 * "claim_123",
540 * "ordchact_123",
541 * )
542 * .then(({ return: returnData }) => {
543 * console.log(returnData)
544 * })
545 */
546 async deleteInboundShipping(
547 id: string,
548 actionId: string,
549 query?: HttpTypes.SelectParams,
550 headers?: ClientHeaders
551 ) {
552 return await this.client.fetch<HttpTypes.AdminClaimReturnPreviewResponse>(
553 `/admin/claims/${id}/inbound/shipping-method/${actionId}`,
554 {
555 method: "DELETE",
556 headers,
557 query,
558 }
559 )
560 }
561
562 /**
563 * This method adds outbound (or new) items to a claim. These outbound items will have an `ITEM_ADD` action.
564 * It sends a request to the [Add Outbound Items](https://docs.medusajs.com/api/admin/claims/add-outbound-items)
565 * API route.
566 *
567 * @param id - The ID of the claim to add the outbound items to.
568 * @param body - The items' details.
569 * @param query - Configure the fields to retrieve in the claim.
570 * @param headers - Headers to pass in the request
571 * @returns The details of the claim, with a preview of the order when the claim is applied.
572 *
573 * @example
574 * sdk.admin.claim.addOutboundItems(
575 * "claim_123",
576 * {
577 * items: [{
578 * id: "orli_123",
579 * quantity: 1
580 * }]
581 * },
582 * )
583 * .then(({ claim }) => {
584 * console.log(claim)
585 * })
586 */
587 async addOutboundItems(
588 id: string,
589 body: HttpTypes.AdminAddClaimOutboundItems,
590 query?: HttpTypes.SelectParams,
591 headers?: ClientHeaders
592 ) {
593 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
594 `/admin/claims/${id}/outbound/items`,
595 {
596 method: "POST",
597 headers,
598 body,
599 query,
600 }
601 )
602 }
603
604 /**
605 * This method updates an outbound (or new) item of a claim using the ID of the item's `ITEM_ADD` action.
606 * It sends a request to the [Update Outbound Item](https://docs.medusajs.com/api/admin/claims/update-outbound-item)
607 * API route.
608 *
609 * Every item has an `actions` property, whose value is an array of actions.
610 * You can check the action's name using its `action` property, and use the value of the `id` property.
611 *
612 * @param id - The claim's ID.
613 * @param actionId - The id of the new claim item's `ITEM_ADD` action.
614 * @param body - The item's details.
615 * @param query - Configure the fields to retrieve in the claim.
616 * @param headers - Headers to pass in the request
617 * @returns The details of the claim, with a preview of the order when the claim is applied.
618 *
619 * @example
620 * sdk.admin.claim.updateOutboundItem(
621 * "claim_123",
622 * "ordchact_123",
623 * {
624 * quantity: 1
625 * },
626 * )
627 * .then(({ claim }) => {
628 * console.log(claim)
629 * })
630 */
631 async updateOutboundItem(
632 id: string,
633 actionId: string,
634 body: HttpTypes.AdminUpdateClaimOutboundItem,
635 query?: HttpTypes.SelectParams,
636 headers?: ClientHeaders
637 ) {
638 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
639 `/admin/claims/${id}/outbound/items/${actionId}`,
640 {
641 method: "POST",
642 headers,
643 body,
644 query,
645 }
646 )
647 }
648
649 /**
650 * This method removes an outbound (or new) item from a claim using the ID of the item's `ITEM_ADD` action.
651 * It sends a request to the [Remove Outbound Item](https://docs.medusajs.com/api/admin/claims/remove-outbound-item)
652 * API route.
653 *
654 * Every item has an `actions` property, whose value is an array of actions.
655 * You can check the action's name using its `action` property, and use the value of the `id` property.
656 *
657 * @param id - The claim's ID.
658 * @param actionId - The id of the new claim item's `ITEM_ADD` action.
659 * @param query - Configure the fields to retrieve in the claim.
660 * @param headers - Headers to pass in the request
661 * @returns The details of the claim, with a preview of the order when the claim is applied.
662 *
663 * @example
664 * sdk.admin.claim.removeOutboundItem(
665 * "claim_123",
666 * "ordchact_123",
667 * )
668 * .then(({ claim }) => {
669 * console.log(claim)
670 * })
671 */
672 async removeOutboundItem(
673 id: string,
674 actionId: string,
675 query?: HttpTypes.SelectParams,
676 headers?: ClientHeaders
677 ) {
678 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
679 `/admin/claims/${id}/outbound/items/${actionId}`,
680 {
681 method: "DELETE",
682 headers,
683 query,
684 }
685 )
686 }
687
688 /**
689 * This method adds outbound an outbound shipping method to a claim.
690 * The outbound shipping method will have a `SHIPPING_ADD` action.
691 *
692 * This method sends a request to the
693 * [Add Outbound Shipping](https://docs.medusajs.com/api/admin/claims/add-outbound-shipping)
694 * API route.
695 *
696 * @param id - The claim's ID.
697 * @param body - The shipping method's details.
698 * @param query - Configure the fields to retrieve in the claim.
699 * @param headers - Headers to pass in the request
700 * @returns The details of the claim, with a preview of the order when the claim is applied.
701 *
702 * @example
703 * sdk.admin.claim.addOutboundShipping(
704 * "claim_123",
705 * {
706 * shipping_option_id: "so_123",
707 * custom_amount: 10
708 * },
709 * )
710 * .then(({ claim }) => {
711 * console.log(claim)
712 * })
713 */
714 async addOutboundShipping(
715 id: string,
716 body: HttpTypes.AdminClaimAddOutboundShipping,
717 query?: HttpTypes.SelectParams,
718 headers?: ClientHeaders
719 ) {
720 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
721 `/admin/claims/${id}/outbound/shipping-method`,
722 {
723 method: "POST",
724 headers,
725 body,
726 query,
727 }
728 )
729 }
730
731 /**
732 * This method updates the shipping method for delivering outbound items in a claim using the ID of the method's `SHIPPING_ADD` action.
733 * It sends a request to the [Update Outbound Shipping](https://docs.medusajs.com/api/admin/claims/update-outbound-shipping)
734 * API route.
735 *
736 * Every shipping method has an `actions` property, whose value is an array of actions.
737 * You can check the action's name using its `action` property, and use the value of the `id` property.
738 *
739 * @param id - The claim's ID.
740 * @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
741 * @param body - The shipping method's details.
742 * @param query - Configure the fields to retrieve in the claim.
743 * @param headers - Headers to pass in the request
744 * @returns The details of the claim, with a preview of the order when the claim is applied.
745 *
746 * @example
747 * sdk.admin.claim.updateOutboundShipping(
748 * "claim_123",
749 * "ordchact_123",
750 * {
751 * custom_amount: 10
752 * },
753 * )
754 * .then(({ claim }) => {
755 * console.log(claim)
756 * })
757 */
758 async updateOutboundShipping(
759 id: string,
760 actionId: string,
761 body: HttpTypes.AdminClaimUpdateOutboundShipping,
762 query?: HttpTypes.SelectParams,
763 headers?: ClientHeaders
764 ) {
765 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
766 `/admin/claims/${id}/outbound/shipping-method/${actionId}`,
767 {
768 method: "POST",
769 headers,
770 body,
771 query,
772 }
773 )
774 }
775
776 /**
777 * This method deletes the shipping method for delivering outbound items in the claim using the ID of the method's `SHIPPING_ADD` action.
778 *
779 * Every shipping method has an `actions` property, whose value is an array of actions.
780 * You can check the action's name using its `action` property, and use the value of the `id` property.
781 *
782 * @param id - The claim's ID.
783 * @param actionId - The id of the shipping method's `SHIPPING_ADD` action.
784 * @param query - Configure the fields to retrieve in the claim.
785 * @param headers - Headers to pass in the request
786 * @returns The details of the claim, with a preview of the order when the claim is applied.
787 *
788 * @example
789 * sdk.admin.claim.deleteOutboundShipping(
790 * "claim_123",
791 * "ordchact_123",
792 * )
793 * .then(({ claim }) => {
794 * console.log(claim)
795 * })
796 */
797 async deleteOutboundShipping(
798 id: string,
799 actionId: string,
800 query?: HttpTypes.SelectParams,
801 headers?: ClientHeaders
802 ) {
803 return await this.client.fetch<HttpTypes.AdminClaimPreviewResponse>(
804 `/admin/claims/${id}/outbound/shipping-method/${actionId}`,
805 {
806 method: "DELETE",
807 headers,
808 query,
809 }
810 )
811 }
812
813 /**
814 * This method confirms a claim request, applying its changes on the associated order.
815 * It sends a request to the [Confirm Claim Request](https://docs.medusajs.com/api/admin/claims/confirm-claim)
816 * API route.
817 *
818 * @param id - The claim's ID.
819 * @param body - The confirmation details.
820 * @param query - Configure the fields to retrieve in the claim.
821 * @param headers - Headers to pass in the request
822 * @returns The details of the claim and its associated return, with a preview of the order when the claim is applied.
823 *
824 * @example
825 * sdk.admin.claim.request(
826 * "claim_123",
827 * {},
828 * )
829 * .then(({ claim }) => {
830 * console.log(claim)
831 * })
832 */
833 async request(
834 id: string,
835 body: HttpTypes.AdminRequestClaim,
836 query?: HttpTypes.SelectParams,
837 headers?: ClientHeaders
838 ) {
839 return await this.client.fetch<HttpTypes.AdminClaimRequestResponse>(
840 `/admin/claims/${id}/request`,
841 {
842 method: "POST",
843 headers,
844 body,
845 query,
846 }
847 )
848 }
849
850 /**
851 * This method cancels a requested claim. It sends a request to the
852 * [Cancel Claim Request](https://docs.medusajs.com/api/admin/claims/cancel-claim-request)
853 * API route.
854 *
855 * @param id - The claim's ID.
856 * @param query - Configure the fields to retrieve in the claim.
857 * @param headers - Headers to pass in the request
858 * @returns The cancelation's details.
859 *
860 * @example
861 * sdk.admin.claim.cancelRequest(
862 * "claim_123",
863 * )
864 * .then(({ deleted }) => {
865 * console.log(deleted)
866 * })
867 */
868 async cancelRequest(
869 id: string,
870 query?: HttpTypes.SelectParams,
871 headers?: ClientHeaders
872 ) {
873 return await this.client.fetch<HttpTypes.AdminClaimDeleteResponse>(
874 `/admin/claims/${id}/request`,
875 {
876 method: "DELETE",
877 headers,
878 query,
879 }
880 )
881 }
882 }