Package Exports
- google-hotel-api
- google-hotel-api/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (google-hotel-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Google Hotel Unofficial API
Description
This is an unofficial API for Google Hotel. It is based on the Google Hotel API. It is not affiliated with Google in any way.
Installation
npm install google-hotel-apior if you prefer yarn
yarn add google-hotel-apiUsage
const { createHotelListing } = require('./dist/index');
const data = createHotelListing({
language: 'en',
})
.addHotel({
id: '123abc',
name: 'Belgrave House',
address: {
format: 'simple',
component: [
{ name: 'addr1', value: '6 Acacia Ave' },
{ name: 'addr2', value: 'Floor 5' },
{ name: 'city', value: 'London' },
{ name: 'province', value: 'Greater London' },
{ name: 'postal_code', value: 'SW1W 9TQ' },
]
},
country: 'GB',
latitude: 35.070374,
longitude: -106.213648,
phone: {
type: 'main',
value: '123-456-7890'
},
category: 'hotel',
})
.writeString();
console.log(data);<?xml version="1.0"?>
<listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.gstatic.com/localfeed/local_feed.xsd">
<language>en</language>
<listing>
<id>123abc</id>
<name>Belgrave House</name>
<address format="simple">
<component name="addr1">6 Acacia Ave</component>
<component name="addr2">Floor 5</component>
<component name="city">London</component>
<component name="province">Greater London</component>
<component name="postal_code">SW1W 9TQ</component>
</address>
<country>GB</country>
<latitude>35.070374</latitude>
<longitude>-106.213648</longitude>
<phone type="main">123-456-7890</phone>
<category>hotel</category>
</listing>
</listings>