@medusajs/js-sdk 2.0.1 → 2.0.2-snapshot-20241104135243

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.
Files changed (41) hide show
  1. package/dist/admin/notification.d.ts +80 -0
  2. package/dist/admin/notification.d.ts.map +1 -1
  3. package/dist/admin/notification.js +80 -0
  4. package/dist/admin/notification.js.map +1 -1
  5. package/dist/admin/order-edit.d.ts +166 -1
  6. package/dist/admin/order-edit.d.ts.map +1 -1
  7. package/dist/admin/order-edit.js +165 -0
  8. package/dist/admin/order-edit.js.map +1 -1
  9. package/dist/admin/order.d.ts +248 -22
  10. package/dist/admin/order.d.ts.map +1 -1
  11. package/dist/admin/order.js +240 -0
  12. package/dist/admin/order.js.map +1 -1
  13. package/dist/admin/payment-collection.d.ts +55 -0
  14. package/dist/admin/payment-collection.d.ts.map +1 -1
  15. package/dist/admin/payment-collection.js +55 -0
  16. package/dist/admin/payment-collection.js.map +1 -1
  17. package/dist/admin/payment.d.ts +162 -1
  18. package/dist/admin/payment.d.ts.map +1 -1
  19. package/dist/admin/payment.js +161 -0
  20. package/dist/admin/payment.js.map +1 -1
  21. package/dist/esm/admin/notification.d.ts +80 -0
  22. package/dist/esm/admin/notification.d.ts.map +1 -1
  23. package/dist/esm/admin/notification.js +80 -0
  24. package/dist/esm/admin/notification.js.map +1 -1
  25. package/dist/esm/admin/order-edit.d.ts +166 -1
  26. package/dist/esm/admin/order-edit.d.ts.map +1 -1
  27. package/dist/esm/admin/order-edit.js +165 -0
  28. package/dist/esm/admin/order-edit.js.map +1 -1
  29. package/dist/esm/admin/order.d.ts +248 -22
  30. package/dist/esm/admin/order.d.ts.map +1 -1
  31. package/dist/esm/admin/order.js +240 -0
  32. package/dist/esm/admin/order.js.map +1 -1
  33. package/dist/esm/admin/payment-collection.d.ts +55 -0
  34. package/dist/esm/admin/payment-collection.d.ts.map +1 -1
  35. package/dist/esm/admin/payment-collection.js +55 -0
  36. package/dist/esm/admin/payment-collection.js.map +1 -1
  37. package/dist/esm/admin/payment.d.ts +162 -1
  38. package/dist/esm/admin/payment.d.ts.map +1 -1
  39. package/dist/esm/admin/payment.js +161 -0
  40. package/dist/esm/admin/payment.js.map +1 -1
  41. package/package.json +2 -2
@@ -10,7 +10,87 @@ export declare class Notification {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method retrieves a notification's details. It sends a request to the
15
+ * [Get Notification](https://docs.medusajs.com/api/admin#notifications_getnotificationsid)
16
+ * API route.
17
+ *
18
+ * @param id - The notification's ID.
19
+ * @param query - Configure the fields to retrieve in the notification.
20
+ * @param headers - Headers to pass in the request
21
+ * @returns The notification's details.
22
+ *
23
+ * @example
24
+ * To retrieve a notification by its ID:
25
+ *
26
+ * ```ts
27
+ * sdk.admin.notification.retrieve("notif_123")
28
+ * .then(({ notification }) => {
29
+ * console.log(notification)
30
+ * })
31
+ * ```
32
+ *
33
+ * To specify the fields and relations to retrieve:
34
+ *
35
+ * ```ts
36
+ * sdk.admin.notification.retrieve("notif_123", {
37
+ * fields: "id,to"
38
+ * })
39
+ * .then(({ notification }) => {
40
+ * console.log(notification)
41
+ * })
42
+ * ```
43
+ *
44
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
45
+ */
13
46
  retrieve(id: string, query?: HttpTypes.AdminNotificationParams, headers?: ClientHeaders): Promise<HttpTypes.AdminNotificationResponse>;
47
+ /**
48
+ * This method retrieves a paginated list of notifications. It sends a request to the
49
+ * [List Notifications](https://docs.medusajs.com/api/admin#notifications_getnotifications)
50
+ * API route.
51
+ *
52
+ * @param query - Filters and pagination configurations.
53
+ * @param headers - Headers to pass in the request.
54
+ * @returns The paginated list of notifications.
55
+ *
56
+ * @example
57
+ * To retrieve the list of notifications:
58
+ *
59
+ * ```ts
60
+ * sdk.admin.notification.list()
61
+ * .then(({ notifications, count, limit, offset }) => {
62
+ * console.log(notifications)
63
+ * })
64
+ * ```
65
+ *
66
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
67
+ *
68
+ * For example, to retrieve only 10 items and skip 10 items:
69
+ *
70
+ * ```ts
71
+ * sdk.admin.notification.list({
72
+ * limit: 10,
73
+ * offset: 10
74
+ * })
75
+ * .then(({ notifications, count, limit, offset }) => {
76
+ * console.log(notifications)
77
+ * })
78
+ * ```
79
+ *
80
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
81
+ * in each notification:
82
+ *
83
+ * ```ts
84
+ * sdk.admin.notification.list({
85
+ * fields: "id,to"
86
+ * })
87
+ * .then(({ notifications, count, limit, offset }) => {
88
+ * console.log(notifications)
89
+ * })
90
+ * ```
91
+ *
92
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
93
+ */
14
94
  list(query?: HttpTypes.AdminNotificationListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminNotificationListResponse>;
15
95
  }
16
96
  //# sourceMappingURL=notification.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/admin/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,uBAAuB,EACzC,OAAO,CAAC,EAAE,aAAa;IAYnB,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,2BAA2B,EAC7C,OAAO,CAAC,EAAE,aAAa;CAW1B"}
1
+ {"version":3,"file":"notification.d.ts","sourceRoot":"","sources":["../../src/admin/notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,YAAY;IACvB;;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,uBAAuB,EACzC,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,2BAA2B,EAC7C,OAAO,CAAC,EAAE,aAAa;CAW1B"}
@@ -8,6 +8,39 @@ class Notification {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method retrieves a notification's details. It sends a request to the
13
+ * [Get Notification](https://docs.medusajs.com/api/admin#notifications_getnotificationsid)
14
+ * API route.
15
+ *
16
+ * @param id - The notification's ID.
17
+ * @param query - Configure the fields to retrieve in the notification.
18
+ * @param headers - Headers to pass in the request
19
+ * @returns The notification's details.
20
+ *
21
+ * @example
22
+ * To retrieve a notification by its ID:
23
+ *
24
+ * ```ts
25
+ * sdk.admin.notification.retrieve("notif_123")
26
+ * .then(({ notification }) => {
27
+ * console.log(notification)
28
+ * })
29
+ * ```
30
+ *
31
+ * To specify the fields and relations to retrieve:
32
+ *
33
+ * ```ts
34
+ * sdk.admin.notification.retrieve("notif_123", {
35
+ * fields: "id,to"
36
+ * })
37
+ * .then(({ notification }) => {
38
+ * console.log(notification)
39
+ * })
40
+ * ```
41
+ *
42
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
43
+ */
11
44
  async retrieve(id, query, headers) {
12
45
  return await this.client.fetch(`/admin/notifications/${id}`, {
13
46
  method: "GET",
@@ -15,6 +48,53 @@ class Notification {
15
48
  query,
16
49
  });
17
50
  }
51
+ /**
52
+ * This method retrieves a paginated list of notifications. It sends a request to the
53
+ * [List Notifications](https://docs.medusajs.com/api/admin#notifications_getnotifications)
54
+ * API route.
55
+ *
56
+ * @param query - Filters and pagination configurations.
57
+ * @param headers - Headers to pass in the request.
58
+ * @returns The paginated list of notifications.
59
+ *
60
+ * @example
61
+ * To retrieve the list of notifications:
62
+ *
63
+ * ```ts
64
+ * sdk.admin.notification.list()
65
+ * .then(({ notifications, count, limit, offset }) => {
66
+ * console.log(notifications)
67
+ * })
68
+ * ```
69
+ *
70
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
71
+ *
72
+ * For example, to retrieve only 10 items and skip 10 items:
73
+ *
74
+ * ```ts
75
+ * sdk.admin.notification.list({
76
+ * limit: 10,
77
+ * offset: 10
78
+ * })
79
+ * .then(({ notifications, count, limit, offset }) => {
80
+ * console.log(notifications)
81
+ * })
82
+ * ```
83
+ *
84
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
85
+ * in each notification:
86
+ *
87
+ * ```ts
88
+ * sdk.admin.notification.list({
89
+ * fields: "id,to"
90
+ * })
91
+ * .then(({ notifications, count, limit, offset }) => {
92
+ * console.log(notifications)
93
+ * })
94
+ * ```
95
+ *
96
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
97
+ */
18
98
  async list(query, headers) {
19
99
  return await this.client.fetch(`/admin/notifications`, {
20
100
  method: "GET",
@@ -1 +1 @@
1
- {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../src/admin/notification.ts"],"names":[],"mappings":";;;AAIA,MAAa,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAyC,EACzC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,wBAAwB,EAAE,EAAE,EAC5B;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,KAA6C,EAC7C,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EACtB;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAxCD,oCAwCC"}
1
+ {"version":3,"file":"notification.js","sourceRoot":"","sources":["../../src/admin/notification.ts"],"names":[],"mappings":";;;AAIA,MAAa,YAAY;IAKvB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAyC,EACzC,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,wBAAwB,EAAE,EAAE,EAC5B;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,KAAK,CAAC,IAAI,CACR,KAA6C,EAC7C,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EACtB;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAxHD,oCAwHC"}
@@ -10,13 +10,178 @@ export declare class OrderEdit {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
- initiateRequest(body: HttpTypes.AdminInitiateOrderEditRequest, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
13
+ /**
14
+ * This method creates an order edit request. It sends a HTTP request to the
15
+ * [Create Order Edit](https://docs.medusajs.com/api/admin#order-edits_postorderedits)
16
+ * API route.
17
+ *
18
+ * @param body - The order edit's details.
19
+ * @param query - Configure the fields to retrieve in the order edit.
20
+ * @param headers - Headers to pass in the request.
21
+ * @returns The order edit's details.
22
+ *
23
+ * @example
24
+ * sdk.admin.orderEdit.initiateRequest({
25
+ * order_id: "order_123"
26
+ * })
27
+ * .then(({ order_change }) => {
28
+ * console.log(order_change)
29
+ * })
30
+ */
31
+ initiateRequest(body: HttpTypes.AdminInitiateOrderEditRequest, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditResponse>;
32
+ /**
33
+ * This method changes an order edit to requested. It sends a request to the
34
+ * [Request Order Edit](https://docs.medusajs.com/api/admin#order-edits_postordereditsidrequest)
35
+ * API route.
36
+ *
37
+ * @param id - The order edit's ID.
38
+ * @param query - Configure the fields to retrieve in the order preview.
39
+ * @param headers - Headers to pass in the request.
40
+ * @returns The order preview's details.
41
+ *
42
+ * @example
43
+ * sdk.admin.orderEdit.request("ordch_123")
44
+ * .then(({ order_preview }) => {
45
+ * console.log(order_preview)
46
+ * })
47
+ */
14
48
  request(id: string, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
49
+ /**
50
+ * This method confirms an order edit and applies it on the order. It sends a request
51
+ * to the [Confirm Order Edit](https://docs.medusajs.com/api/admin#order-edits_postordereditsidconfirm)
52
+ * API route.
53
+ *
54
+ * @param id - The order edit's ID.
55
+ * @param query - Configure the fields to retrieve in the order preview.
56
+ * @param headers - Headers to pass in the request.
57
+ * @returns The order preview's details.
58
+ *
59
+ * @example
60
+ * sdk.admin.orderEdit.confirm("ordch_123")
61
+ * .then(({ order_preview }) => {
62
+ * console.log(order_preview)
63
+ * })
64
+ */
15
65
  confirm(id: string, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
66
+ /**
67
+ * This method cancels a requested order edit. It sends a request to the
68
+ * [Cancel Order Edit](https://docs.medusajs.com/api/admin#order-edits_deleteordereditsid)
69
+ * API route.
70
+ *
71
+ * @param id - The order edit's ID.
72
+ * @param query - Query parameters
73
+ * @param headers - Headers to pass in the request.
74
+ * @returns The deletion's details.
75
+ *
76
+ * @example
77
+ * sdk.admin.orderEdit.cancelRequest("ordch_123")
78
+ * .then(({ deleted }) => {
79
+ * console.log(deleted)
80
+ * })
81
+ */
16
82
  cancelRequest(id: string, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditDeleteResponse>;
83
+ /**
84
+ * This method adds items to an order edit. These items will have the action `ITEM_ADD`.
85
+ *
86
+ * The method sends a request to the [Add Items](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditems)
87
+ * API route.
88
+ *
89
+ * @param id - The order edit's ID.
90
+ * @param body - The items to add.
91
+ * @param query - Configure the fields to retrieve in the order preview.
92
+ * @param headers - Headers to pass in the request.
93
+ * @returns The order preview's details.
94
+ *
95
+ * @example
96
+ * sdk.admin.orderEdit.addItems("ordch_123", {
97
+ * items: [
98
+ * {
99
+ * variant_id: "variant_123",
100
+ * quantity: 1
101
+ * }
102
+ * ]
103
+ * })
104
+ * .then(({ order_preview }) => {
105
+ * console.log(order_preview)
106
+ * })
107
+ */
17
108
  addItems(id: string, body: HttpTypes.AdminAddOrderEditItems, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
109
+ /**
110
+ * This method updates the quantity and other details of an item in an order. It sends a request to the
111
+ * [Update Item Quantity](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditemsitemitem_id)
112
+ * API route.
113
+ *
114
+ * @param id - The order edit's ID.
115
+ * @param itemId - The item's ID in the order.
116
+ * @param body - The data to edit in the item.
117
+ * @param query - Configure the fields to retrieve in the order preview.
118
+ * @param headers - Headers to pass in the request.
119
+ * @returns The order preview's details.
120
+ *
121
+ * @example
122
+ * sdk.admin.orderEdit.updateOriginalItem(
123
+ * "ordch_123",
124
+ * "orli_123",
125
+ * {
126
+ * quantity: 1
127
+ * }
128
+ * )
129
+ * .then(({ order_preview }) => {
130
+ * console.log(order_preview)
131
+ * })
132
+ */
18
133
  updateOriginalItem(id: string, itemId: string, body: HttpTypes.AdminUpdateOrderEditItem, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
134
+ /**
135
+ * This method updates an added item in the order edit by the ID of the item's `ITEM_ADD` action.
136
+ *
137
+ * Every item has an `actions` property, whose value is an array of actions.
138
+ * You can check the action's name using its `action` property, and use the value of the `id` property.
139
+ *
140
+ * It sends a request
141
+ * to the [Update Item](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditemsaction_id)
142
+ * API route.
143
+ *
144
+ * @param id - The order edit's ID.
145
+ * @param actionId - The id of the new item's `ITEM_ADD` action.
146
+ * @param body - The data to update.
147
+ * @param query - Configure the fields to retrieve in the order preview.
148
+ * @param headers - Headers to pass in the request.
149
+ * @returns The order preview's details.
150
+ *
151
+ * @example
152
+ * sdk.admin.orderEdit.updateAddedItem(
153
+ * "ordch_123",
154
+ * "orli_123",
155
+ * {
156
+ * quantity: 1
157
+ * }
158
+ * )
159
+ * .then(({ order_preview }) => {
160
+ * console.log(order_preview)
161
+ * })
162
+ */
19
163
  updateAddedItem(id: string, actionId: string, body: HttpTypes.AdminUpdateOrderEditItem, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
164
+ /**
165
+ * This method removes an added item in the order edit by the ID of the item's `ITEM_ADD` action.
166
+ *
167
+ * Every item has an `actions` property, whose value is an array of actions.
168
+ * You can check the action's name using its `action` property, and use the value of the `id` property.
169
+ *
170
+ * @param id - The order edit's ID.
171
+ * @param actionId - The id of the new item's `ITEM_ADD` action.
172
+ * @param query - Configure the fields to retrieve in the order preview.
173
+ * @param headers - Headers to pass in the request.
174
+ * @returns The order preview's details.
175
+ *
176
+ * @example
177
+ * sdk.admin.orderEdit.removeAddedItem(
178
+ * "ordch_123",
179
+ * "orli_123",
180
+ * )
181
+ * .then(({ order_preview }) => {
182
+ * console.log(order_preview)
183
+ * })
184
+ */
20
185
  removeAddedItem(id: string, actionId: string, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminOrderEditPreviewResponse>;
21
186
  }
22
187
  //# sourceMappingURL=order-edit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"order-edit.d.ts","sourceRoot":"","sources":["../../src/admin/order-edit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,SAAS;IACpB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,eAAe,CACnB,IAAI,EAAE,SAAS,CAAC,6BAA6B,EAC7C,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAanB,OAAO,CACX,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAYnB,OAAO,CACX,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAYnB,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAYnB,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,IAAI,E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;IACG,OAAO,CACX,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;OAeG;IACG,aAAa,CACjB,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,sBAAsB,EACtC,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACG,kBAAkB,CACtB,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,eAAe,CACnB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;;;OAoBG;IACG,eAAe,CACnB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,EAC9B,OAAO,CAAC,EAAE,aAAa;CAW1B"}
@@ -8,6 +8,24 @@ class OrderEdit {
8
8
  constructor(client) {
9
9
  this.client = client;
10
10
  }
11
+ /**
12
+ * This method creates an order edit request. It sends a HTTP request to the
13
+ * [Create Order Edit](https://docs.medusajs.com/api/admin#order-edits_postorderedits)
14
+ * API route.
15
+ *
16
+ * @param body - The order edit's details.
17
+ * @param query - Configure the fields to retrieve in the order edit.
18
+ * @param headers - Headers to pass in the request.
19
+ * @returns The order edit's details.
20
+ *
21
+ * @example
22
+ * sdk.admin.orderEdit.initiateRequest({
23
+ * order_id: "order_123"
24
+ * })
25
+ * .then(({ order_change }) => {
26
+ * console.log(order_change)
27
+ * })
28
+ */
11
29
  async initiateRequest(body, query, headers) {
12
30
  return await this.client.fetch(`/admin/order-edits`, {
13
31
  method: "POST",
@@ -16,6 +34,22 @@ class OrderEdit {
16
34
  query,
17
35
  });
18
36
  }
37
+ /**
38
+ * This method changes an order edit to requested. It sends a request to the
39
+ * [Request Order Edit](https://docs.medusajs.com/api/admin#order-edits_postordereditsidrequest)
40
+ * API route.
41
+ *
42
+ * @param id - The order edit's ID.
43
+ * @param query - Configure the fields to retrieve in the order preview.
44
+ * @param headers - Headers to pass in the request.
45
+ * @returns The order preview's details.
46
+ *
47
+ * @example
48
+ * sdk.admin.orderEdit.request("ordch_123")
49
+ * .then(({ order_preview }) => {
50
+ * console.log(order_preview)
51
+ * })
52
+ */
19
53
  async request(id, query, headers) {
20
54
  return await this.client.fetch(`/admin/order-edits/${id}/request`, {
21
55
  method: "POST",
@@ -23,6 +57,22 @@ class OrderEdit {
23
57
  query,
24
58
  });
25
59
  }
60
+ /**
61
+ * This method confirms an order edit and applies it on the order. It sends a request
62
+ * to the [Confirm Order Edit](https://docs.medusajs.com/api/admin#order-edits_postordereditsidconfirm)
63
+ * API route.
64
+ *
65
+ * @param id - The order edit's ID.
66
+ * @param query - Configure the fields to retrieve in the order preview.
67
+ * @param headers - Headers to pass in the request.
68
+ * @returns The order preview's details.
69
+ *
70
+ * @example
71
+ * sdk.admin.orderEdit.confirm("ordch_123")
72
+ * .then(({ order_preview }) => {
73
+ * console.log(order_preview)
74
+ * })
75
+ */
26
76
  async confirm(id, query, headers) {
27
77
  return await this.client.fetch(`/admin/order-edits/${id}/confirm`, {
28
78
  method: "POST",
@@ -30,6 +80,22 @@ class OrderEdit {
30
80
  query,
31
81
  });
32
82
  }
83
+ /**
84
+ * This method cancels a requested order edit. It sends a request to the
85
+ * [Cancel Order Edit](https://docs.medusajs.com/api/admin#order-edits_deleteordereditsid)
86
+ * API route.
87
+ *
88
+ * @param id - The order edit's ID.
89
+ * @param query - Query parameters
90
+ * @param headers - Headers to pass in the request.
91
+ * @returns The deletion's details.
92
+ *
93
+ * @example
94
+ * sdk.admin.orderEdit.cancelRequest("ordch_123")
95
+ * .then(({ deleted }) => {
96
+ * console.log(deleted)
97
+ * })
98
+ */
33
99
  async cancelRequest(id, query, headers) {
34
100
  return await this.client.fetch(`/admin/order-edits/${id}`, {
35
101
  method: "DELETE",
@@ -37,6 +103,31 @@ class OrderEdit {
37
103
  query,
38
104
  });
39
105
  }
106
+ /**
107
+ * This method adds items to an order edit. These items will have the action `ITEM_ADD`.
108
+ *
109
+ * The method sends a request to the [Add Items](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditems)
110
+ * API route.
111
+ *
112
+ * @param id - The order edit's ID.
113
+ * @param body - The items to add.
114
+ * @param query - Configure the fields to retrieve in the order preview.
115
+ * @param headers - Headers to pass in the request.
116
+ * @returns The order preview's details.
117
+ *
118
+ * @example
119
+ * sdk.admin.orderEdit.addItems("ordch_123", {
120
+ * items: [
121
+ * {
122
+ * variant_id: "variant_123",
123
+ * quantity: 1
124
+ * }
125
+ * ]
126
+ * })
127
+ * .then(({ order_preview }) => {
128
+ * console.log(order_preview)
129
+ * })
130
+ */
40
131
  async addItems(id, body, query, headers) {
41
132
  return await this.client.fetch(`/admin/order-edits/${id}/items`, {
42
133
  method: "POST",
@@ -45,6 +136,30 @@ class OrderEdit {
45
136
  query,
46
137
  });
47
138
  }
139
+ /**
140
+ * This method updates the quantity and other details of an item in an order. It sends a request to the
141
+ * [Update Item Quantity](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditemsitemitem_id)
142
+ * API route.
143
+ *
144
+ * @param id - The order edit's ID.
145
+ * @param itemId - The item's ID in the order.
146
+ * @param body - The data to edit in the item.
147
+ * @param query - Configure the fields to retrieve in the order preview.
148
+ * @param headers - Headers to pass in the request.
149
+ * @returns The order preview's details.
150
+ *
151
+ * @example
152
+ * sdk.admin.orderEdit.updateOriginalItem(
153
+ * "ordch_123",
154
+ * "orli_123",
155
+ * {
156
+ * quantity: 1
157
+ * }
158
+ * )
159
+ * .then(({ order_preview }) => {
160
+ * console.log(order_preview)
161
+ * })
162
+ */
48
163
  async updateOriginalItem(id, itemId, body, query, headers) {
49
164
  return await this.client.fetch(`/admin/order-edits/${id}/items/item/${itemId}`, {
50
165
  method: "POST",
@@ -53,6 +168,35 @@ class OrderEdit {
53
168
  query,
54
169
  });
55
170
  }
171
+ /**
172
+ * This method updates an added item in the order edit by the ID of the item's `ITEM_ADD` action.
173
+ *
174
+ * Every item has an `actions` property, whose value is an array of actions.
175
+ * You can check the action's name using its `action` property, and use the value of the `id` property.
176
+ *
177
+ * It sends a request
178
+ * to the [Update Item](https://docs.medusajs.com/api/admin#order-edits_postordereditsiditemsaction_id)
179
+ * API route.
180
+ *
181
+ * @param id - The order edit's ID.
182
+ * @param actionId - The id of the new item's `ITEM_ADD` action.
183
+ * @param body - The data to update.
184
+ * @param query - Configure the fields to retrieve in the order preview.
185
+ * @param headers - Headers to pass in the request.
186
+ * @returns The order preview's details.
187
+ *
188
+ * @example
189
+ * sdk.admin.orderEdit.updateAddedItem(
190
+ * "ordch_123",
191
+ * "orli_123",
192
+ * {
193
+ * quantity: 1
194
+ * }
195
+ * )
196
+ * .then(({ order_preview }) => {
197
+ * console.log(order_preview)
198
+ * })
199
+ */
56
200
  async updateAddedItem(id, actionId, body, query, headers) {
57
201
  return await this.client.fetch(`/admin/order-edits/${id}/items/${actionId}`, {
58
202
  method: "POST",
@@ -61,6 +205,27 @@ class OrderEdit {
61
205
  query,
62
206
  });
63
207
  }
208
+ /**
209
+ * This method removes an added item in the order edit by the ID of the item's `ITEM_ADD` action.
210
+ *
211
+ * Every item has an `actions` property, whose value is an array of actions.
212
+ * You can check the action's name using its `action` property, and use the value of the `id` property.
213
+ *
214
+ * @param id - The order edit's ID.
215
+ * @param actionId - The id of the new item's `ITEM_ADD` action.
216
+ * @param query - Configure the fields to retrieve in the order preview.
217
+ * @param headers - Headers to pass in the request.
218
+ * @returns The order preview's details.
219
+ *
220
+ * @example
221
+ * sdk.admin.orderEdit.removeAddedItem(
222
+ * "ordch_123",
223
+ * "orli_123",
224
+ * )
225
+ * .then(({ order_preview }) => {
226
+ * console.log(order_preview)
227
+ * })
228
+ */
64
229
  async removeAddedItem(id, actionId, query, headers) {
65
230
  return await this.client.fetch(`/admin/order-edits/${id}/items/${actionId}`, {
66
231
  method: "DELETE",
@@ -1 +1 @@
1
- {"version":3,"file":"order-edit.js","sourceRoot":"","sources":["../../src/admin/order-edit.ts"],"names":[],"mappings":";;;AAIA,MAAa,SAAS;IAKpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,eAAe,CACnB,IAA6C,EAC7C,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,oBAAoB,EACpB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CACX,EAAU,EACV,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EAAE,UAAU,EAClC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,OAAO,CACX,EAAU,EACV,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EAAE,UAAU,EAClC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;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AChB,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AA7ID,8BA6IC"}
1
+ {"version":3,"file":"order-edit.js","sourceRoot":"","sources":["../../src/admin/order-edit.ts"],"names":[],"mappings":";;;AAIA,MAAa,SAAS;IAKpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,KAAK,CAAC,eAAe,CACnB,IAA6C,EAC7C,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,oBAAoB,EACpB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,OAAO,CACX,EAAU,EACV,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EAAE,UAAU,EAClC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,OAAO,CACX,EAAU,EACV,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EAAE,UAAU,EAClC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,KAAK,CAAC,aAAa,CACjB,EAAU,EACV,KAA8B,EAC9B,OAAuB;QAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;I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