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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. package/dist/admin/price-list.d.ts +195 -1
  2. package/dist/admin/price-list.d.ts.map +1 -1
  3. package/dist/admin/price-list.js +194 -0
  4. package/dist/admin/price-list.js.map +1 -1
  5. package/dist/admin/price-preference.d.ts +133 -0
  6. package/dist/admin/price-preference.d.ts.map +1 -1
  7. package/dist/admin/price-preference.js +133 -0
  8. package/dist/admin/price-preference.js.map +1 -1
  9. package/dist/admin/product-category.d.ts +150 -0
  10. package/dist/admin/product-category.d.ts.map +1 -1
  11. package/dist/admin/product-category.js +150 -0
  12. package/dist/admin/product-category.js.map +1 -1
  13. package/dist/admin/product-collection.d.ts +149 -0
  14. package/dist/admin/product-collection.d.ts.map +1 -1
  15. package/dist/admin/product-collection.js +149 -0
  16. package/dist/admin/product-collection.js.map +1 -1
  17. package/dist/esm/admin/price-list.d.ts +195 -1
  18. package/dist/esm/admin/price-list.d.ts.map +1 -1
  19. package/dist/esm/admin/price-list.js +194 -0
  20. package/dist/esm/admin/price-list.js.map +1 -1
  21. package/dist/esm/admin/price-preference.d.ts +133 -0
  22. package/dist/esm/admin/price-preference.d.ts.map +1 -1
  23. package/dist/esm/admin/price-preference.js +133 -0
  24. package/dist/esm/admin/price-preference.js.map +1 -1
  25. package/dist/esm/admin/product-category.d.ts +150 -0
  26. package/dist/esm/admin/product-category.d.ts.map +1 -1
  27. package/dist/esm/admin/product-category.js +150 -0
  28. package/dist/esm/admin/product-category.js.map +1 -1
  29. package/dist/esm/admin/product-collection.d.ts +149 -0
  30. package/dist/esm/admin/product-collection.d.ts.map +1 -1
  31. package/dist/esm/admin/product-collection.js +149 -0
  32. package/dist/esm/admin/product-collection.js.map +1 -1
  33. package/package.json +2 -2
@@ -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,EACp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;YAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACG,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;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACG,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"}
@@ -10,10 +10,143 @@ export declare class PricePreference {
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,EAC5C,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,0BAA0B,EAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,EAC5C,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
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;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,EAC5C,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,KAAK,CAAC,EAAE,SAAS,CAAC,8BAA8B,EAChD,OAAO,CAAC,EAAE,aAAa;IAYzB;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,0BAA0B,EAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,EAC5C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;;;;;OAkBG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,0BAA0B,EAC1C,KAAK,CAAC,EAAE,SAAS,CAAC,0BAA0B,EAC5C,OAAO,CAAC,EAAE,aAAa;IAazB;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;CASjD"}
@@ -14,6 +14,39 @@ export class PricePreference {
14
14
  constructor(client) {
15
15
  this.client = client;
16
16
  }
17
+ /**
18
+ * This method retrieves a price preference. It sends a request to the
19
+ * [Get Price Preference](https://docs.medusajs.com/api/admin#price-preferences_getpricepreferencesid)
20
+ * API route.
21
+ *
22
+ * @param id - The price preference's ID.
23
+ * @param query - Configure the fields to retrieve in the price preference.
24
+ * @param headers - Headers to pass in the request
25
+ * @returns The price preference's details.
26
+ *
27
+ * @example
28
+ * To retrieve a price preference by its ID:
29
+ *
30
+ * ```ts
31
+ * sdk.admin.pricePreference.retrieve("prpref_123")
32
+ * .then(({ price_preference }) => {
33
+ * console.log(price_preference)
34
+ * })
35
+ * ```
36
+ *
37
+ * To specify the fields and relations to retrieve:
38
+ *
39
+ * ```ts
40
+ * sdk.admin.pricePreference.retrieve("prpref_123", {
41
+ * fields: "id,is_tax_inclusive"
42
+ * })
43
+ * .then(({ price_preference }) => {
44
+ * console.log(price_preference)
45
+ * })
46
+ * ```
47
+ *
48
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/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-preferences/${id}`, {
@@ -23,6 +56,52 @@ export class PricePreference {
23
56
  });
24
57
  });
25
58
  }
59
+ /**
60
+ * This method retrieves a paginated list of price preferences. It sends a request to the
61
+ * [List Price Preferences](https://docs.medusajs.com/api/admin#price-preferences_getpricepreferences) 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 preferences.
66
+ *
67
+ * @example
68
+ * To retrieve the list of price preferences:
69
+ *
70
+ * ```ts
71
+ * sdk.admin.pricePreference.list()
72
+ * .then(({ price_preferences, count, limit, offset }) => {
73
+ * console.log(price_preferences)
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.pricePreference.list({
83
+ * limit: 10,
84
+ * offset: 10
85
+ * })
86
+ * .then(({ price_preferences, count, limit, offset }) => {
87
+ * console.log(price_preferences)
88
+ * })
89
+ * ```
90
+ *
91
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
92
+ * in each price preference:
93
+ *
94
+ * ```ts
95
+ * sdk.admin.pricePreference.list({
96
+ * fields: "id,is_tax_inclusive"
97
+ * })
98
+ * .then(({ price_preferences, count, limit, offset }) => {
99
+ * console.log(price_preferences)
100
+ * })
101
+ * ```
102
+ *
103
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/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-preferences`, {
@@ -32,6 +111,26 @@ export class PricePreference {
32
111
  });
33
112
  });
34
113
  }
114
+ /**
115
+ * This method creates a price preference. It sends a request to the
116
+ * [Create Price Preference](https://docs.medusajs.com/api/admin#price-preferences_postpricepreferences)
117
+ * API route.
118
+ *
119
+ * @param body - The details of the price preference to create.
120
+ * @param query - Configure the fields to retrieve in the price preference.
121
+ * @param headers - Headers to pass in the request
122
+ * @returns The price preference's details.
123
+ *
124
+ * @example
125
+ * sdk.admin.pricePreference.create({
126
+ * attribute: "region_id",
127
+ * value: "region_123",
128
+ * is_tax_inclusive: true
129
+ * })
130
+ * .then(({ price_preference }) => {
131
+ * console.log(price_preference)
132
+ * })
133
+ */
35
134
  create(body, query, headers) {
36
135
  return __awaiter(this, void 0, void 0, function* () {
37
136
  return this.client.fetch(`/admin/price-preferences`, {
@@ -42,6 +141,25 @@ export class PricePreference {
42
141
  });
43
142
  });
44
143
  }
144
+ /**
145
+ * This method updates a price preference. It sends a request to the
146
+ * [Update Price Preference](https://docs.medusajs.com/api/admin#price-preferences_postpricepreferencesid)
147
+ * API route.
148
+ *
149
+ * @param id - The price preference's ID.
150
+ * @param body - The data to update in the price preference.
151
+ * @param query - Configure the fields to retrieve in the price preference.
152
+ * @param headers - Headers to pass in the request
153
+ * @returns The price preference's details.
154
+ *
155
+ * @example
156
+ * sdk.admin.pricePreference.update("prpref_123", {
157
+ * is_tax_inclusive: true
158
+ * })
159
+ * .then(({ price_preference }) => {
160
+ * console.log(price_preference)
161
+ * })
162
+ */
45
163
  update(id, body, query, headers) {
46
164
  return __awaiter(this, void 0, void 0, function* () {
47
165
  return this.client.fetch(`/admin/price-preferences/${id}`, {
@@ -52,6 +170,21 @@ export class PricePreference {
52
170
  });
53
171
  });
54
172
  }
173
+ /**
174
+ * This method deletes a price preference. It sends a request to the
175
+ * [Delete Price Preference](https://docs.medusajs.com/api/admin#price-preferences_deletepricepreferencesid)
176
+ * API route.
177
+ *
178
+ * @param id - The price preference's ID.
179
+ * @param headers - Headers to pass in the request
180
+ * @returns The deletion's details.
181
+ *
182
+ * @example
183
+ * sdk.admin.pricePreference.delete("prpref_123")
184
+ * .then(({ deleted }) => {
185
+ * console.log(deleted)
186
+ * })
187
+ */
55
188
  delete(id, headers) {
56
189
  return __awaiter(this, void 0, void 0, function* () {
57
190
  return this.client.fetch(`/admin/price-preferences/${id}`, {
@@ -1 +1 @@
1
- {"version":3,"file":"price-preference.js","sourceRoot":"","sources":["../../../src/admin/price-preference.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,eAAe;IAM1B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAEK,QAAQ,CACZ,EAAU,EACV,KAA4C,EAC5C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,IAAI,CACR,KAAgD,EAChD,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAAI;gBACJ,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAEK,MAAM,CACV,EAAU,EACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;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,4BAA4B,EAAE,EAAE,EAChC;gBACE,MAAM,EAAE,QAAQ;gBAChB,OAAO;aACR,CACF,CAAA;QACH,CAAC;KAAA;CACF"}
1
+ {"version":3,"file":"price-preference.js","sourceRoot":"","sources":["../../../src/admin/price-preference.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,eAAe;IAM1B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAU,EACV,KAA4C,EAC5C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACG,IAAI,CACR,KAAgD,EAChD,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;gBACE,MAAM,EAAE,KAAK;gBACb,OAAO;gBACP,KAAK;aACN,CACF,CAAA;QACH,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACG,MAAM,CACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;;YAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BA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