This document describes the data models used in the THN Native SDK to configure and customize the widgets.
The main container for all widget data:
iOS (Swift):
THNData(
propertyId: String, // Your THN property ID (required)
pageName: THNPageName, // Current page type (required)
languageCode: String? = nil, // Optional language code (e.g., "en")
currencyCode: String? = nil, // Optional currency code (e.g., "USD")
bookingId: String? = nil, // Optional booking identifier
search: THNSearch? = nil, // Optional search parameters
results: THNResults? = nil // Optional search results
)Android (Kotlin):
THNData(
propertyId: String, // Your THN property ID (required)
pageName: THNPageName, // Current page type (required)
languageCode: String? = null, // Optional language code (e.g., "en")
currencyCode: String? = null, // Optional currency code (e.g., "USD")
bookingId: String? = null, // Optional booking identifier
search: THNSearch? = null, // Optional search parameters
results: THNResults? = null // Optional search results
)Enum that identifies the current page type:
iOS (Swift):
enum THNPageName {
case index // Homepage
case search // Search page
case roomsAndRates // Rooms and rates page
case booking // Booking page
case bookingConfirmed // Booking confirmation page
}Android (Kotlin):
enum class THNPageName {
INDEX, // Homepage
SEARCH, // Search page
ROOMS_AND_RATES, // Rooms and rates page
BOOKING, // Booking page
BOOKING_CONFIRMED // Booking confirmation page
}Search parameters for hotel rooms:
iOS (Swift):
THNSearch(
checkIn: String, // Check-in date (format: "YYYY-MM-DD") (required)
checkOut: String, // Check-out date (format: "YYYY-MM-DD") (required)
promoCode: String? = nil, // Optional promotion code
adults: Int? = nil, // Optional total number of adults
children: Int? = nil, // Optional total number of children
rooms: [THNRoom] = [] // List of room configurations
)Android (Kotlin):
THNSearch(
checkIn: String, // Check-in date (format: "YYYY-MM-DD") (required)
checkOut: String, // Check-out date (format: "YYYY-MM-DD") (required)
promoCode: String? = null, // Optional promotion code
adults: Int? = null, // Optional total number of adults
children: Int? = null, // Optional total number of children
rooms: List<THNRoom> = emptyList() // List of room configurations
)Room configuration:
iOS (Swift):
THNRoom(
adults: Int, // Number of adults in the room (required)
name: String? = nil, // Optional room name (e.g., "Deluxe Suite")
type: THNRoomKind? = nil, // Optional room type
children: Int? = nil, // Optional number of children in the room
prices: [THNPriceOption]? = nil // Optional list of price options
)Android (Kotlin):
THNRoom(
adults: Int, // Number of adults in the room (required)
name: String? = null, // Optional room name (e.g., "Deluxe Suite")
type: THNRoomKind? = null, // Optional room type
children: Int? = null, // Optional number of children in the room
prices: List<THNPriceOption>? = null // Optional list of price options
)Enum that specifies the type of room:
iOS (Swift):
enum THNRoomKind {
case standard // Standard room
case deluxe // Deluxe room
case suite // Suite
case apartment // Apartment or residence
case villa // Villa or bungalow
case other // Other room type
}Android (Kotlin):
enum class THNRoomKind {
STANDARD, // Standard room
DELUXE, // Deluxe room
SUITE, // Suite
APARTMENT, // Apartment or residence
VILLA, // Villa or bungalow
OTHER // Other room type
}Price configuration for a room:
iOS (Swift):
THNPriceOption(
name: String, // Price option name (required)
totalNight: Double, // Price per night (required)
breakfast: Bool, // Includes breakfast (required)
refundable: Bool // Is refundable (required)
)Android (Kotlin):
THNPriceOption(
name: String, // Price option name (required)
totalNight: Double, // Price per night (required)
breakfast: Boolean, // Includes breakfast (required)
refundable: Boolean // Is refundable (required)
)Search results information:
iOS (Swift):
THNResults(
availability: Bool, // Room availability (required)
lowestPriceWithTaxes: Double? = nil // or lowestPriceWithoutTaxes: Double? = nil, // Optional lowest price before taxes
)Android (Kotlin):
THNResults(
availability: Boolean, // Room availability (required)
lowestPriceWithTaxes: Double? = null // or lowestPriceWithoutTaxes: Double? = null, // Optional lowest price before taxes
)iOS (Swift):
let thnData = THNData(
propertyId: "YOUR_PROPERTY_ID",
pageName: .roomsAndRates,
languageCode: "en",
currencyCode: "USD"
)Android (Kotlin):
val thnData = THNData(
propertyId = "YOUR_PROPERTY_ID",
pageName = THNPageName.ROOMS_AND_RATES,
languageCode = "en",
currencyCode = "USD"
)iOS (Swift):
let search = THNSearch(
checkIn: "2023-06-15",
checkOut: "2023-06-20",
adults: 2,
rooms: [
THNRoom(
adults: 2,
name: "Deluxe Room",
type: .deluxe,
children: 0
)
]
)
let thnData = THNData(
propertyId: "YOUR_PROPERTY_ID",
pageName: .search,
languageCode: "en",
search: search
)Android (Kotlin):
val search = THNSearch(
checkIn = "2023-06-15",
checkOut = "2023-06-20",
adults = 2,
rooms = listOf(
THNRoom(
adults = 2,
name = "Deluxe Room",
type = THNRoomKind.DELUXE,
children = 0
)
)
)
val thnData = THNData(
propertyId = "YOUR_PROPERTY_ID",
pageName = THNPageName.SEARCH,
languageCode = "en",
search = search
)iOS (Swift):
let room = THNRoom(
adults: 2,
name: "Deluxe Suite",
type: .suite,
children: 1,
prices: [
THNPriceOption(
name: "Standard Rate",
totalNight: 150.0,
breakfast: true,
refundable: true
),
THNPriceOption(
name: "Non-Refundable Rate",
totalNight: 120.0,
breakfast: true,
refundable: false
)
]
)
let search = THNSearch(
checkIn: "2023-06-15",
checkOut: "2023-06-20",
promoCode: "SUMMER23",
adults: 2,
children: 1,
rooms: [room]
)
let results = THNResults(
availability: true,
lowestPriceWithTaxes: 132.0 // lowestPriceWithoutTaxes: 120.0,
)
let thnData = THNData(
propertyId: "YOUR_PROPERTY_ID",
pageName: .booking,
languageCode: "en",
currencyCode: "USD",
search: search,
results: results
)Android (Kotlin):
val room = THNRoom(
adults = 2,
name = "Deluxe Suite",
type = THNRoomKind.SUITE,
children = 1,
prices = listOf(
THNPriceOption(
name = "Standard Rate",
totalNight = 150.0,
breakfast = true,
refundable = true
),
THNPriceOption(
name = "Non-Refundable Rate",
totalNight = 120.0,
breakfast = true,
refundable = false
)
)
)
val search = THNSearch(
checkIn = "2023-06-15",
checkOut = "2023-06-20",
promoCode = "SUMMER23",
adults = 2,
children = 1,
rooms = listOf(room)
)
val results = THNResults(
availability = true,
lowestPriceWithTaxes = 132.0 // or lowestPriceWithoutTaxes = 120.0,
)
val thnData = THNData(
propertyId = "YOUR_PROPERTY_ID",
pageName = THNPageName.BOOKING,
languageCode = "en",
currencyCode = "USD",
search = search,
results = results
)