Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mr687/google-hotel-api

Google Hotel Unofficial API
https://github.com/mr687/google-hotel-api

api google hotel unofficial

Last synced: 27 days ago
JSON representation

Google Hotel Unofficial API

Awesome Lists containing this project

README

        

# Google Hotel Unofficial API

[![Build Status](https://travis-ci.org/mr687/google-hotel-api.svg?branch=main)](https://travis-ci.org/mr687/google-hotel-api)
[![Coverage Status](https://coveralls.io/repos/github/mr687/google-hotel-api/badge.svg?branch=main)](https://coveralls.io/github/mr687/google-hotel-api?branch=main)
[![Dependency Status](https://david-dm.org/mr687/google-hotel-api.svg)](https://david-dm.org/mr687/google-hotel-api)
[![devDependency Status](https://david-dm.org/mr687/google-hotel-api/dev-status.svg)](https://david-dm.org/mr687/google-hotel-api#info=devDependencies)
[![npm version](https://badge.fury.io/js/google-hotel-api.svg)](https://badge.fury.io/js/google-hotel-api)

## Description

This is an unofficial API for Google Hotel. It is based on the [Google Hotel API](https://www.google.com/travel/hotels/). It is not affiliated with Google in any way.

## Installation

```bash
npm install google-hotel-api
```

or if you prefer yarn

```bash
yarn add google-hotel-api
```

## Usage

```js
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

en

123abc
Belgrave House


6 Acacia Ave
Floor 5
London
Greater London
SW1W 9TQ

GB
35.070374
-106.213648
123-456-7890
hotel

```