@medusajs/js-sdk 2.0.5-preview-20241119120217 → 2.0.5-preview-20241119180151

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/product-tag.d.ts +130 -0
  2. package/dist/admin/product-tag.d.ts.map +1 -1
  3. package/dist/admin/product-tag.js +130 -0
  4. package/dist/admin/product-tag.js.map +1 -1
  5. package/dist/admin/product-type.d.ts +131 -0
  6. package/dist/admin/product-type.d.ts.map +1 -1
  7. package/dist/admin/product-type.js +131 -0
  8. package/dist/admin/product-type.js.map +1 -1
  9. package/dist/admin/product-variant.d.ts +48 -1
  10. package/dist/admin/product-variant.d.ts.map +1 -1
  11. package/dist/admin/product-variant.js +49 -2
  12. package/dist/admin/product-variant.js.map +1 -1
  13. package/dist/admin/product.d.ts +634 -2
  14. package/dist/admin/product.d.ts.map +1 -1
  15. package/dist/admin/product.js +636 -4
  16. package/dist/admin/product.js.map +1 -1
  17. package/dist/esm/admin/product-tag.d.ts +130 -0
  18. package/dist/esm/admin/product-tag.d.ts.map +1 -1
  19. package/dist/esm/admin/product-tag.js +130 -0
  20. package/dist/esm/admin/product-tag.js.map +1 -1
  21. package/dist/esm/admin/product-type.d.ts +131 -0
  22. package/dist/esm/admin/product-type.d.ts.map +1 -1
  23. package/dist/esm/admin/product-type.js +131 -0
  24. package/dist/esm/admin/product-type.js.map +1 -1
  25. package/dist/esm/admin/product-variant.d.ts +48 -1
  26. package/dist/esm/admin/product-variant.d.ts.map +1 -1
  27. package/dist/esm/admin/product-variant.js +49 -2
  28. package/dist/esm/admin/product-variant.js.map +1 -1
  29. package/dist/esm/admin/product.d.ts +634 -2
  30. package/dist/esm/admin/product.d.ts.map +1 -1
  31. package/dist/esm/admin/product.js +636 -4
  32. package/dist/esm/admin/product.js.map +1 -1
  33. package/package.json +2 -2
@@ -10,26 +10,658 @@ export declare class Product {
10
10
  * @ignore
11
11
  */
12
12
  constructor(client: Client);
13
+ /**
14
+ * This method creates a product import. The products are only imported after
15
+ * the import is confirmed using the {@link confirmImport} method.
16
+ *
17
+ * This method sends a request to the
18
+ * [Create Product Import](https://docs.medusajs.com/api/admin#products_postproductsimport)
19
+ * API route.
20
+ *
21
+ * @param body - The import's details.
22
+ * @param query - Query parameters to pass to the request.
23
+ * @param headers - Headers to pass in the request.
24
+ * @returns The import's details.
25
+ *
26
+ * @example
27
+ * sdk.admin.product.import({
28
+ * file // uploaded File instance
29
+ * })
30
+ * .then(({ transaction_id }) => {
31
+ * console.log(transaction_id)
32
+ * })
33
+ */
13
34
  import(body: HttpTypes.AdminImportProductRequest, query?: {}, headers?: ClientHeaders): Promise<HttpTypes.AdminImportProductResponse>;
35
+ /**
36
+ * This method confirms a product import created using the method {@link import}.
37
+ * It sends a request to the
38
+ * [Confirm Product Import](https://docs.medusajs.com/api/admin#products_postproductsimporttransaction_idconfirm)
39
+ * API route.
40
+ *
41
+ * @param transactionId - The ID of the transaction of the created product import. This is returned
42
+ * by the API route used to create the product import.
43
+ * @param query - Query parameters to pass in the request.
44
+ * @param headers - Headers to pass in the request.
45
+ *
46
+ * @example
47
+ * sdk.admin.product.confirmImport("transaction_123")
48
+ * .then(() => {
49
+ * console.log("Import confirmed")
50
+ * })
51
+ */
14
52
  confirmImport(transactionId: string, query?: {}, headers?: ClientHeaders): Promise<{}>;
53
+ /**
54
+ * This method starts a product export process to retrieve a CSV of exported products.
55
+ *
56
+ * You'll receive in the response the transaction ID of the workflow generating the CSV file.
57
+ * To check the status of the execution, send a `GET` request to
58
+ * `/admin/workflows-executions/export-products/:transaction-id`.
59
+ *
60
+ * Once the execution finishes successfully, a notification is created for the export.
61
+ * You can retrieve the notifications using the `/admin/notification` API route to
62
+ * retrieve the file's download URL.
63
+ *
64
+ * This method sends a request to the [Export Product](https://docs.medusajs.com/api/admin#products_postproductsexport)
65
+ * API route.
66
+ *
67
+ * @param body - The export's details.
68
+ * @param query - Filters to specify which products to export.
69
+ * @param headers - Headers to pass in the request.
70
+ * @returns The export's details.
71
+ *
72
+ * @example
73
+ * sdk.admin.product.export({})
74
+ * .then(({ transaction_id }) => {
75
+ * console.log(transaction_id)
76
+ * })
77
+ */
15
78
  export(body: HttpTypes.AdminExportProductRequest, query?: HttpTypes.AdminProductListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminExportProductResponse>;
79
+ /**
80
+ * This method manages products to create, update, or delete them. It sends a request to the
81
+ * [Manage Products](https://docs.medusajs.com/api/admin#products_postproductsbatch)
82
+ * API route.
83
+ *
84
+ * @param body - The products to create, update, or delete.
85
+ * @param query - Configure the fields to retrieve in the products.
86
+ * @param headers - Headers to pass in the request
87
+ * @returns The batch operations details.
88
+ *
89
+ * @example
90
+ * sdk.admin.product.batch({
91
+ * create: [
92
+ * {
93
+ * title: "Shirt",
94
+ * options: [{
95
+ * title: "Default",
96
+ * values: ["Default Option"]
97
+ * }],
98
+ * variants: [
99
+ * {
100
+ * title: "Default",
101
+ * options: {
102
+ * Default: "Default Option"
103
+ * },
104
+ * prices: []
105
+ * }
106
+ * ]
107
+ * }
108
+ * ],
109
+ * update: [{
110
+ * id: "prod_123",
111
+ * title: "Pants"
112
+ * }],
113
+ * delete: ["prod_321"]
114
+ * })
115
+ * .then(({ created, updated, deleted }) => {
116
+ * console.log(created, updated, deleted)
117
+ * })
118
+ */
16
119
  batch(body: HttpTypes.AdminBatchProductRequest, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminBatchProductResponse>;
120
+ /**
121
+ * This method creates a product. It sends a request to the
122
+ * [Create Product](https://docs.medusajs.com/api/admin#products_postproducts)
123
+ * API route.
124
+ *
125
+ * @param body - The product's details.
126
+ * @param query - Configure the fields to retrieve in the product.
127
+ * @param headers - Headers to pass in the request
128
+ * @returns The product's details.
129
+ *
130
+ * @example
131
+ * sdk.admin.product.create({
132
+ * title: "Shirt",
133
+ * options: [{
134
+ * title: "Default",
135
+ * values: ["Default Option"]
136
+ * }],
137
+ * variants: [
138
+ * {
139
+ * title: "Default",
140
+ * options: {
141
+ * Default: "Default Option"
142
+ * },
143
+ * prices: []
144
+ * }
145
+ * ]
146
+ * })
147
+ * .then(({ product }) => {
148
+ * console.log(product)
149
+ * })
150
+ */
17
151
  create(body: HttpTypes.AdminCreateProduct, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
152
+ /**
153
+ * This method updates a product. It sends a request to the
154
+ * [Update Product](https://docs.medusajs.com/api/admin#products_postproductsid)
155
+ * API route.
156
+ *
157
+ * @param id - The product's ID.
158
+ * @param body - The data to update in the product.
159
+ * @param query - Configure the fields to retrieve in the product.
160
+ * @param headers - Headers to pass in the request
161
+ * @returns The product's details.
162
+ *
163
+ * @example
164
+ * sdk.admin.product.update("prod_123", {
165
+ * title: "Shirt",
166
+ * })
167
+ * .then(({ product }) => {
168
+ * console.log(product)
169
+ * })
170
+ */
18
171
  update(id: string, body: HttpTypes.AdminUpdateProduct, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
172
+ /**
173
+ * This method retrieves a paginated list of products. It sends a request to the
174
+ * [List Products](https://docs.medusajs.com/api/admin#products_getproducts) API route.
175
+ *
176
+ * @param query - Filters and pagination configurations.
177
+ * @param headers - Headers to pass in the request.
178
+ * @returns The paginated list of products.
179
+ *
180
+ * @example
181
+ * To retrieve the list of products:
182
+ *
183
+ * ```ts
184
+ * sdk.admin.product.list()
185
+ * .then(({ products, count, limit, offset }) => {
186
+ * console.log(products)
187
+ * })
188
+ * ```
189
+ *
190
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
191
+ *
192
+ * For example, to retrieve only 10 items and skip 10 items:
193
+ *
194
+ * ```ts
195
+ * sdk.admin.product.list({
196
+ * limit: 10,
197
+ * offset: 10
198
+ * })
199
+ * .then(({ products, count, limit, offset }) => {
200
+ * console.log(products)
201
+ * })
202
+ * ```
203
+ *
204
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
205
+ * in each products:
206
+ *
207
+ * ```ts
208
+ * sdk.admin.product.list({
209
+ * fields: "id,*variants"
210
+ * })
211
+ * .then(({ products, count, limit, offset }) => {
212
+ * console.log(products)
213
+ * })
214
+ * ```
215
+ *
216
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
217
+ */
19
218
  list(queryParams?: HttpTypes.AdminProductListParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductListResponse>;
219
+ /**
220
+ * This method retrieves a product by its ID. It sends a request to the
221
+ * [Get Product](https://docs.medusajs.com/api/admin#products_getproductsid)
222
+ * API route.
223
+ *
224
+ * @param id - The product's ID.
225
+ * @param query - Configure the fields to retrieve in the product.
226
+ * @param headers - Headers to pass in the request
227
+ * @returns The product's details.
228
+ *
229
+ * @example
230
+ * To retrieve a product by its ID:
231
+ *
232
+ * ```ts
233
+ * sdk.admin.product.retrieve("prod_123")
234
+ * .then(({ product }) => {
235
+ * console.log(product)
236
+ * })
237
+ * ```
238
+ *
239
+ * To specify the fields and relations to retrieve:
240
+ *
241
+ * ```ts
242
+ * sdk.admin.product.retrieve("prod_123", {
243
+ * fields: "id,*variants"
244
+ * })
245
+ * .then(({ product }) => {
246
+ * console.log(product)
247
+ * })
248
+ * ```
249
+ *
250
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
251
+ */
20
252
  retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
253
+ /**
254
+ * This method deletes a product. It sends a request to the
255
+ * [Delete Product](https://docs.medusajs.com/api/admin#products_deleteproductsid)
256
+ * API route.
257
+ *
258
+ * @param id - The product's ID.
259
+ * @param headers - Headers to pass in the request
260
+ * @returns The deletion's details.
261
+ *
262
+ * @example
263
+ * sdk.admin.product.delete("prod_123")
264
+ * .then(({ deleted }) => {
265
+ * console.log(deleted)
266
+ * })
267
+ */
21
268
  delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductDeleteResponse>;
269
+ /**
270
+ * This method manages the variants of a product. It sends a request to the
271
+ * [Manage Variants](https://docs.medusajs.com/api/admin#products_postproductsidvariantsbatch)
272
+ * API route.
273
+ *
274
+ * @param productId - The product's ID.
275
+ * @param body - The variants to create, update, or delete.
276
+ * @param query - Configure the fields to retrieve in the product variants.
277
+ * @param headers - Headers to pass in the request
278
+ * @returns The product variants' details.
279
+ *
280
+ * @example
281
+ * sdk.admin.product.batchVariants("prod_123", {
282
+ * create: [
283
+ * {
284
+ * title: "Blue Shirt",
285
+ * options: {
286
+ * Color: "Blue"
287
+ * },
288
+ * prices: []
289
+ * }
290
+ * ],
291
+ * update: [
292
+ * {
293
+ * id: "variant_123",
294
+ * title: "Pants"
295
+ * }
296
+ * ],
297
+ * delete: ["variant_123"]
298
+ * })
299
+ * .then(({ created, updated, deleted }) => {
300
+ * console.log(created, updated, deleted)
301
+ * })
302
+ */
22
303
  batchVariants(productId: string, body: HttpTypes.AdminBatchProductVariantRequest, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminBatchProductVariantResponse>;
304
+ /**
305
+ * This method creates a variant for a product. It sends a request to the
306
+ * [Create Variant](https://docs.medusajs.com/api/admin#products_postproductsidvariants)
307
+ * API route.
308
+ *
309
+ * @param productId - The product's ID.
310
+ * @param body - The variant's details.
311
+ * @param query - Configure the fields to retrieve in the product.
312
+ * @param headers - Headers to pass in the request
313
+ * @returns The product's details.
314
+ *
315
+ * @example
316
+ * sdk.admin.product.createVariant("prod_123", {
317
+ * title: "Blue Shirt",
318
+ * options: {
319
+ * Color: "Blue"
320
+ * },
321
+ * prices: [
322
+ * {
323
+ * amount: 10,
324
+ * currency_code: "usd"
325
+ * }
326
+ * ]
327
+ * })
328
+ * .then(({ product }) => {
329
+ * console.log(product)
330
+ * })
331
+ */
23
332
  createVariant(productId: string, body: HttpTypes.AdminCreateProductVariant, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
333
+ /**
334
+ * This method updates a variant of a product. It sends a request to the
335
+ * [Update Variant](https://docs.medusajs.com/api/admin#products_postproductsidvariantsvariant_id)
336
+ * API route.
337
+ *
338
+ * @param productId - The product's ID.
339
+ * @param id - The variant's ID.
340
+ * @param body - The data to update in the variant.
341
+ * @param query - Configure the fields to retrieve in the product.
342
+ * @param headers - Headers to pass in the request
343
+ * @returns The product's details.
344
+ *
345
+ * @example
346
+ * sdk.admin.product.updateVariant(
347
+ * "prod_123",
348
+ * "variant_123",
349
+ * {
350
+ * title: "Blue Shirt",
351
+ * }
352
+ * )
353
+ * .then(({ product }) => {
354
+ * console.log(product)
355
+ * })
356
+ */
24
357
  updateVariant(productId: string, id: string, body: HttpTypes.AdminUpdateProductVariant, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
25
- listVariants(productId: string, queryParams?: HttpTypes.AdminProductVariantParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductVariantListResponse>;
358
+ /**
359
+ * This method retrieves a paginated list of products. It sends a request to the
360
+ * [List Products](https://docs.medusajs.com/api/admin#products_getproductsidvariants) API route.
361
+ *
362
+ * @param productId - The ID of the product to retrieve its variants.
363
+ * @param query - Filters and pagination configurations.
364
+ * @param headers - Headers to pass in the request.
365
+ * @returns The paginated list of product variants.
366
+ *
367
+ * @example
368
+ * To retrieve the list of product variants:
369
+ *
370
+ * ```ts
371
+ * sdk.admin.product.listVariants("prod_123")
372
+ * .then(({ variants, count, limit, offset }) => {
373
+ * console.log(variants)
374
+ * })
375
+ * ```
376
+ *
377
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
378
+ *
379
+ * For example, to retrieve only 10 items and skip 10 items:
380
+ *
381
+ * ```ts
382
+ * sdk.admin.product.listVariants("prod_123", {
383
+ * limit: 10,
384
+ * offset: 10
385
+ * })
386
+ * .then(({ variants, count, limit, offset }) => {
387
+ * console.log(variants)
388
+ * })
389
+ * ```
390
+ *
391
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
392
+ * in each product variant:
393
+ *
394
+ * ```ts
395
+ * sdk.admin.product.listVariants("prod_123", {
396
+ * fields: "id,*product"
397
+ * })
398
+ * .then(({ variants, count, limit, offset }) => {
399
+ * console.log(variants)
400
+ * })
401
+ * ```
402
+ *
403
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
404
+ */
405
+ listVariants(productId: string, query?: HttpTypes.AdminProductVariantParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductVariantListResponse>;
406
+ /**
407
+ * This method retrieves a product's variant. It sends a request to the
408
+ * [Retrieve Variant](https://docs.medusajs.com/api/admin#products_getproductsidvariantsvariant_id)
409
+ * API route.
410
+ *
411
+ * @param productId - The product's ID.
412
+ * @param id - The variant's ID.
413
+ * @param query - Configure the fields to retrieve in the product variant.
414
+ * @param headers - Headers to pass in the request
415
+ * @returns The product variant's details.
416
+ *
417
+ * @example
418
+ * To retrieve a product variant by its ID:
419
+ *
420
+ * ```ts
421
+ * sdk.admin.product.retrieveVariant(
422
+ * "prod_123",
423
+ * "variant_123"
424
+ * )
425
+ * .then(({ variant }) => {
426
+ * console.log(variant)
427
+ * })
428
+ * ```
429
+ *
430
+ * To specify the fields and relations to retrieve:
431
+ *
432
+ * ```ts
433
+ * sdk.admin.product.retrieveVariant(
434
+ * "prod_123",
435
+ * "variant_123",
436
+ * {
437
+ * fields: "id, *product"
438
+ * }
439
+ * )
440
+ * .then(({ variant }) => {
441
+ * console.log(variant)
442
+ * })
443
+ * ```
444
+ *
445
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
446
+ */
26
447
  retrieveVariant(productId: string, id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductVariantResponse>;
448
+ /**
449
+ * This method deletes a product's variant. It sends a request to the
450
+ * [Delete Variant](https://docs.medusajs.com/api/admin#products_deleteproductsidvariantsvariant_id)
451
+ * API route.
452
+ *
453
+ * @param productId - The product's ID.
454
+ * @param id - The ID of the variant.
455
+ * @param headers - Headers to pass in the request
456
+ * @returns The deletion's details.
457
+ *
458
+ * @example
459
+ * sdk.admin.product.deleteVariant("prod_123", "variant_123")
460
+ * .then(({ deleted }) => {
461
+ * console.log(deleted)
462
+ * })
463
+ */
27
464
  deleteVariant(productId: string, id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductVariantDeleteResponse>;
465
+ /**
466
+ * This method manages a product's variant's inventories to associate them with inventory items,
467
+ * update their inventory items, or delete their association with inventory items.
468
+ *
469
+ * It sends a request to the
470
+ * [Manage Variant Inventory](https://docs.medusajs.com/api/admin#products_postproductsidvariantsinventoryitemsbatch)
471
+ * API route.
472
+ *
473
+ * @param productId - The ID of the product that the variant belongs to.
474
+ * @param body - The inventory items to create, update, or delete.
475
+ * @param query - Pass query parameters in the request.
476
+ * @param headers - Headers to pass in the request
477
+ * @returns The details of the created, updated, or deleted inventory items.
478
+ *
479
+ * @example
480
+ * sdk.admin.product.batchVariantInventoryItems(
481
+ * "prod_123",
482
+ * {
483
+ * create: [
484
+ * {
485
+ * inventory_item_id: "iitem_123",
486
+ * variant_id: "variant_123",
487
+ * required_quantity: 10
488
+ * }
489
+ * ],
490
+ * update: [
491
+ * {
492
+ * inventory_item_id: "iitem_1234",
493
+ * variant_id: "variant_1234",
494
+ * required_quantity: 20
495
+ * }
496
+ * ],
497
+ * delete: [
498
+ * {
499
+ * inventory_item_id: "iitem_321",
500
+ * variant_id: "variant_321"
501
+ * }
502
+ * ]
503
+ * }
504
+ * )
505
+ * .then(({ created, updated, deleted }) => {
506
+ * console.log(created, updated, deleted)
507
+ * })
508
+ */
28
509
  batchVariantInventoryItems(productId: string, body: HttpTypes.AdminBatchProductVariantInventoryItemRequest, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminBatchProductVariantInventoryItemResponse>;
510
+ /**
511
+ * This method creates an option in a product. It sends a request to the
512
+ * [Create Option](https://docs.medusajs.com/api/admin#products_postproductsidoptions)
513
+ * API route.
514
+ *
515
+ * @param productId - The product's ID.
516
+ * @param body - The option's details.
517
+ * @param query - Configure the fields to retrieve in the product.
518
+ * @param headers - Headers to pass in the request
519
+ * @returns The product's details.
520
+ *
521
+ * @example
522
+ * sdk.admin.product.createOption(
523
+ * "prod_123",
524
+ * {
525
+ * title: "Color",
526
+ * values: ["Green", "Blue"]
527
+ * }
528
+ * )
529
+ * .then(({ product }) => {
530
+ * console.log(product)
531
+ * })
532
+ */
29
533
  createOption(productId: string, body: HttpTypes.AdminCreateProductOption, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
534
+ /**
535
+ * This method updates a product's option. It sends a request to the
536
+ * [Update Option](https://docs.medusajs.com/api/admin#products_postproductsidoptionsoption_id)
537
+ * API route.
538
+ *
539
+ * @param productId - The product's ID.
540
+ * @param id - The ID of the option to update.
541
+ * @param body - The data to update in the option.
542
+ * @param query - Configure the fields to retrieve in the product.
543
+ * @param headers - Headers to pass in the request
544
+ * @returns The product's details.
545
+ *
546
+ * @example
547
+ * sdk.admin.product.updateOption(
548
+ * "prod_123",
549
+ * "prodopt_123",
550
+ * {
551
+ * title: "Color"
552
+ * }
553
+ * )
554
+ * .then(({ product }) => {
555
+ * console.log(product)
556
+ * })
557
+ */
30
558
  updateOption(productId: string, id: string, body: HttpTypes.AdminUpdateProductOption, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductResponse>;
31
- listOptions(productId: string, queryParams?: HttpTypes.AdminProductOptionParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionListResponse>;
559
+ /**
560
+ * This method retrieves a paginated list of product options. It sends a request to the
561
+ * [List Options](https://docs.medusajs.com/api/admin#products_getproductsidoptions) API route.
562
+ *
563
+ * @param productId - The ID of the product to retrieve its options
564
+ * @param query - Filters and pagination configurations.
565
+ * @param headers - Headers to pass in the request.
566
+ * @returns The paginated list of product options.
567
+ *
568
+ * @example
569
+ * To retrieve the list of product options:
570
+ *
571
+ * ```ts
572
+ * sdk.admin.product.listOptions("prod_123")
573
+ * .then(({ product_options, count, limit, offset }) => {
574
+ * console.log(product_options)
575
+ * })
576
+ * ```
577
+ *
578
+ * To configure the pagination, pass the `limit` and `offset` query parameters.
579
+ *
580
+ * For example, to retrieve only 10 items and skip 10 items:
581
+ *
582
+ * ```ts
583
+ * sdk.admin.product.listOptions("prod_123", {
584
+ * limit: 10,
585
+ * offset: 10
586
+ * })
587
+ * .then(({ product_options, count, limit, offset }) => {
588
+ * console.log(product_options)
589
+ * })
590
+ * ```
591
+ *
592
+ * Using the `fields` query parameter, you can specify the fields and relations to retrieve
593
+ * in each product options:
594
+ *
595
+ * ```ts
596
+ * sdk.admin.product.listOptions("prod_123", {
597
+ * fields: "id,title"
598
+ * })
599
+ * .then(({ product_options, count, limit, offset }) => {
600
+ * console.log(product_options)
601
+ * })
602
+ * ```
603
+ *
604
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
605
+ */
606
+ listOptions(productId: string, query?: HttpTypes.AdminProductOptionParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionListResponse>;
607
+ /**
608
+ * This method retrieves a product's option. It sends a request to the
609
+ * [Get Option](https://docs.medusajs.com/api/admin#products_getproductsidoptionsoption_id)
610
+ * API route.
611
+ *
612
+ * @param productId - The product's ID.
613
+ * @param id - The product option's ID.
614
+ * @param query - Configure the fields to retrieve in the product option.
615
+ * @param headers - Headers to pass in the request
616
+ * @returns The product option's details.
617
+ *
618
+ * @example
619
+ * To retrieve a product option by its ID:
620
+ *
621
+ * ```ts
622
+ * sdk.admin.product.retrieveOption(
623
+ * "prod_123",
624
+ * "prodopt_123"
625
+ * )
626
+ * .then(({ product_option }) => {
627
+ * console.log(product_option)
628
+ * })
629
+ * ```
630
+ *
631
+ * To specify the fields and relations to retrieve:
632
+ *
633
+ * ```ts
634
+ * sdk.admin.product.retrieveOption(
635
+ * "prod_123",
636
+ * "prodopt_123",
637
+ * {
638
+ * fields: "id,title"
639
+ * }
640
+ * )
641
+ * .then(({ product_option }) => {
642
+ * console.log(product_option)
643
+ * })
644
+ * ```
645
+ *
646
+ * Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store#select-fields-and-relations).
647
+ */
32
648
  retrieveOption(productId: string, id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionResponse>;
649
+ /**
650
+ * This method deletes a product's option. It sends a request to the
651
+ * [Delete Option](https://docs.medusajs.com/api/admin#products_deleteproductsidoptionsoption_id)
652
+ * API route.
653
+ *
654
+ * @param productId - The product's ID.
655
+ * @param id - The option's ID.
656
+ * @param headers - Headers to pass in the request
657
+ * @returns The deletion's details.
658
+ *
659
+ * @example
660
+ * sdk.admin.product.deleteOption("prod_123", "prodopt_123")
661
+ * .then(({ deleted }) => {
662
+ * console.log(deleted)
663
+ * })
664
+ */
33
665
  deleteOption(productId: string, id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminProductOptionDeleteResponse>;
34
666
  }
35
667
  //# sourceMappingURL=product.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/admin/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,OAAO;IAClB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAIpB,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,yBAAyB,EACzC,KAAK,CAAC,EAAE,EAAE,EACV,OAAO,CAAC,EAAE,aAAa;IAoBnB,aAAa,CACjB,aAAa,EAAE,MAAM,EACrB,KAAK,CAAC,EAAE,EAAE,EACV,OAAO,CAAC,EAAE,aAAa;IAanB,MAAM,CACV,IAAI,EAAE,SAAS,CAAC,yBAAyB,EACzC,KAAK,CAAC,EAAE,SAAS,CAAC,sBAAsB,EACxC,OAAO,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