Skip to content

Commit 26176a4

Browse files
committed
fix(js-sdk): remove dead product-option methods from admin.product
1 parent e5fb75c commit 26176a4

3 files changed

Lines changed: 6 additions & 165 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@medusajs/js-sdk": minor
3+
---
4+
5+
fix(js-sdk): remove dead product-option methods from admin.product

packages/core/core-flows/src/product/workflows/delete-product-options.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export type DeleteProductOptionsWorkflowInput = {
2525
export const deleteProductOptionsWorkflowId = "delete-product-options"
2626
/**
2727
* This workflow deletes one or more product options. It's used by the
28-
* [Delete Product Option Admin API Route](https://docs.medusajs.com/api/admin#products_deleteproductsidoptionsoption_id).
28+
* [Delete Product Option Admin API Route](https://docs.medusajs.com/api/admin/product-options/delete-a-product-option).
2929
*
3030
* This workflow has a hook that allows you to perform custom actions after the product options are deleted. For example,
3131
* you can delete custom records linked to the product colleciton.

packages/core/js-sdk/src/admin/product.ts

Lines changed: 0 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -867,88 +867,6 @@ export class Product {
867867
)
868868
}
869869

870-
/**
871-
* This method creates an option in a product. It sends a request to the
872-
* [Create Option](https://docs.medusajs.com/api/admin#products_postproductsidoptions)
873-
* API route.
874-
*
875-
* @param productId - The product's ID.
876-
* @param body - The option's details.
877-
* @param query - Configure the fields to retrieve in the product.
878-
* @param headers - Headers to pass in the request
879-
* @returns The product's details.
880-
*
881-
* @example
882-
* sdk.admin.product.createOption(
883-
* "prod_123",
884-
* {
885-
* title: "Color",
886-
* values: ["Green", "Blue"]
887-
* }
888-
* )
889-
* .then(({ product }) => {
890-
* console.log(product)
891-
* })
892-
*/
893-
async createOption(
894-
productId: string,
895-
body: HttpTypes.AdminCreateProductOption,
896-
query?: SelectParams,
897-
headers?: ClientHeaders
898-
) {
899-
return await this.client.fetch<HttpTypes.AdminProductResponse>(
900-
`/admin/products/${productId}/options`,
901-
{
902-
method: "POST",
903-
headers,
904-
body,
905-
query,
906-
}
907-
)
908-
}
909-
910-
/**
911-
* This method updates a product's option. It sends a request to the
912-
* [Update Option](https://docs.medusajs.com/api/admin#products_postproductsidoptionsoption_id)
913-
* API route.
914-
*
915-
* @param productId - The product's ID.
916-
* @param id - The ID of the option to update.
917-
* @param body - The data to update in the option.
918-
* @param query - Configure the fields to retrieve in the product.
919-
* @param headers - Headers to pass in the request
920-
* @returns The product's details.
921-
*
922-
* @example
923-
* sdk.admin.product.updateOption(
924-
* "prod_123",
925-
* "prodopt_123",
926-
* {
927-
* title: "Color"
928-
* }
929-
* )
930-
* .then(({ product }) => {
931-
* console.log(product)
932-
* })
933-
*/
934-
async updateOption(
935-
productId: string,
936-
id: string,
937-
body: HttpTypes.AdminUpdateProductOption,
938-
query?: SelectParams,
939-
headers?: ClientHeaders
940-
) {
941-
return await this.client.fetch<HttpTypes.AdminProductResponse>(
942-
`/admin/products/${productId}/options/${id}`,
943-
{
944-
method: "POST",
945-
headers,
946-
body,
947-
query,
948-
}
949-
)
950-
}
951-
952870
/**
953871
* This method retrieves a paginated list of product options. It sends a request to the
954872
* [List Options](https://docs.medusajs.com/api/admin/products/list-options) API route.
@@ -1010,88 +928,6 @@ export class Product {
1010928
)
1011929
}
1012930

1013-
/**
1014-
* This method retrieves a product's option. It sends a request to the
1015-
* [Get Option](https://docs.medusajs.com/api/admin#products_getproductsidoptionsoption_id)
1016-
* API route.
1017-
*
1018-
* @param productId - The product's ID.
1019-
* @param id - The product option's ID.
1020-
* @param query - Configure the fields to retrieve in the product option.
1021-
* @param headers - Headers to pass in the request
1022-
* @returns The product option's details.
1023-
*
1024-
* @example
1025-
* To retrieve a product option by its ID:
1026-
*
1027-
* ```ts
1028-
* sdk.admin.product.retrieveOption(
1029-
* "prod_123",
1030-
* "prodopt_123"
1031-
* )
1032-
* .then(({ product_option }) => {
1033-
* console.log(product_option)
1034-
* })
1035-
* ```
1036-
*
1037-
* To specify the fields and relations to retrieve:
1038-
*
1039-
* ```ts
1040-
* sdk.admin.product.retrieveOption(
1041-
* "prod_123",
1042-
* "prodopt_123",
1043-
* {
1044-
* fields: "id,title"
1045-
* }
1046-
* )
1047-
* .then(({ product_option }) => {
1048-
* console.log(product_option)
1049-
* })
1050-
* ```
1051-
*
1052-
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/api/store/select-fields-and-relations).
1053-
*/
1054-
async retrieveOption(
1055-
productId: string,
1056-
id: string,
1057-
query?: SelectParams,
1058-
headers?: ClientHeaders
1059-
) {
1060-
return await this.client.fetch<HttpTypes.AdminProductOptionResponse>(
1061-
`/admin/products/${productId}/options/${id}`,
1062-
{
1063-
query,
1064-
headers,
1065-
}
1066-
)
1067-
}
1068-
1069-
/**
1070-
* This method deletes a product's option. It sends a request to the
1071-
* [Delete Option](https://docs.medusajs.com/api/admin#products_deleteproductsidoptionsoption_id)
1072-
* API route.
1073-
*
1074-
* @param productId - The product's ID.
1075-
* @param id - The option's ID.
1076-
* @param headers - Headers to pass in the request
1077-
* @returns The deletion's details.
1078-
*
1079-
* @example
1080-
* sdk.admin.product.deleteOption("prod_123", "prodopt_123")
1081-
* .then(({ deleted }) => {
1082-
* console.log(deleted)
1083-
* })
1084-
*/
1085-
async deleteOption(productId: string, id: string, headers?: ClientHeaders) {
1086-
return await this.client.fetch<HttpTypes.AdminProductOptionDeleteResponse>(
1087-
`/admin/products/${productId}/options/${id}`,
1088-
{
1089-
method: "DELETE",
1090-
headers,
1091-
}
1092-
)
1093-
}
1094-
1095931
/**
1096932
* This method manages image-variant associations for a specific image. It sends a request to the
1097933
* [Batch Image Variants](https://docs.medusajs.com/api/admin/products/manage-variants-of-product-image)

0 commit comments

Comments
 (0)