/** * Hostex Listings & Channel Accounts API types */ import { ChannelType } from './common.js'; /** Channel account authorization status */ export type ChannelAccountAuthStatus = | 'active' | 'connecting' | 'disconnected' | 'exception' | 'unknown'; /** * A connected OTA channel account */ export interface ChannelAccount { /** Internal id of the channel account */ id?: number; /** The type of the channel */ channel_type?: ChannelType; /** Login username / identifier on the channel side */ username?: string; /** Account id on the channel side (when available) */ origin_account_id?: string; /** Current authorization / connection status */ auth_status?: ChannelAccountAuthStatus; /** When the account was connected (ISO 8601 UTC) */ created_at?: string | null; } /** * Channel accounts query parameters */ export interface ChannelAccountsQueryParams { /** Internal id of a specific channel account */ id?: number; /** Filter by channel type */ channel_type?: ChannelType; /** The starting point from which to begin returning results (default 0) */ offset?: number; /** The maximum number of results to return, max 100 (default 20) */ limit?: number; } /** * Channel accounts response data */ export interface ChannelAccountsData { channel_accounts: ChannelAccount[]; /** Total number of matching channel accounts */ total: number; } /** Listing shelf status on the channel side */ export type ListingShelfStatus = 'on' | 'off' | 'deleted' | 'unknown'; /** * A synced channel listing record (NOT the `ChannelListing` channel/listing-id pair in common.ts — * that name is taken, hence `ChannelListingRecord`) */ export interface ChannelListingRecord { /** Internal id of the listing record */ id?: number; /** Channel-side listing id (matches listing_id used in other endpoints) */ listing_id?: string; /** The type of the channel */ channel_type?: ChannelType; /** Internal id of the channel account this listing belongs to */ channel_account_id?: number; /** Account id on the channel side */ origin_account_id?: string; /** URL of the listing on the channel's website */ url?: string | null; /** Listing title as shown on the channel */ title?: string; /** Cover image URL */ cover?: string | null; /** Inventory (number of units) reported by the channel */ inventory?: number; /** Listing shelf status on the channel side */ shelf_status?: ListingShelfStatus; /** Normalized channel-side listing metadata; schema varies by channel */ metadata?: Record | null; /** When the listing record was created in Hostex (ISO 8601 UTC) */ created_at?: string | null; /** Last update time of the listing record (ISO 8601 UTC) */ updated_at?: string | null; } /** * Listings query parameters */ export interface ListingsQueryParams { /** Internal id of a channel account (from GET /channel_accounts) */ channel_account_id?: number; /** Channel-side listing id */ listing_id?: string; /** Filter by channel type */ channel_type?: ChannelType; /** The starting point from which to begin returning results (default 0) */ offset?: number; /** The maximum number of results to return, max 100 (default 20) */ limit?: number; } /** * Listings response data */ export interface ListingsData { listings: ChannelListingRecord[]; /** Total number of matching listings */ total: number; } /** A discount rule expressed as percentage + day threshold */ export interface DaysDiscount { /** Discount percentage */ discount?: number; /** Day threshold the discount applies to */ days?: number; } /** Detailed pet fee object (mutually exclusive with the flat pet_fee) */ export interface AirbnbPetFee { amount?: number; charge_type?: string; charge_period?: string; } /** * Airbnb listing settings; all fields optional — only provided fields are updated */ export interface AirbnbPriceAndRulesSettings { /** The listing currency code, e.g. USD */ listing_currency?: string; /** The default nightly price */ base_price?: number; /** The Friday and Saturday nightly price */ weekend_price?: number; /** The security deposit amount */ security_deposit?: number; /** The cleaning fee amount */ cleaning_fee?: number; /** The short-term cleaning fee amount */ short_term_cleaning_fee?: number; /** The pet fee amount; mutually exclusive with pet_fee_obj */ pet_fee?: number; /** The detailed pet fee; mutually exclusive with pet_fee */ pet_fee_obj?: AirbnbPetFee | null; /** The fee charged per extra guest */ extra_guest_fee?: number; /** Early bird discount rule(s) */ early_bird_discount?: DaysDiscount | DaysDiscount[]; /** Last minute discount rule(s) */ last_minute_discount?: DaysDiscount | DaysDiscount[]; /** Long term discount rule(s) */ long_term_discount?: DaysDiscount | DaysDiscount[]; /** Check-in start time: hour 8-24, 25/26 for 1am/2am next day, or 'FLEXIBLE' */ check_in_start_time?: number | string; /** Check-in end time: hour 9-26 or 'FLEXIBLE' */ check_in_end_time?: number | string; /** Check-out latest time, hour 0-23 */ check_out_before?: number; /** Whether instant booking is allowed */ instant_booking?: boolean; /** The number of guests included in the base price */ max_guests?: number; /** The default minimum number of nights */ minimum_stay?: number; /** The default maximum number of nights */ maximum_stay?: number; /** Booking lead time in hours */ advance_notice?: number; /** How far in advance (days) the calendar is bookable */ availability_window?: number; /** Turnover/preparation days between reservations */ preparation_time?: number; /** Days of week (0=Sunday..6=Saturday) on which check-in IS allowed */ days_of_week_check_in?: number[]; /** Days of week (0=Sunday..6=Saturday) on which check-out IS allowed */ days_of_week_check_out?: number[]; /** Allow request-to-book for stays exceeding maximum nights */ allow_rtb_above_max_nights?: boolean; /** The cancellation policy category */ cancellation_policy?: string | number; /** The long-term-stay cancellation policy id */ long_term_cancellation_policy?: string | number; /** Non-refundable discount percentage (0-100) */ non_refundable_price_factor?: number; /** Per-day-of-week minimum nights rule */ day_of_week_min_nights?: unknown; /** Seasonal minimum nights rules */ seasonal_min_stay?: unknown[]; /** Enable the Airbnb new listing promotion */ new_listing_promotion?: boolean; } export interface UpdateAirbnbPriceAndRulesParams { /** The Airbnb listing id */ listing_id: string; /** The settings to update */ settings: AirbnbPriceAndRulesSettings; } /** Per-day-of-week nightly prices; all seven days required when provided */ export interface VrboNightlyRate { sunday: number; monday: number; tuesday: number; wednesday: number; thursday: number; friday: number; saturday: number; } /** * Vrbo listing settings; all fields optional — only provided fields are updated */ export interface VrboPriceAndRulesSettings { /** Default nightly price for every day of the week (takes precedence over nightly_rate) */ base_price?: number; /** Per-day-of-week nightly prices */ nightly_rate?: VrboNightlyRate; /** Security deposit amount; 0 clears it */ security_deposit?: number; /** Cleaning fee amount; 0 clears it */ cleaning_fee?: number; /** Fee charged per extra guest; 0 clears it */ extra_guest_fee?: number; /** The number of guests after which the extra guest fee applies */ extra_guest_number?: number; /** The maximum number of guests */ max_guests?: number; /** Weekly stay discount percentage (0-99) */ weekly_discount?: number; /** Monthly stay discount percentage (0-99) */ monthly_discount?: number; /** The earliest check-in time */ check_in_start_time?: number | string; /** The latest check-out time */ check_out_before?: number | string; /** Whether instant booking is allowed */ instant_booking?: boolean; /** The default minimum number of nights */ minimum_stay?: number; /** Booking lead time / advance notice */ advance_notice?: number; /** How far in advance the calendar is bookable */ availability_window?: number; } export interface UpdateVrboPriceAndRulesParams { /** The Vrbo listing id */ listing_id: string; /** The settings to update */ settings: VrboPriceAndRulesSettings; }