@medusajs/js-sdk 2.0.0 → 2.0.1-preview-20241025150152

Sign up to get free protection for your applications and to get access to all the features.
Files changed (101) hide show
  1. package/dist/admin/api-key.d.ts +8 -8
  2. package/dist/admin/api-key.js +8 -8
  3. package/dist/admin/campaign.d.ts +8 -8
  4. package/dist/admin/campaign.js +8 -8
  5. package/dist/admin/claim.d.ts +22 -22
  6. package/dist/admin/claim.js +22 -22
  7. package/dist/admin/currency.d.ts +4 -4
  8. package/dist/admin/currency.js +4 -4
  9. package/dist/admin/customer-group.d.ts +8 -8
  10. package/dist/admin/customer-group.js +8 -8
  11. package/dist/admin/customer.d.ts +27 -7
  12. package/dist/admin/customer.d.ts.map +1 -1
  13. package/dist/admin/customer.js +33 -7
  14. package/dist/admin/customer.js.map +1 -1
  15. package/dist/admin/exchange.d.ts +21 -21
  16. package/dist/admin/exchange.js +21 -21
  17. package/dist/admin/fulfillment-provider.d.ts +2 -2
  18. package/dist/admin/fulfillment-provider.js +2 -2
  19. package/dist/admin/fulfillment-set.d.ts +6 -6
  20. package/dist/admin/fulfillment-set.js +6 -6
  21. package/dist/admin/fulfillment.d.ts +3 -3
  22. package/dist/admin/fulfillment.js +3 -3
  23. package/dist/admin/inventory-item.d.ts +12 -12
  24. package/dist/admin/inventory-item.js +12 -12
  25. package/dist/admin/invite.d.ts +8 -8
  26. package/dist/admin/invite.js +8 -8
  27. package/dist/admin/payment-collection.d.ts +0 -2
  28. package/dist/admin/payment-collection.d.ts.map +1 -1
  29. package/dist/admin/payment-collection.js +0 -12
  30. package/dist/admin/payment-collection.js.map +1 -1
  31. package/dist/admin/price-list.d.ts +195 -1
  32. package/dist/admin/price-list.d.ts.map +1 -1
  33. package/dist/admin/price-list.js +194 -0
  34. package/dist/admin/price-list.js.map +1 -1
  35. package/dist/admin/price-preference.d.ts +133 -0
  36. package/dist/admin/price-preference.d.ts.map +1 -1
  37. package/dist/admin/price-preference.js +133 -0
  38. package/dist/admin/price-preference.js.map +1 -1
  39. package/dist/admin/product-category.d.ts +150 -0
  40. package/dist/admin/product-category.d.ts.map +1 -1
  41. package/dist/admin/product-category.js +150 -0
  42. package/dist/admin/product-category.js.map +1 -1
  43. package/dist/admin/product-collection.d.ts +149 -0
  44. package/dist/admin/product-collection.d.ts.map +1 -1
  45. package/dist/admin/product-collection.js +149 -0
  46. package/dist/admin/product-collection.js.map +1 -1
  47. package/dist/auth/index.d.ts +10 -10
  48. package/dist/auth/index.js +10 -10
  49. package/dist/esm/admin/api-key.d.ts +8 -8
  50. package/dist/esm/admin/api-key.js +8 -8
  51. package/dist/esm/admin/campaign.d.ts +8 -8
  52. package/dist/esm/admin/campaign.js +8 -8
  53. package/dist/esm/admin/claim.d.ts +22 -22
  54. package/dist/esm/admin/claim.js +22 -22
  55. package/dist/esm/admin/currency.d.ts +4 -4
  56. package/dist/esm/admin/currency.js +4 -4
  57. package/dist/esm/admin/customer-group.d.ts +8 -8
  58. package/dist/esm/admin/customer-group.js +8 -8
  59. package/dist/esm/admin/customer.d.ts +27 -7
  60. package/dist/esm/admin/customer.d.ts.map +1 -1
  61. package/dist/esm/admin/customer.js +35 -7
  62. package/dist/esm/admin/customer.js.map +1 -1
  63. package/dist/esm/admin/exchange.d.ts +21 -21
  64. package/dist/esm/admin/exchange.js +21 -21
  65. package/dist/esm/admin/fulfillment-provider.d.ts +2 -2
  66. package/dist/esm/admin/fulfillment-provider.js +2 -2
  67. package/dist/esm/admin/fulfillment-set.d.ts +6 -6
  68. package/dist/esm/admin/fulfillment-set.js +6 -6
  69. package/dist/esm/admin/fulfillment.d.ts +3 -3
  70. package/dist/esm/admin/fulfillment.js +3 -3
  71. package/dist/esm/admin/inventory-item.d.ts +12 -12
  72. package/dist/esm/admin/inventory-item.js +12 -12
  73. package/dist/esm/admin/invite.d.ts +8 -8
  74. package/dist/esm/admin/invite.js +8 -8
  75. package/dist/esm/admin/payment-collection.d.ts +0 -2
  76. package/dist/esm/admin/payment-collection.d.ts.map +1 -1
  77. package/dist/esm/admin/payment-collection.js +0 -16
  78. package/dist/esm/admin/payment-collection.js.map +1 -1
  79. package/dist/esm/admin/price-list.d.ts +195 -1
  80. package/dist/esm/admin/price-list.d.ts.map +1 -1
  81. package/dist/esm/admin/price-list.js +194 -0
  82. package/dist/esm/admin/price-list.js.map +1 -1
  83. package/dist/esm/admin/price-preference.d.ts +133 -0
  84. package/dist/esm/admin/price-preference.d.ts.map +1 -1
  85. package/dist/esm/admin/price-preference.js +133 -0
  86. package/dist/esm/admin/price-preference.js.map +1 -1
  87. package/dist/esm/admin/product-category.d.ts +150 -0
  88. package/dist/esm/admin/product-category.d.ts.map +1 -1
  89. package/dist/esm/admin/product-category.js +150 -0
  90. package/dist/esm/admin/product-category.js.map +1 -1
  91. package/dist/esm/admin/product-collection.d.ts +149 -0
  92. package/dist/esm/admin/product-collection.d.ts.map +1 -1
  93. package/dist/esm/admin/product-collection.js +149 -0
  94. package/dist/esm/admin/product-collection.js.map +1 -1
  95. package/dist/esm/auth/index.d.ts +10 -10
  96. package/dist/esm/auth/index.js +10 -10
  97. package/dist/esm/store/index.d.ts +73 -73
  98. package/dist/esm/store/index.js +73 -73
  99. package/dist/store/index.d.ts +73 -73
  100. package/dist/store/index.js +73 -73
  101. package/package.json +2 -2
@@ -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,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAYnB,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,wBAAwB,EAC1C,OAAO,CAAC,EAAE,aAAa;IAYnB,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,oBAAoB,EACpC,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,oBAAoB,EACpC,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAU1C,WAAW,CACf,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,wBAAwB,EACxC,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,EACtC,OAAO,CAAC,EAAE,aAAa;IAanB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Aa;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,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,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;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,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;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACG,MAAM,CACV,IAAoC,EACpC,KAAsC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{
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method retrieves a price preference. It sends a request to the
15
+ * [Get Price Preference](https://docs.medusajs.com/api/admin#price-preferences_getpricepreferencesid)
16
+ * API route.
17
+ *
18
+ * @param id - The price preference's ID.
19
+ * @param query - Configure the fields to retrieve in the price preference.
20
+ * @param headers - Headers to pass in the request
21
+ * @returns The price preference's details.
22
+ *
23
+ * @example
24
+ * To retrieve a price preference by its ID:
25
+ *
26
+ * ```ts
27
+ * sdk.admin.pricePreference.retrieve("prpref_123")
28
+ * .then(({ price_preference }) => {
29
+ * console.log(price_preference)
30
+ * })
31
+ * ```
32
+ *
33
+ * To specify the fields and relations to retrieve:
34
+ *
35
+ * ```ts
36
+ * sdk.admin.pricePreference.retrieve("prpref_123", {
37
+ * fields: "id,is_tax_inclusive"
38
+ * })
39
+ * .then(({ price_preference }) => {
40
+ * console.log(price_preference)
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.AdminPricePreferenceParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPricePreferenceResponse>;
47
+ /**
48
+ * This method retrieves a paginated list of price preferences. It sends a request to the
49
+ * [List Price Preferences](https://docs.medusajs.com/api/admin#price-preferences_getpricepreferences) 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 preferences.
54
+ *
55
+ * @example
56
+ * To retrieve the list of price preferences:
57
+ *
58
+ * ```ts
59
+ * sdk.admin.pricePreference.list()
60
+ * .then(({ price_preferences, count, limit, offset }) => {
61
+ * console.log(price_preferences)
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.pricePreference.list({
71
+ * limit: 10,
72
+ * offset: 10
73
+ * })
74
+ * .then(({ price_preferences, count, limit, offset }) => {
75
+ * console.log(price_preferences)
76
+ * })
77
+ * ```
78
+ *
79
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
80
+ * in each price preference:
81
+ *
82
+ * ```ts
83
+ * sdk.admin.pricePreference.list({
84
+ * fields: "id,is_tax_inclusive"
85
+ * })
86
+ * .then(({ price_preferences, count, limit, offset }) => {
87
+ * console.log(price_preferences)
88
+ * })
89
+ * ```
90
+ *
91
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
92
+ */
14
93
  list(query?: HttpTypes.AdminPricePreferenceListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPricePreferenceListResponse>;
94
+ /**
95
+ * This method creates a price preference. It sends a request to the
96
+ * [Create Price Preference](https://docs.medusajs.com/api/admin#price-preferences_postpricepreferences)
97
+ * API route.
98
+ *
99
+ * @param body - The details of the price preference to create.
100
+ * @param query - Configure the fields to retrieve in the price preference.
101
+ * @param headers - Headers to pass in the request
102
+ * @returns The price preference's details.
103
+ *
104
+ * @example
105
+ * sdk.admin.pricePreference.create({
106
+ * attribute: "region_id",
107
+ * value: "region_123",
108
+ * is_tax_inclusive: true
109
+ * })
110
+ * .then(({ price_preference }) => {
111
+ * console.log(price_preference)
112
+ * })
113
+ */
15
114
  create(body: HttpTypes.AdminCreatePricePreference, query?: HttpTypes.AdminPricePreferenceParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPricePreferenceResponse>;
115
+ /**
116
+ * This method updates a price preference. It sends a request to the
117
+ * [Update Price Preference](https://docs.medusajs.com/api/admin#price-preferences_postpricepreferencesid)
118
+ * API route.
119
+ *
120
+ * @param id - The price preference's ID.
121
+ * @param body - The data to update in the price preference.
122
+ * @param query - Configure the fields to retrieve in the price preference.
123
+ * @param headers - Headers to pass in the request
124
+ * @returns The price preference's details.
125
+ *
126
+ * @example
127
+ * sdk.admin.pricePreference.update("prpref_123", {
128
+ * is_tax_inclusive: true
129
+ * })
130
+ * .then(({ price_preference }) => {
131
+ * console.log(price_preference)
132
+ * })
133
+ */
16
134
  update(id: string, body: HttpTypes.AdminUpdatePricePreference, query?: HttpTypes.AdminPricePreferenceParams, headers?: ClientHeaders): Promise<HttpTypes.AdminPricePreferenceResponse>;
135
+ /**
136
+ * This method deletes a price preference. It sends a request to the
137
+ * [Delete Price Preference](https://docs.medusajs.com/api/admin#price-preferences_deletepricepreferencesid)
138
+ * API route.
139
+ *
140
+ * @param id - The price preference's ID.
141
+ * @param headers - Headers to pass in the request
142
+ * @returns The deletion's details.
143
+ *
144
+ * @example
145
+ * sdk.admin.pricePreference.delete("prpref_123")
146
+ * .then(({ deleted }) => {
147
+ * console.log(deleted)
148
+ * })
149
+ */
17
150
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminPricePreferenceDeleteResponse>;
18
151
  }
19
152
  //# sourceMappingURL=price-preference.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"price-preference.d.ts","sourceRoot":"","sources":["../../../src/admin/price-preference.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,eAAe;IAC1B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IAEtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,EAC5C,OAAO,CAAC,EAAE,aAAa;IAYnB,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,8BAA8B,EAChD,OAAO,CAAC,EAAE,aAAa;IAYnB,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,0BAA0B,EAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,E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