@robinson-software-development/crapi-ts-client
v1.0.1
Published
TypeScript client for the TUI Content API
Maintainers
Readme
crapi-ts-client
A TypeScript client for the TUI Content API.
Installation
npm install @robinson-software-development/crapi-ts-clientUsage
import { CrapiClient } from '@robinson-software-development/crapi-ts-client';
// Using the default test API URL
const client = new CrapiClient();
// Or with a custom base URL
const client = new CrapiClient({ baseUrl: 'https://api.tui/content' });
// Fetch hotel details
const hotel = await client.getHotelDetails('FUE21021');
console.log(hotel.name); // "Hotel Riu Palace Tres Islas"API Reference
CrapiClient
Constructor
new CrapiClient(config?: CrapiClientConfig)| Option | Type | Default | Description |
|-----------|----------|-----------------------------------|-------------------|
| baseUrl | string | https://test.api.tui/content | API base URL |
Methods
getHotelDetails(hotelCode: string): Promise<HotelDetails>
Fetches detailed information about a hotel.
Parameters:
hotelCode- The unique hotel code (e.g.,FUE21021)
Returns: A Promise resolving to a HotelDetails object containing:
code,name,category(star rating)coordinates(latitude/longitude)contact(address, email, phone)details.images- Array of hotel imagesdetails.infos- Array of feature descriptions
Types
All response types are exported for use in your application:
import { HotelDetails, Image, Feature, Contact } from '@robinson-software-development/crapi-ts-client';