/** * Reviews-related types */ import { ChannelType, ListingId } from './common.js'; /** * Review status */ export type ReviewStatus = 'pending_guest_review' | 'pending_host_review' | 'reviewed'; /** * Category-level sub-score on a review */ export interface ReviewSubScore { /** The rating category (e.g. accuracy, checkin, cleanliness, communication, location, value) */ category?: string; /** The rating score (1-5 for Airbnb; 1-10 for Booking.com guest reviews) */ rating?: number; /** Structured tags associated with the category rating */ review_category_tags?: string[] | null; } /** * Review content */ export interface ReviewContent { /** Rating score (0-5) */ score: number; /** Comment text */ content: string; /** When the review was created (ISO 8601) */ created_at: string; /** Category-level sub-scores; null when not available */ sub_score?: ReviewSubScore[] | null; } /** * Host reply to guest review */ export interface HostReply { /** Reply text */ content: string; /** When the reply was created (ISO 8601) */ created_at: string; } /** * Review information */ export interface Review { /** The reservation code */ reservation_code: string; /** The property ID */ property_id: number; /** Channel type */ channel_type: ChannelType; /** Listing ID */ listing_id: ListingId; /** Check-in date (YYYY-MM-DD) */ check_in_date: string; /** Check-out date (YYYY-MM-DD) */ check_out_date: string; /** Host's review of the guest */ host_review?: ReviewContent | null; /** Guest's review of their stay */ guest_review?: ReviewContent | null; /** Host's reply to guest review */ host_reply?: HostReply | null; } /** * Reviews query parameters */ export interface ReviewsQueryParams { /** Filter by reservation code */ reservation_code?: string; /** Filter by property ID */ property_id?: number; /** Filter by review status (default: 'reviewed') */ review_status?: ReviewStatus; /** Filter by check-out date start (default: 180 days ago) */ start_check_out_date?: string; /** Filter by check-out date end (default: today) */ end_check_out_date?: string; /** Starting index (default: 0) */ offset?: number; /** Max results (max 100, default: 20) */ limit?: number; } /** * Reviews response data */ export interface ReviewsData { /** List of reviews */ reviews: Review[]; } /** * Per-category sub-ratings submitted with a host review * Only effective for channels that support category ratings (currently Airbnb and Zhenguo). * Each value is between 0 and 5 (`recommend` is 0/1). */ export interface ReviewCategoryRatings { /** Overall rating of the guest (0-5) */ overall_rating?: number; /** Cleanliness rating (0-5) */ cleanliness?: number; /** Communication rating (0-5) */ communication?: number; /** Respect of house rules rating (0-5) */ respect_of_house_rules?: number; /** Whether the guest is recommended (0/1) */ recommend?: number; } /** * Create/update review parameters */ export interface CreateReviewParams { /** Reservation code */ reservation_code: string; /** Host review score (0-5) */ host_review_score?: number; /** Host review comment */ host_review_content?: string; /** Host reply to guest review */ host_reply_content?: string; /** Optional per-category sub-ratings submitted together with the host review */ category_ratings?: ReviewCategoryRatings; }