import { usePublicApi } from '..'; import type { ApiParams, ProductComment, CreateProductComment, ProductCommentConditionFields, ProductCommentFields, ProductCommentSortFields, ProductCommentsResponse, } from '../types'; export function listProductComments( options?: Pick< ApiParams< ProductCommentFields, ProductCommentSortFields, ProductCommentConditionFields >, 'condition' | 'order' | 'limit' | 'offset' | 'fields' >, ) { return usePublicApi< ProductCommentsResponse, ProductCommentFields, ProductCommentSortFields, ProductCommentConditionFields >({ endpoint: '/publics/products/comments', method: 'GET', params: options, }); } export function createProductComment( productId: number, payload: CreateProductComment, ) { return usePublicApi({ endpoint: `/publics/products/${productId}/comments`, method: 'POST', payload, }); } export function deleteProductComment(commentId: number) { return usePublicApi({ endpoint: `/publics/products/comments/${commentId}`, method: 'DELETE', }); }