pub struct Reviews { /* private fields */ }Expand description
Product review operations.
Implementations§
Source§impl Reviews
impl Reviews
Sourcepub fn is_supported(&self) -> bool
pub fn is_supported(&self) -> bool
Whether reviews are supported by the active backend.
Sourcepub fn create(&self, input: CreateReview) -> Result<Review>
pub fn create(&self, input: CreateReview) -> Result<Review>
Create a new product review.
§Example
ⓘ
use stateset_embedded::{Commerce, CreateReview, ProductId, CustomerId};
let commerce = Commerce::new("./store.db")?;
let review = commerce.reviews().create(CreateReview {
product_id: ProductId::new(),
customer_id: CustomerId::new(),
rating: 4,
title: Some("Good value".into()),
body: Some("Decent quality for the price.".into()),
..Default::default()
})?;Sourcepub fn list(&self, filter: ReviewFilter) -> Result<Vec<Review>>
pub fn list(&self, filter: ReviewFilter) -> Result<Vec<Review>>
List reviews with optional filtering.
Sourcepub fn get_summary(&self, product_id: ProductId) -> Result<ReviewSummary>
pub fn get_summary(&self, product_id: ProductId) -> Result<ReviewSummary>
Get aggregate review summary for a product.
Returns average rating, total count, and rating distribution.
Sourcepub fn mark_helpful(&self, id: ReviewId) -> Result<()>
pub fn mark_helpful(&self, id: ReviewId) -> Result<()>
Mark a review as helpful (increment helpful count).
Sourcepub fn mark_reported(&self, id: ReviewId) -> Result<()>
pub fn mark_reported(&self, id: ReviewId) -> Result<()>
Mark a review as reported (increment reported count).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Reviews
impl !UnwindSafe for Reviews
impl Freeze for Reviews
impl Send for Reviews
impl Sync for Reviews
impl Unpin for Reviews
impl UnsafeUnpin for Reviews
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more