@medusajs/js-sdk 2.0.1-snapshot-20241025090810 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/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
@@ -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
|
-
|
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;
|
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;IAI1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgCG;IACG,QAAQ,CACZ,EAAE,EAAE,MAAM,EACV,KAAK,CAAC,EAAE,SAAS,CAAC,oBAAoB,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"}
|
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"}
|