@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.
- package/dist/admin/notification.d.ts +80 -0
- package/dist/admin/notification.d.ts.map +1 -1
- package/dist/admin/notification.js +80 -0
- package/dist/admin/notification.js.map +1 -1
- package/dist/admin/order-edit.d.ts +166 -1
- package/dist/admin/order-edit.d.ts.map +1 -1
- package/dist/admin/order-edit.js +165 -0
- package/dist/admin/order-edit.js.map +1 -1
- package/dist/admin/order.d.ts +248 -22
- package/dist/admin/order.d.ts.map +1 -1
- package/dist/admin/order.js +240 -0
- package/dist/admin/order.js.map +1 -1
- package/dist/admin/payment-collection.d.ts +55 -0
- package/dist/admin/payment-collection.d.ts.map +1 -1
- package/dist/admin/payment-collection.js +55 -0
- package/dist/admin/payment-collection.js.map +1 -1
- package/dist/admin/payment.d.ts +162 -1
- package/dist/admin/payment.d.ts.map +1 -1
- package/dist/admin/payment.js +161 -0
- package/dist/admin/payment.js.map +1 -1
- package/dist/admin/price-list.d.ts +195 -1
- package/dist/admin/price-list.d.ts.map +1 -1
- package/dist/admin/price-list.js +194 -0
- package/dist/admin/price-list.js.map +1 -1
- package/dist/admin/price-preference.d.ts +133 -0
- package/dist/admin/price-preference.d.ts.map +1 -1
- package/dist/admin/price-preference.js +133 -0
- package/dist/admin/price-preference.js.map +1 -1
- package/dist/admin/product-category.d.ts +150 -0
- package/dist/admin/product-category.d.ts.map +1 -1
- package/dist/admin/product-category.js +150 -0
- package/dist/admin/product-category.js.map +1 -1
- package/dist/admin/product-collection.d.ts +149 -0
- package/dist/admin/product-collection.d.ts.map +1 -1
- package/dist/admin/product-collection.js +149 -0
- package/dist/admin/product-collection.js.map +1 -1
- package/dist/esm/admin/notification.d.ts +80 -0
- package/dist/esm/admin/notification.d.ts.map +1 -1
- package/dist/esm/admin/notification.js +80 -0
- package/dist/esm/admin/notification.js.map +1 -1
- package/dist/esm/admin/order-edit.d.ts +166 -1
- package/dist/esm/admin/order-edit.d.ts.map +1 -1
- package/dist/esm/admin/order-edit.js +165 -0
- package/dist/esm/admin/order-edit.js.map +1 -1
- package/dist/esm/admin/order.d.ts +248 -22
- package/dist/esm/admin/order.d.ts.map +1 -1
- package/dist/esm/admin/order.js +240 -0
- package/dist/esm/admin/order.js.map +1 -1
- package/dist/esm/admin/payment-collection.d.ts +55 -0
- package/dist/esm/admin/payment-collection.d.ts.map +1 -1
- package/dist/esm/admin/payment-collection.js +55 -0
- package/dist/esm/admin/payment-collection.js.map +1 -1
- package/dist/esm/admin/payment.d.ts +162 -1
- package/dist/esm/admin/payment.d.ts.map +1 -1
- package/dist/esm/admin/payment.js +161 -0
- package/dist/esm/admin/payment.js.map +1 -1
- package/dist/esm/admin/price-list.d.ts +195 -1
- package/dist/esm/admin/price-list.d.ts.map +1 -1
- package/dist/esm/admin/price-list.js +194 -0
- package/dist/esm/admin/price-list.js.map +1 -1
- package/dist/esm/admin/price-preference.d.ts +133 -0
- package/dist/esm/admin/price-preference.d.ts.map +1 -1
- package/dist/esm/admin/price-preference.js +133 -0
- package/dist/esm/admin/price-preference.js.map +1 -1
- package/dist/esm/admin/product-category.d.ts +150 -0
- package/dist/esm/admin/product-category.d.ts.map +1 -1
- package/dist/esm/admin/product-category.js +150 -0
- package/dist/esm/admin/product-category.js.map +1 -1
- package/dist/esm/admin/product-collection.d.ts +149 -0
- package/dist/esm/admin/product-collection.d.ts.map +1 -1
- package/dist/esm/admin/product-collection.js +149 -0
- package/dist/esm/admin/product-collection.js.map +1 -1
- package/package.json +2 -2
package/dist/admin/price-list.js
CHANGED
@@ -8,6 +8,39 @@ class PriceList {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method retrieves a price list. It sends a request to the
|
13
|
+
* [Get Price List](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelistsid)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param id - The price list's ID.
|
17
|
+
* @param query - Configure the fields to retrieve in the price list.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The price list's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* To retrieve a price list by its ID:
|
23
|
+
*
|
24
|
+
* ```ts
|
25
|
+
* sdk.admin.priceList.retrieve("plist_123")
|
26
|
+
* .then(({ price_list }) => {
|
27
|
+
* console.log(price_list)
|
28
|
+
* })
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* To specify the fields and relations to retrieve:
|
32
|
+
*
|
33
|
+
* ```ts
|
34
|
+
* sdk.admin.priceList.retrieve("plist_123", {
|
35
|
+
* fields: "id,*prices"
|
36
|
+
* })
|
37
|
+
* .then(({ price_list }) => {
|
38
|
+
* console.log(price_list)
|
39
|
+
* })
|
40
|
+
* ```
|
41
|
+
*
|
42
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
43
|
+
*/
|
11
44
|
async retrieve(id, query, headers) {
|
12
45
|
return this.client.fetch(`/admin/price-lists/${id}`, {
|
13
46
|
method: "GET",
|
@@ -15,6 +48,52 @@ class PriceList {
|
|
15
48
|
query,
|
16
49
|
});
|
17
50
|
}
|
51
|
+
/**
|
52
|
+
* This method retrieves a paginated list of price lists. It sends a request to the
|
53
|
+
* [List Price Lists](https://docs.medusajs.com/v2/api/admin#price-lists_getpricelists) API route.
|
54
|
+
*
|
55
|
+
* @param query - Filters and pagination configurations.
|
56
|
+
* @param headers - Headers to pass in the request.
|
57
|
+
* @returns The paginated list of price lists.
|
58
|
+
*
|
59
|
+
* @example
|
60
|
+
* To retrieve the list of price lists:
|
61
|
+
*
|
62
|
+
* ```ts
|
63
|
+
* sdk.admin.priceList.list()
|
64
|
+
* .then(({ price_lists, count, limit, offset }) => {
|
65
|
+
* console.log(price_lists)
|
66
|
+
* })
|
67
|
+
* ```
|
68
|
+
*
|
69
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
70
|
+
*
|
71
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
72
|
+
*
|
73
|
+
* ```ts
|
74
|
+
* sdk.admin.priceList.list({
|
75
|
+
* limit: 10,
|
76
|
+
* offset: 10
|
77
|
+
* })
|
78
|
+
* .then(({ price_lists, count, limit, offset }) => {
|
79
|
+
* console.log(price_lists)
|
80
|
+
* })
|
81
|
+
* ```
|
82
|
+
*
|
83
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
84
|
+
* in each price list:
|
85
|
+
*
|
86
|
+
* ```ts
|
87
|
+
* sdk.admin.priceList.list({
|
88
|
+
* fields: "id,*prices"
|
89
|
+
* })
|
90
|
+
* .then(({ price_lists, count, limit, offset }) => {
|
91
|
+
* console.log(price_lists)
|
92
|
+
* })
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
96
|
+
*/
|
18
97
|
async list(query, headers) {
|
19
98
|
return this.client.fetch(`/admin/price-lists`, {
|
20
99
|
method: "GET",
|
@@ -22,6 +101,36 @@ class PriceList {
|
|
22
101
|
query,
|
23
102
|
});
|
24
103
|
}
|
104
|
+
/**
|
105
|
+
* This method creates a price list. It sends a request to the
|
106
|
+
* [Create Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelists)
|
107
|
+
* API route.
|
108
|
+
*
|
109
|
+
* @param body - The details of the price list to create.
|
110
|
+
* @param query - Configure the fields to retrieve in the price list.
|
111
|
+
* @param headers - Headers to pass in the request
|
112
|
+
* @returns The price list's details.
|
113
|
+
*
|
114
|
+
* @example
|
115
|
+
* sdk.admin.priceList.create({
|
116
|
+
* title: "My Price List",
|
117
|
+
* status: "active",
|
118
|
+
* type: "sale",
|
119
|
+
* prices: [
|
120
|
+
* {
|
121
|
+
* variant_id: "variant_123",
|
122
|
+
* amount: 10,
|
123
|
+
* currency_code: "usd",
|
124
|
+
* rules: {
|
125
|
+
* region_id: "reg_123"
|
126
|
+
* }
|
127
|
+
* }
|
128
|
+
* ]
|
129
|
+
* })
|
130
|
+
* .then(({ price_list }) => {
|
131
|
+
* console.log(price_list)
|
132
|
+
* })
|
133
|
+
*/
|
25
134
|
async create(body, query, headers) {
|
26
135
|
return this.client.fetch(`/admin/price-lists`, {
|
27
136
|
method: "POST",
|
@@ -30,6 +139,25 @@ class PriceList {
|
|
30
139
|
query,
|
31
140
|
});
|
32
141
|
}
|
142
|
+
/**
|
143
|
+
* This method updates a price list. It sends a request to the
|
144
|
+
* [Update Price List](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsid)
|
145
|
+
* API route.
|
146
|
+
*
|
147
|
+
* @param id - The price list's ID.
|
148
|
+
* @param body - The data to update in the price list.
|
149
|
+
* @param query - Configure the fields to retrieve in the price list.
|
150
|
+
* @param headers - Headers to pass in the request
|
151
|
+
* @returns The price list's details.
|
152
|
+
*
|
153
|
+
* @example
|
154
|
+
* sdk.admin.priceList.update("plist_123", {
|
155
|
+
* title: "My Price List",
|
156
|
+
* })
|
157
|
+
* .then(({ price_list }) => {
|
158
|
+
* console.log(price_list)
|
159
|
+
* })
|
160
|
+
*/
|
33
161
|
async update(id, body, query, headers) {
|
34
162
|
return this.client.fetch(`/admin/price-lists/${id}`, {
|
35
163
|
method: "POST",
|
@@ -38,12 +166,59 @@ class PriceList {
|
|
38
166
|
query,
|
39
167
|
});
|
40
168
|
}
|
169
|
+
/**
|
170
|
+
* This method deletes a price list. It sends a request to the
|
171
|
+
* [Delete Price List](https://docs.medusajs.com/v2/api/admin#price-lists_deletepricelistsid)
|
172
|
+
* API route.
|
173
|
+
*
|
174
|
+
* @param id - The price list's ID.
|
175
|
+
* @param headers - Headers to pass in the request
|
176
|
+
* @returns The deletion's details.
|
177
|
+
*
|
178
|
+
* @example
|
179
|
+
* sdk.admin.priceList.delete("plist_123")
|
180
|
+
* .then(({ deleted }) => {
|
181
|
+
* console.log(deleted)
|
182
|
+
* })
|
183
|
+
*/
|
41
184
|
async delete(id, headers) {
|
42
185
|
return this.client.fetch(`/admin/price-lists/${id}`, {
|
43
186
|
method: "DELETE",
|
44
187
|
headers,
|
45
188
|
});
|
46
189
|
}
|
190
|
+
/**
|
191
|
+
* This method manages the prices of a price list to create, update, or delete them.
|
192
|
+
* It sends a request to the [Manage Prices](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidpricesbatch)
|
193
|
+
* API route.
|
194
|
+
*
|
195
|
+
* @param id - The price list's ID.
|
196
|
+
* @param body - The prices to create, update, or delete.
|
197
|
+
* @param query - Configure the fields to retrieve in the price list.
|
198
|
+
* @param headers - Headers to pass in the request
|
199
|
+
* @returns The price list's details.
|
200
|
+
*
|
201
|
+
* @example
|
202
|
+
* sdk.admin.priceList.batchPrices("plist_123", {
|
203
|
+
* create: [{
|
204
|
+
* variant_id: "variant_123",
|
205
|
+
* currency_code: "usd",
|
206
|
+
* amount: 10,
|
207
|
+
* rules: {
|
208
|
+
* region_id: "reg_123"
|
209
|
+
* }
|
210
|
+
* }],
|
211
|
+
* update: [{
|
212
|
+
* id: "price_123",
|
213
|
+
* variant_id: "variant_123",
|
214
|
+
* amount: 20,
|
215
|
+
* }],
|
216
|
+
* delete: ["price_123"]
|
217
|
+
* })
|
218
|
+
* .then(({ created, updated, deleted }) => {
|
219
|
+
* console.log(created, updated, deleted)
|
220
|
+
* })
|
221
|
+
*/
|
47
222
|
async batchPrices(id, body, query, headers) {
|
48
223
|
return this.client.fetch(`/admin/price-lists/${id}/prices/batch`, {
|
49
224
|
method: "POST",
|
@@ -52,6 +227,25 @@ class PriceList {
|
|
52
227
|
query,
|
53
228
|
});
|
54
229
|
}
|
230
|
+
/**
|
231
|
+
* This method removes products from a price list. It sends a request to the
|
232
|
+
* [Remove Product](https://docs.medusajs.com/v2/api/admin#price-lists_postpricelistsidproducts)
|
233
|
+
* API route.
|
234
|
+
*
|
235
|
+
* @param id - The price list's ID.
|
236
|
+
* @param body - The details of the products to remove.
|
237
|
+
* @param query - Configure the fields to retrieve in the price list.
|
238
|
+
* @param headers - Headers to pass in the request
|
239
|
+
* @returns The price list's details.
|
240
|
+
*
|
241
|
+
* @example
|
242
|
+
* sdk.admin.priceList.linkProducts("plist_123", {
|
243
|
+
* remove: ["prod_123"]
|
244
|
+
* })
|
245
|
+
* .then(({ price_list }) => {
|
246
|
+
* console.log(price_list)
|
247
|
+
* })
|
248
|
+
*/
|
55
249
|
async linkProducts(id, body, query, headers) {
|
56
250
|
return this.client.fetch(`/admin/price-lists/${id}/products`, {
|
57
251
|
method: "POST",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price-list.js","sourceRoot":"","sources":["../../src/admin/price-list.ts"],"names":[],"mappings":";;;AAIA,MAAa,SAAS;IAMpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,KAA0C,EAC1C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAAoC,EACpC,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAoC,EACpC,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CACf,EAAU,EACV,IAAwC,EACxC,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,eAAe,EACvC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,EAAU,EACV,IAA0C,EAC1C,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,WAAW,EACnC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;
|
1
|
+
{"version":3,"file":"price-list.js","sourceRoot":"","sources":["../../src/admin/price-list.ts"],"names":[],"mappings":";;;AAIA,MAAa,SAAS;IAMpB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CACR,KAA0C,EAC1C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,KAAK,CAAC,MAAM,CACV,IAAoC,EACpC,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,oBAAoB,EACpB;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAAoC,EACpC,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,EAAE,EAC1B;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;IACH,KAAK,CAAC,WAAW,CACf,EAAU,EACV,IAAwC,EACxC,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,eAAe,EACvC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,YAAY,CAChB,EAAU,EACV,IAA0C,EAC1C,KAAsC,EACtC,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,sBAAsB,EAAE,WAAW,EACnC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;CACF;AAxTD,8BAwTC"}
|
@@ -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;
|
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"}
|
@@ -8,6 +8,39 @@ class PricePreference {
|
|
8
8
|
constructor(client) {
|
9
9
|
this.client = client;
|
10
10
|
}
|
11
|
+
/**
|
12
|
+
* This method retrieves a price preference. It sends a request to the
|
13
|
+
* [Get Price Preference](https://docs.medusajs.com/api/admin#price-preferences_getpricepreferencesid)
|
14
|
+
* API route.
|
15
|
+
*
|
16
|
+
* @param id - The price preference's ID.
|
17
|
+
* @param query - Configure the fields to retrieve in the price preference.
|
18
|
+
* @param headers - Headers to pass in the request
|
19
|
+
* @returns The price preference's details.
|
20
|
+
*
|
21
|
+
* @example
|
22
|
+
* To retrieve a price preference by its ID:
|
23
|
+
*
|
24
|
+
* ```ts
|
25
|
+
* sdk.admin.pricePreference.retrieve("prpref_123")
|
26
|
+
* .then(({ price_preference }) => {
|
27
|
+
* console.log(price_preference)
|
28
|
+
* })
|
29
|
+
* ```
|
30
|
+
*
|
31
|
+
* To specify the fields and relations to retrieve:
|
32
|
+
*
|
33
|
+
* ```ts
|
34
|
+
* sdk.admin.pricePreference.retrieve("prpref_123", {
|
35
|
+
* fields: "id,is_tax_inclusive"
|
36
|
+
* })
|
37
|
+
* .then(({ price_preference }) => {
|
38
|
+
* console.log(price_preference)
|
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 this.client.fetch(`/admin/price-preferences/${id}`, {
|
13
46
|
method: "GET",
|
@@ -15,6 +48,52 @@ class PricePreference {
|
|
15
48
|
query,
|
16
49
|
});
|
17
50
|
}
|
51
|
+
/**
|
52
|
+
* This method retrieves a paginated list of price preferences. It sends a request to the
|
53
|
+
* [List Price Preferences](https://docs.medusajs.com/api/admin#price-preferences_getpricepreferences) API route.
|
54
|
+
*
|
55
|
+
* @param query - Filters and pagination configurations.
|
56
|
+
* @param headers - Headers to pass in the request.
|
57
|
+
* @returns The paginated list of price preferences.
|
58
|
+
*
|
59
|
+
* @example
|
60
|
+
* To retrieve the list of price preferences:
|
61
|
+
*
|
62
|
+
* ```ts
|
63
|
+
* sdk.admin.pricePreference.list()
|
64
|
+
* .then(({ price_preferences, count, limit, offset }) => {
|
65
|
+
* console.log(price_preferences)
|
66
|
+
* })
|
67
|
+
* ```
|
68
|
+
*
|
69
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
70
|
+
*
|
71
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
72
|
+
*
|
73
|
+
* ```ts
|
74
|
+
* sdk.admin.pricePreference.list({
|
75
|
+
* limit: 10,
|
76
|
+
* offset: 10
|
77
|
+
* })
|
78
|
+
* .then(({ price_preferences, count, limit, offset }) => {
|
79
|
+
* console.log(price_preferences)
|
80
|
+
* })
|
81
|
+
* ```
|
82
|
+
*
|
83
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
84
|
+
* in each price preference:
|
85
|
+
*
|
86
|
+
* ```ts
|
87
|
+
* sdk.admin.pricePreference.list({
|
88
|
+
* fields: "id,is_tax_inclusive"
|
89
|
+
* })
|
90
|
+
* .then(({ price_preferences, count, limit, offset }) => {
|
91
|
+
* console.log(price_preferences)
|
92
|
+
* })
|
93
|
+
* ```
|
94
|
+
*
|
95
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
|
96
|
+
*/
|
18
97
|
async list(query, headers) {
|
19
98
|
return this.client.fetch(`/admin/price-preferences`, {
|
20
99
|
method: "GET",
|
@@ -22,6 +101,26 @@ class PricePreference {
|
|
22
101
|
query,
|
23
102
|
});
|
24
103
|
}
|
104
|
+
/**
|
105
|
+
* This method creates a price preference. It sends a request to the
|
106
|
+
* [Create Price Preference](https://docs.medusajs.com/api/admin#price-preferences_postpricepreferences)
|
107
|
+
* API route.
|
108
|
+
*
|
109
|
+
* @param body - The details of the price preference to create.
|
110
|
+
* @param query - Configure the fields to retrieve in the price preference.
|
111
|
+
* @param headers - Headers to pass in the request
|
112
|
+
* @returns The price preference's details.
|
113
|
+
*
|
114
|
+
* @example
|
115
|
+
* sdk.admin.pricePreference.create({
|
116
|
+
* attribute: "region_id",
|
117
|
+
* value: "region_123",
|
118
|
+
* is_tax_inclusive: true
|
119
|
+
* })
|
120
|
+
* .then(({ price_preference }) => {
|
121
|
+
* console.log(price_preference)
|
122
|
+
* })
|
123
|
+
*/
|
25
124
|
async create(body, query, headers) {
|
26
125
|
return this.client.fetch(`/admin/price-preferences`, {
|
27
126
|
method: "POST",
|
@@ -30,6 +129,25 @@ class PricePreference {
|
|
30
129
|
query,
|
31
130
|
});
|
32
131
|
}
|
132
|
+
/**
|
133
|
+
* This method updates a price preference. It sends a request to the
|
134
|
+
* [Update Price Preference](https://docs.medusajs.com/api/admin#price-preferences_postpricepreferencesid)
|
135
|
+
* API route.
|
136
|
+
*
|
137
|
+
* @param id - The price preference's ID.
|
138
|
+
* @param body - The data to update in the price preference.
|
139
|
+
* @param query - Configure the fields to retrieve in the price preference.
|
140
|
+
* @param headers - Headers to pass in the request
|
141
|
+
* @returns The price preference's details.
|
142
|
+
*
|
143
|
+
* @example
|
144
|
+
* sdk.admin.pricePreference.update("prpref_123", {
|
145
|
+
* is_tax_inclusive: true
|
146
|
+
* })
|
147
|
+
* .then(({ price_preference }) => {
|
148
|
+
* console.log(price_preference)
|
149
|
+
* })
|
150
|
+
*/
|
33
151
|
async update(id, body, query, headers) {
|
34
152
|
return this.client.fetch(`/admin/price-preferences/${id}`, {
|
35
153
|
method: "POST",
|
@@ -38,6 +156,21 @@ class PricePreference {
|
|
38
156
|
query,
|
39
157
|
});
|
40
158
|
}
|
159
|
+
/**
|
160
|
+
* This method deletes a price preference. It sends a request to the
|
161
|
+
* [Delete Price Preference](https://docs.medusajs.com/api/admin#price-preferences_deletepricepreferencesid)
|
162
|
+
* API route.
|
163
|
+
*
|
164
|
+
* @param id - The price preference's ID.
|
165
|
+
* @param headers - Headers to pass in the request
|
166
|
+
* @returns The deletion's details.
|
167
|
+
*
|
168
|
+
* @example
|
169
|
+
* sdk.admin.pricePreference.delete("prpref_123")
|
170
|
+
* .then(({ deleted }) => {
|
171
|
+
* console.log(deleted)
|
172
|
+
* })
|
173
|
+
*/
|
41
174
|
async delete(id, headers) {
|
42
175
|
return this.client.fetch(`/admin/price-preferences/${id}`, {
|
43
176
|
method: "DELETE",
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"price-preference.js","sourceRoot":"","sources":["../../src/admin/price-preference.ts"],"names":[],"mappings":";;;AAIA,MAAa,eAAe;IAM1B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CACR,KAAgD,EAChD,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;
|
1
|
+
{"version":3,"file":"price-preference.js","sourceRoot":"","sources":["../../src/admin/price-preference.ts"],"names":[],"mappings":";;;AAIA,MAAa,eAAe;IAM1B;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACH,KAAK,CAAC,QAAQ,CACZ,EAAU,EACV,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,KAAK,CAAC,IAAI,CACR,KAAgD,EAChD,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;YACE,MAAM,EAAE,KAAK;YACb,OAAO;YACP,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,KAAK,CAAC,MAAM,CACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,0BAA0B,EAC1B;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,MAAM,CACV,EAAU,EACV,IAA0C,EAC1C,KAA4C,EAC5C,OAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;YACE,MAAM,EAAE,MAAM;YACd,OAAO;YACP,IAAI;YACJ,KAAK;SACN,CACF,CAAA;IACH,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,OAAuB;QAC9C,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CACtB,4BAA4B,EAAE,EAAE,EAChC;YACE,MAAM,EAAE,QAAQ;YAChB,OAAO;SACR,CACF,CAAA;IACH,CAAC;CACF;AAzND,0CAyNC"}
|