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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) 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/admin/price-list.d.ts +195 -1
  22. package/dist/admin/price-list.d.ts.map +1 -1
  23. package/dist/admin/price-list.js +194 -0
  24. package/dist/admin/price-list.js.map +1 -1
  25. package/dist/admin/price-preference.d.ts +133 -0
  26. package/dist/admin/price-preference.d.ts.map +1 -1
  27. package/dist/admin/price-preference.js +133 -0
  28. package/dist/admin/price-preference.js.map +1 -1
  29. package/dist/admin/product-category.d.ts +150 -0
  30. package/dist/admin/product-category.d.ts.map +1 -1
  31. package/dist/admin/product-category.js +150 -0
  32. package/dist/admin/product-category.js.map +1 -1
  33. package/dist/admin/product-collection.d.ts +149 -0
  34. package/dist/admin/product-collection.d.ts.map +1 -1
  35. package/dist/admin/product-collection.js +149 -0
  36. package/dist/admin/product-collection.js.map +1 -1
  37. package/dist/esm/admin/notification.d.ts +80 -0
  38. package/dist/esm/admin/notification.d.ts.map +1 -1
  39. package/dist/esm/admin/notification.js +80 -0
  40. package/dist/esm/admin/notification.js.map +1 -1
  41. package/dist/esm/admin/order-edit.d.ts +166 -1
  42. package/dist/esm/admin/order-edit.d.ts.map +1 -1
  43. package/dist/esm/admin/order-edit.js +165 -0
  44. package/dist/esm/admin/order-edit.js.map +1 -1
  45. package/dist/esm/admin/order.d.ts +248 -22
  46. package/dist/esm/admin/order.d.ts.map +1 -1
  47. package/dist/esm/admin/order.js +240 -0
  48. package/dist/esm/admin/order.js.map +1 -1
  49. package/dist/esm/admin/payment-collection.d.ts +55 -0
  50. package/dist/esm/admin/payment-collection.d.ts.map +1 -1
  51. package/dist/esm/admin/payment-collection.js +55 -0
  52. package/dist/esm/admin/payment-collection.js.map +1 -1
  53. package/dist/esm/admin/payment.d.ts +162 -1
  54. package/dist/esm/admin/payment.d.ts.map +1 -1
  55. package/dist/esm/admin/payment.js +161 -0
  56. package/dist/esm/admin/payment.js.map +1 -1
  57. package/dist/esm/admin/price-list.d.ts +195 -1
  58. package/dist/esm/admin/price-list.d.ts.map +1 -1
  59. package/dist/esm/admin/price-list.js +194 -0
  60. package/dist/esm/admin/price-list.js.map +1 -1
  61. package/dist/esm/admin/price-preference.d.ts +133 -0
  62. package/dist/esm/admin/price-preference.d.ts.map +1 -1
  63. package/dist/esm/admin/price-preference.js +133 -0
  64. package/dist/esm/admin/price-preference.js.map +1 -1
  65. package/dist/esm/admin/product-category.d.ts +150 -0
  66. package/dist/esm/admin/product-category.d.ts.map +1 -1
  67. package/dist/esm/admin/product-category.js +150 -0
  68. package/dist/esm/admin/product-category.js.map +1 -1
  69. package/dist/esm/admin/product-collection.d.ts +149 -0
  70. package/dist/esm/admin/product-collection.d.ts.map +1 -1
  71. package/dist/esm/admin/product-collection.js +149 -0
  72. package/dist/esm/admin/product-collection.js.map +1 -1
  73. package/package.json +2 -2
@@ -14,6 +14,52 @@ export class Payment {
14
14
  constructor(client) {
15
15
  this.client = client;
16
16
  }
17
+ /**
18
+ * This method retrieves a paginated list of payments. It sends a request to the
19
+ * [List Payments](https://docs.medusajs.com/api/admin#payments_getpayments) API route.
20
+ *
21
+ * @param query - Filters and pagination configurations.
22
+ * @param headers - Headers to pass in the request.
23
+ * @returns The paginated list of payments.
24
+ *
25
+ * @example
26
+ * To retrieve the list of payments:
27
+ *
28
+ * ```ts
29
+ * sdk.admin.payment.list()
30
+ * .then(({ payments, count, limit, offset }) => {
31
+ * console.log(payments)
32
+ * })
33
+ * ```
34
+ *
35
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
36
+ *
37
+ * For example, to retrieve only 10 items and skip 10 items:
38
+ *
39
+ * ```ts
40
+ * sdk.admin.payment.list({
41
+ * limit: 10,
42
+ * offset: 10
43
+ * })
44
+ * .then(({ payments, count, limit, offset }) => {
45
+ * console.log(payments)
46
+ * })
47
+ * ```
48
+ *
49
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
50
+ * in each payment:
51
+ *
52
+ * ```ts
53
+ * sdk.admin.payment.list({
54
+ * fields: "id,*payment_collection"
55
+ * })
56
+ * .then(({ payments, count, limit, offset }) => {
57
+ * console.log(payments)
58
+ * })
59
+ * ```
60
+ *
61
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
62
+ */
17
63
  list(query, headers) {
18
64
  return __awaiter(this, void 0, void 0, function* () {
19
65
  return yield this.client.fetch(`/admin/payments`, {
@@ -22,6 +68,52 @@ export class Payment {
22
68
  });
23
69
  });
24
70
  }
71
+ /**
72
+ * This method retrieves a paginated list of payment providers. It sends a request to the
73
+ * [List Payment Providers](https://docs.medusajs.com/api/admin#payments_getpaymentspaymentproviders) API route.
74
+ *
75
+ * @param query - Filters and pagination configurations.
76
+ * @param headers - Headers to pass in the request.
77
+ * @returns The paginated list of payment providers.
78
+ *
79
+ * @example
80
+ * To retrieve the list of payment providers:
81
+ *
82
+ * ```ts
83
+ * sdk.admin.payment.listPaymentProviders()
84
+ * .then(({ payment_providers, count, limit, offset }) => {
85
+ * console.log(payment_providers)
86
+ * })
87
+ * ```
88
+ *
89
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
90
+ *
91
+ * For example, to retrieve only 10 items and skip 10 items:
92
+ *
93
+ * ```ts
94
+ * sdk.admin.payment.listPaymentProviders({
95
+ * limit: 10,
96
+ * offset: 10
97
+ * })
98
+ * .then(({ payment_providers, count, limit, offset }) => {
99
+ * console.log(payment_providers)
100
+ * })
101
+ * ```
102
+ *
103
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
104
+ * in each payment provider:
105
+ *
106
+ * ```ts
107
+ * sdk.admin.payment.listPaymentProviders({
108
+ * fields: "id,is_enabled"
109
+ * })
110
+ * .then(({ payment_providers, count, limit, offset }) => {
111
+ * console.log(payment_providers)
112
+ * })
113
+ * ```
114
+ *
115
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
116
+ */
25
117
  listPaymentProviders(query, headers) {
26
118
  return __awaiter(this, void 0, void 0, function* () {
27
119
  return yield this.client.fetch(`/admin/payments/payment-providers`, {
@@ -30,6 +122,39 @@ export class Payment {
30
122
  });
31
123
  });
32
124
  }
125
+ /**
126
+ * This method retrieves a payment's details. It sends a request to the
127
+ * [Get Payment](https://docs.medusajs.com/api/admin#payments_getpaymentsid)
128
+ * API route.
129
+ *
130
+ * @param id - The payment's ID.
131
+ * @param query - Configure the fields to retrieve in the payment.
132
+ * @param headers - Headers to pass in the request
133
+ * @returns The payment's details.
134
+ *
135
+ * @example
136
+ * To retrieve a payment by its ID:
137
+ *
138
+ * ```ts
139
+ * sdk.admin.payment.retrieve("pay_123")
140
+ * .then(({ payment }) => {
141
+ * console.log(payment)
142
+ * })
143
+ * ```
144
+ *
145
+ * To specify the fields and relations to retrieve:
146
+ *
147
+ * ```ts
148
+ * sdk.admin.payment.retrieve("pay_123", {
149
+ * fields: "id,*payment_collection"
150
+ * })
151
+ * .then(({ payment }) => {
152
+ * console.log(payment)
153
+ * })
154
+ * ```
155
+ *
156
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
157
+ */
33
158
  retrieve(id, query, headers) {
34
159
  return __awaiter(this, void 0, void 0, function* () {
35
160
  return yield this.client.fetch(`/admin/payments/${id}`, {
@@ -38,6 +163,24 @@ export class Payment {
38
163
  });
39
164
  });
40
165
  }
166
+ /**
167
+ * This method captures a payment. It sends a request to the
168
+ * [Capture Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidcapture) API route.
169
+ *
170
+ * The API route uses the `capturePayment` method of the payment provider associated with the payment's collection.
171
+ *
172
+ * @param id - The payment's ID.
173
+ * @param body - The capture's details.
174
+ * @param query - Configure the fields to retrieve in the payment.
175
+ * @param headers - Headers to pass in the request
176
+ * @returns The payment's details.
177
+ *
178
+ * @example
179
+ * sdk.admin.payment.capture("paycol_123", {})
180
+ * .then(({ payment }) => {
181
+ * console.log(payment)
182
+ * })
183
+ */
41
184
  capture(id, body, query, headers) {
42
185
  return __awaiter(this, void 0, void 0, function* () {
43
186
  return yield this.client.fetch(`/admin/payments/${id}/capture`, {
@@ -48,6 +191,24 @@ export class Payment {
48
191
  });
49
192
  });
50
193
  }
194
+ /**
195
+ * This method refunds a payment. It sends a request to the
196
+ * [Refund Payment](https://docs.medusajs.com/api/admin#payments_postpaymentsidrefund) API route.
197
+ *
198
+ * The API route uses the `refundPayment` method of the payment provider associated with the payment's collection.
199
+ *
200
+ * @param id - The payment's ID.
201
+ * @param body - The refund's details.
202
+ * @param query - Configure the fields to retrieve in the payment.
203
+ * @param headers - Headers to pass in the request
204
+ * @returns The payment's details.
205
+ *
206
+ * @example
207
+ * sdk.admin.payment.refund("paycol_123", {})
208
+ * .then(({ payment }) => {
209
+ * console.log(payment)
210
+ * })
211
+ */
51
212
  refund(id, body, query, headers) {
52
213
  return __awaiter(this, void 0, void 0, function* () {
53
214
  return yield this.client.fetch(`/admin/payments/${id}/refund`, {
@@ -1 +1 @@
1
- {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../src/admin/payment.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,OAAO;IAKlB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,IAAI,CAAC,KAAqC,EAAE,OAAuB;;YACvE,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,iBAAiB,EACjB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,oBAAoB,CACxB,KAAgD,EAChD,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mCAAmC,EACnC;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,QAAQ,CACZ,EAAU,EACV,KAAqC,EACrC,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,EAAE,EACvB;gBACE,KAAK;gBACL,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,OAAO,CACX,EAAU,EACV,IAAmC,EACnC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,UAAU,EAC/B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,EAAU,EACV,IAAkC,EAClC,KAAoB,EACpB,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
1
+ {"version":3,"file":"payment.js","sourceRoot":"","sources":["../../../src/admin/payment.ts"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AAM,CAAC,KAAK,CAC5B,mBAAmB,EAAE,SAAS,EAC9B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
@@ -10,12 +10,206 @@ export declare class PriceList {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method retrieves a price list. It sends a request to the
15
+ * [Get Price List](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelistsid)
16
+ * API route.
17
+ *
18
+ * @param id - The price list's ID.
19
+ * @param query - Configure the fields to retrieve in the price list.
20
+ * @param headers - Headers to pass in the request
21
+ * @returns The price list's details.
22
+ *
23
+ * @example
24
+ * To retrieve a price list by its ID:
25
+ *
26
+ * ```ts
27
+ * sdk.admin.priceList.retrieve("plist_123")
28
+ * .then(({ price_list }) => {
29
+ * console.log(price_list)
30
+ * })
31
+ * ```
32
+ *
33
+ * To specify the fields and relations to retrieve:
34
+ *
35
+ * ```ts
36
+ * sdk.admin.priceList.retrieve("plist_123", {
37
+ * fields: "id,*prices"
38
+ * })
39
+ * .then(({ price_list }) => {
40
+ * console.log(price_list)
41
+ * })
42
+ * ```
43
+ *
44
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
45
+ */
13
46
  retrieve(id: string, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
47
+ /**
48
+ * This method retrieves a paginated list of price lists. It sends a request to the
49
+ * [List Price Lists](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelists) API route.
50
+ *
51
+ * @param query - Filters and pagination configurations.
52
+ * @param headers - Headers to pass in the request.
53
+ * @returns The paginated list of price lists.
54
+ *
55
+ * @example
56
+ * To retrieve the list of price lists:
57
+ *
58
+ * ```ts
59
+ * sdk.admin.priceList.list()
60
+ * .then(({ price_lists, count, limit, offset }) => {
61
+ * console.log(price_lists)
62
+ * })
63
+ * ```
64
+ *
65
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
66
+ *
67
+ * For example, to retrieve only 10 items and skip 10 items:
68
+ *
69
+ * ```ts
70
+ * sdk.admin.priceList.list({
71
+ * limit: 10,
72
+ * offset: 10
73
+ * })
74
+ * .then(({ price_lists, count, limit, offset }) => {
75
+ * console.log(price_lists)
76
+ * })
77
+ * ```
78
+ *
79
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
80
+ * in each price list:
81
+ *
82
+ * ```ts
83
+ * sdk.admin.priceList.list({
84
+ * fields: "id,*prices"
85
+ * })
86
+ * .then(({ price_lists, count, limit, offset }) => {
87
+ * console.log(price_lists)
88
+ * })
89
+ * ```
90
+ *
91
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
92
+ */
14
93
  list(query?: HttpTypes.AdminPriceListListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListListResponse>;
94
+ /**
95
+ * This method creates a price list. It sends a request to the
96
+ * [Create Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelists)
97
+ * API route.
98
+ *
99
+ * @param body - The details of the price list to create.
100
+ * @param query - Configure the fields to retrieve in the price list.
101
+ * @param headers - Headers to pass in the request
102
+ * @returns The price list's details.
103
+ *
104
+ * @example
105
+ * sdk.admin.priceList.create({
106
+ * title: "My Price List",
107
+ * status: "active",
108
+ * type: "sale",
109
+ * prices: [
110
+ * {
111
+ * variant_id: "variant_123",
112
+ * amount: 10,
113
+ * currency_code: "usd",
114
+ * rules: {
115
+ * region_id: "reg_123"
116
+ * }
117
+ * }
118
+ * ]
119
+ * })
120
+ * .then(({ price_list }) => {
121
+ * console.log(price_list)
122
+ * })
123
+ */
15
124
  create(body: HttpTypes.AdminCreatePriceList, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
125
+ /**
126
+ * This method updates a price list. It sends a request to the
127
+ * [Update Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsid)
128
+ * API route.
129
+ *
130
+ * @param id - The price list's ID.
131
+ * @param body - The data to update in the price list.
132
+ * @param query - Configure the fields to retrieve in the price list.
133
+ * @param headers - Headers to pass in the request
134
+ * @returns The price list's details.
135
+ *
136
+ * @example
137
+ * sdk.admin.priceList.update("plist_123", {
138
+ * title: "My Price List",
139
+ * })
140
+ * .then(({ price_list }) => {
141
+ * console.log(price_list)
142
+ * })
143
+ */
16
144
  update(id: string, body: HttpTypes.AdminUpdatePriceList, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
145
+ /**
146
+ * This method deletes a price list. It sends a request to the
147
+ * [Delete Price List](https://docs.medusajs.com/v2/api/admin#price-lists_deletepricelistsid)
148
+ * API route.
149
+ *
150
+ * @param id - The price list's ID.
151
+ * @param headers - Headers to pass in the request
152
+ * @returns The deletion's details.
153
+ *
154
+ * @example
155
+ * sdk.admin.priceList.delete("plist_123")
156
+ * .then(({ deleted }) => {
157
+ * console.log(deleted)
158
+ * })
159
+ */
17
160
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListDeleteResponse>;
18
- batchPrices(id: string, body: HttpTypes.AdminBatchPriceListPrice, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
161
+ /**
162
+ * This method manages the prices of a price list to create, update, or delete them.
163
+ * It sends a request to the [Manage Prices](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidpricesbatch)
164
+ * API route.
165
+ *
166
+ * @param id - The price list's ID.
167
+ * @param body - The prices to create, update, or delete.
168
+ * @param query - Configure the fields to retrieve in the price list.
169
+ * @param headers - Headers to pass in the request
170
+ * @returns The price list's details.
171
+ *
172
+ * @example
173
+ * sdk.admin.priceList.batchPrices("plist_123", {
174
+ * create: [{
175
+ * variant_id: "variant_123",
176
+ * currency_code: "usd",
177
+ * amount: 10,
178
+ * rules: {
179
+ * region_id: "reg_123"
180
+ * }
181
+ * }],
182
+ * update: [{
183
+ * id: "price_123",
184
+ * variant_id: "variant_123",
185
+ * amount: 20,
186
+ * }],
187
+ * delete: ["price_123"]
188
+ * })
189
+ * .then(({ created, updated, deleted }) => {
190
+ * console.log(created, updated, deleted)
191
+ * })
192
+ */
193
+ batchPrices(id: string, body: HttpTypes.AdminBatchPriceListPrice, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListBatchResponse>;
194
+ /**
195
+ * This method removes products from a price list. It sends a request to the
196
+ * [Remove Product](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidproducts)
197
+ * API route.
198
+ *
199
+ * @param id - The price list's ID.
200
+ * @param body - The details of the products to remove.
201
+ * @param query - Configure the fields to retrieve in the price list.
202
+ * @param headers - Headers to pass in the request
203
+ * @returns The price list's details.
204
+ *
205
+ * @example
206
+ * sdk.admin.priceList.linkProducts("plist_123", {
207
+ * remove: ["prod_123"]
208
+ * })
209
+ * .then(({ price_list }) => {
210
+ * console.log(price_list)
211
+ * })
212
+ */
19
213
  linkProducts(id: string, body: HttpTypes.AdminLinkPriceListProducts, query?: HttpTypes.AdminPriceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPriceListResponse>;
20
214
  }
21
215
  //# sourceMappingURL=price-list.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"price-list.d.ts","sourceRoot":"","sources":["../../../src/admin/price-list.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;IAEtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAA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oB,EACtC,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,EAC1C,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,oBAAoB,EACpC,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,oBAAoB,EACpC,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAUhD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,WAAW,CACf,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,YAAY,CAChB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,0BAA0B,EAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;CAY1B"}
@@ -14,6 +14,39 @@ export class PriceList {
14
14
  constructor(client) {
15
15
  this.client = client;
16
16
  }
17
+ /**
18
+ * This method retrieves a price list. It sends a request to the
19
+ * [Get Price List](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelistsid)
20
+ * API route.
21
+ *
22
+ * @param id - The price list's ID.
23
+ * @param query - Configure the fields to retrieve in the price list.
24
+ * @param headers - Headers to pass in the request
25
+ * @returns The price list's details.
26
+ *
27
+ * @example
28
+ * To retrieve a price list by its ID:
29
+ *
30
+ * ```ts
31
+ * sdk.admin.priceList.retrieve("plist_123")
32
+ * .then(({ price_list }) => {
33
+ * console.log(price_list)
34
+ * })
35
+ * ```
36
+ *
37
+ * To specify the fields and relations to retrieve:
38
+ *
39
+ * ```ts
40
+ * sdk.admin.priceList.retrieve("plist_123", {
41
+ * fields: "id,*prices"
42
+ * })
43
+ * .then(({ price_list }) => {
44
+ * console.log(price_list)
45
+ * })
46
+ * ```
47
+ *
48
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
49
+ */
17
50
  retrieve(id, query, headers) {
18
51
  return __awaiter(this, void 0, void 0, function* () {
19
52
  return this.client.fetch(`/admin/price-lists/${id}`, {
@@ -23,6 +56,52 @@ export class PriceList {
23
56
  });
24
57
  });
25
58
  }
59
+ /**
60
+ * This method retrieves a paginated list of price lists. It sends a request to the
61
+ * [List Price Lists](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelists) API route.
62
+ *
63
+ * @param query - Filters and pagination configurations.
64
+ * @param headers - Headers to pass in the request.
65
+ * @returns The paginated list of price lists.
66
+ *
67
+ * @example
68
+ * To retrieve the list of price lists:
69
+ *
70
+ * ```ts
71
+ * sdk.admin.priceList.list()
72
+ * .then(({ price_lists, count, limit, offset }) => {
73
+ * console.log(price_lists)
74
+ * })
75
+ * ```
76
+ *
77
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
78
+ *
79
+ * For example, to retrieve only 10 items and skip 10 items:
80
+ *
81
+ * ```ts
82
+ * sdk.admin.priceList.list({
83
+ * limit: 10,
84
+ * offset: 10
85
+ * })
86
+ * .then(({ price_lists, count, limit, offset }) => {
87
+ * console.log(price_lists)
88
+ * })
89
+ * ```
90
+ *
91
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
92
+ * in each price list:
93
+ *
94
+ * ```ts
95
+ * sdk.admin.priceList.list({
96
+ * fields: "id,*prices"
97
+ * })
98
+ * .then(({ price_lists, count, limit, offset }) => {
99
+ * console.log(price_lists)
100
+ * })
101
+ * ```
102
+ *
103
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
104
+ */
26
105
  list(query, headers) {
27
106
  return __awaiter(this, void 0, void 0, function* () {
28
107
  return this.client.fetch(`/admin/price-lists`, {
@@ -32,6 +111,36 @@ export class PriceList {
32
111
  });
33
112
  });
34
113
  }
114
+ /**
115
+ * This method creates a price list. It sends a request to the
116
+ * [Create Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelists)
117
+ * API route.
118
+ *
119
+ * @param body - The details of the price list to create.
120
+ * @param query - Configure the fields to retrieve in the price list.
121
+ * @param headers - Headers to pass in the request
122
+ * @returns The price list's details.
123
+ *
124
+ * @example
125
+ * sdk.admin.priceList.create({
126
+ * title: "My Price List",
127
+ * status: "active",
128
+ * type: "sale",
129
+ * prices: [
130
+ * {
131
+ * variant_id: "variant_123",
132
+ * amount: 10,
133
+ * currency_code: "usd",
134
+ * rules: {
135
+ * region_id: "reg_123"
136
+ * }
137
+ * }
138
+ * ]
139
+ * })
140
+ * .then(({ price_list }) => {
141
+ * console.log(price_list)
142
+ * })
143
+ */
35
144
  create(body, query, headers) {
36
145
  return __awaiter(this, void 0, void 0, function* () {
37
146
  return this.client.fetch(`/admin/price-lists`, {
@@ -42,6 +151,25 @@ export class PriceList {
42
151
  });
43
152
  });
44
153
  }
154
+ /**
155
+ * This method updates a price list. It sends a request to the
156
+ * [Update Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsid)
157
+ * API route.
158
+ *
159
+ * @param id - The price list's ID.
160
+ * @param body - The data to update in the price list.
161
+ * @param query - Configure the fields to retrieve in the price list.
162
+ * @param headers - Headers to pass in the request
163
+ * @returns The price list's details.
164
+ *
165
+ * @example
166
+ * sdk.admin.priceList.update("plist_123", {
167
+ * title: "My Price List",
168
+ * })
169
+ * .then(({ price_list }) => {
170
+ * console.log(price_list)
171
+ * })
172
+ */
45
173
  update(id, body, query, headers) {
46
174
  return __awaiter(this, void 0, void 0, function* () {
47
175
  return this.client.fetch(`/admin/price-lists/${id}`, {
@@ -52,6 +180,21 @@ export class PriceList {
52
180
  });
53
181
  });
54
182
  }
183
+ /**
184
+ * This method deletes a price list. It sends a request to the
185
+ * [Delete Price List](https://docs.medusajs.com/v2/api/admin#price-lists_deletepricelistsid)
186
+ * API route.
187
+ *
188
+ * @param id - The price list's ID.
189
+ * @param headers - Headers to pass in the request
190
+ * @returns The deletion's details.
191
+ *
192
+ * @example
193
+ * sdk.admin.priceList.delete("plist_123")
194
+ * .then(({ deleted }) => {
195
+ * console.log(deleted)
196
+ * })
197
+ */
55
198
  delete(id, headers) {
56
199
  return __awaiter(this, void 0, void 0, function* () {
57
200
  return this.client.fetch(`/admin/price-lists/${id}`, {
@@ -60,6 +203,38 @@ export class PriceList {
60
203
  });
61
204
  });
62
205
  }
206
+ /**
207
+ * This method manages the prices of a price list to create, update, or delete them.
208
+ * It sends a request to the [Manage Prices](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidpricesbatch)
209
+ * API route.
210
+ *
211
+ * @param id - The price list's ID.
212
+ * @param body - The prices to create, update, or delete.
213
+ * @param query - Configure the fields to retrieve in the price list.
214
+ * @param headers - Headers to pass in the request
215
+ * @returns The price list's details.
216
+ *
217
+ * @example
218
+ * sdk.admin.priceList.batchPrices("plist_123", {
219
+ * create: [{
220
+ * variant_id: "variant_123",
221
+ * currency_code: "usd",
222
+ * amount: 10,
223
+ * rules: {
224
+ * region_id: "reg_123"
225
+ * }
226
+ * }],
227
+ * update: [{
228
+ * id: "price_123",
229
+ * variant_id: "variant_123",
230
+ * amount: 20,
231
+ * }],
232
+ * delete: ["price_123"]
233
+ * })
234
+ * .then(({ created, updated, deleted }) => {
235
+ * console.log(created, updated, deleted)
236
+ * })
237
+ */
63
238
  batchPrices(id, body, query, headers) {
64
239
  return __awaiter(this, void 0, void 0, function* () {
65
240
  return this.client.fetch(`/admin/price-lists/${id}/prices/batch`, {
@@ -70,6 +245,25 @@ export class PriceList {
70
245
  });
71
246
  });
72
247
  }
248
+ /**
249
+ * This method removes products from a price list. It sends a request to the
250
+ * [Remove Product](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidproducts)
251
+ * API route.
252
+ *
253
+ * @param id - The price list's ID.
254
+ * @param body - The details of the products to remove.
255
+ * @param query - Configure the fields to retrieve in the price list.
256
+ * @param headers - Headers to pass in the request
257
+ * @returns The price list's details.
258
+ *
259
+ * @example
260
+ * sdk.admin.priceList.linkProducts("plist_123", {
261
+ * remove: ["prod_123"]
262
+ * })
263
+ * .then(({ price_list }) => {
264
+ * console.log(price_list)
265
+ * })
266
+ */
73
267
  linkProducts(id, body, query, headers) {
74
268
  return __awaiter(this, void 0, void 0, function* () {
75
269
  return this.client.fetch(`/admin/price-lists/${id}/products`, {
@@ -1 +1 @@
1
- {"version":3,"file":"price-list.js","sourceRoot":"","sources":["../../../src/admin/price-list.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,SAAS;IAMpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,QAAQ,CACZ,EAAU,EACV,KAAsC,EACtC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,IAAI,CACR,KAA0C,EAC1C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,IAAoC,EACpC,KAAsC,EACtC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,EAAU,EACV,IAAoC,EACpC,KAAsC,EACtC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CAAC,EAAU,EAAE,OAAuB;;YAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAEK,WAAW,CACf,EAAU,EACV,IAAwC,EACxC,KAAsC,EACtC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,eAAe,EACvC;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,YAAY,CAChB,EAAU,EACV,IAA0C,EAC1C,KAAsC,EACtC,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,WAAW,EACnC;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
1
+ {"version":3,"file":"price-list.js","sourceRoot":"","sources":["../../../src/admin/price-list.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,SAAS;IAMpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CA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