New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

liteapi-travel

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

liteapi-travel - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2-alpha

index.js

53

package.json
{
"name": "liteapi-travel",
"version": "2.0.1",
"version": "2.0.2-alpha",
"description": "The **liteAPI** can be used to to do the following Get room rates & availability for a set of hotels Select a specific hotel with room availability and make a booking Manage the bookings - retrieve and cancel existing bookings Get static content for hotels, search hotels by destination",
"license": "Unlicense",
"main": "dist/index.js",
"main": "index.js",
"scripts": {
"build": "babel src -d dist",
"prepare": "npm run build",
"test": "mocha --require @babel/register --recursive"
"test": "echo \"Error: no test specified\" && exit 1"
},
"browser": {
"fs": false
},
"repository": {

@@ -20,35 +14,12 @@ "type": "git",

"keywords": [
"liteapi"
"travel",
"hotels",
"api",
"sdk",
"booking",
"vacation"
],
"dependencies": {
"@babel/cli": "^7.0.0",
"superagent": "^5.3.0"
},
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-do-expressions": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-bind": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-logical-assignment-operators": "^7.0.0",
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-optional-chaining": "^7.0.0",
"@babel/plugin-proposal-pipeline-operator": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/register": "^7.0.0",
"expect.js": "^0.3.1",
"mocha": "^8.0.1",
"sinon": "^7.2.0"
},
"files": [
"dist"
]
"author": "Nuitée Travel LTD <hfadili@berkeley.systems>",
"license": "ISC",
"homepage": "https://github.com/liteapi-travel/nodejs-sdk.git#readme"
}

@@ -1,27 +0,28 @@

# liteAPI SDK
<h1 style="font-weight: 500;">liteAPI SDK</h1>
## Table of Contents
- [liteAPI SDK](#liteapi-sdk)
- [Table of Contents](#table-of-contents)
# Table of Contents
- [Table of Contents](#table-of-contents)
- [Introduction](#introduction)
- [Installing](#installing)
- [Usage](#usage)
- [Static data](#static-data)
- [List of cities](#list-of-cities)
- [List of Countries](#list-of-countries)
- [List of available currencies](#list-of-available-currencies)
- [List of hotels](#list-of-hotels)
- [Hotel details](#hotel-details)
- [IATA code list](#iata-code-list)
- [Booking flow](#booking-flow)
- [Search](#search)
- [Hotel Minimum Rates availability](#hotel-minimum-rates-availability)
- [Hotel full rates availability](#hotel-full-rates-availability)
- [book](#book)
- [Hotel rate prebook](#hotel-rate-prebook)
- [Hotel rate book](#hotel-rate-book)
- [Booking management](#booking-management)
- [Booking list](#booking-list)
- [Booking retrieve](#booking-retrieve)
- [Booking cancel](#booking-cancel)
- [Installing](#installing)
- [Usage](#usage)
- [Static data](#static-data)
- [List of cities](#list-of-cities)
- [List of Countries](#list-of-countries)
- [List of available currencies](#list-of-available-currencies)
- [List of hotels](#list-of-hotels)
- [Hotel details](#hotel-details)
- [IATA code list](#iata-code-list)
- [Booking flow](#booking-flow)
- [Search](#search)
- [Minimum Rates availability](#minimum-rates-availability)
- [Hotel full rates availability](#hotel-full-rates-availability)
- [Book](#book)
- [Hotel rate prebook](#hotel-rate-prebook)
- [Hotel rate book](#hotel-rate-book)
- [Booking management](#booking-management)
- [Booking list](#booking-list)
- [Booking retrieve](#booking-retrieve)
- [Booking cancel](#booking-cancel)
- [Guest and loyalty](#guest-and-loyalty)
- [Guests](#guests)

@@ -44,3 +45,3 @@ # Introduction

## Installing
# Installing

@@ -55,3 +56,3 @@ Install the package with:

## Usage
# Usage
The package needs to be configured with your account's apikey, which is

@@ -62,13 +63,8 @@ available in the [liteAPI Dashboard](https://dashboard.liteapi.travel/apikeys/). Require it with the key's

```js
const liteApi = require('liteapi-travel');
const defaultClient = liteApi.ApiClient.instance;
const apikeyAuth = defaultClient.authentications['apikeyAuth'];
apikeyAuth.apiKey = "YOUR API KEY"
const liteApi = require('liteapi-travel')(YOUR_API_KEY);
```
## Static data
# Static data
### List of cities
## List of cities

@@ -79,26 +75,4 @@ The API returns a list of city names from a specific country. The country codes needs be is in ISO-2 format. To get the country codes in ISO-2 for all countries please use the GET Country list endpoint

```js
fetchCitiesByCountryCode = (countryCode: string) => {
const apiInstance = new liteApi.StaticDataApi();
return new Promise((resolve, reject) => {
apiInstance.dataCitiesGet(countryCode, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getDataCities() {
try {
let countryCode = "US";
const data = await this.fetchCitiesByCountryCode(countryCode);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const countryCode = "IT";
const result = await liteApi.getCitiesByCountryCode(countryCode);
```

@@ -120,4 +94,6 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

### List of Countries
<br>
## List of Countries
The API returns the list of countries available along with its ISO-2 code.

@@ -127,25 +103,3 @@

```js
fetchCountries = () => {
const apiInstance = new liteApi.StaticDataApi();
return new Promise((resolve, reject) => {
apiInstance.dataCountriesGet((error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getDataCountries() {
try {
const data = await this.fetchCountries();
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const result = await liteApi.getCountries();
```

@@ -165,4 +119,6 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

### List of available currencies
<br>
## List of available currencies
The API returns all available currency codes along with its name and the list of supported countries that the currency applies to.

@@ -173,25 +129,3 @@

```js
fetchCurrencies = () => {
const apiInstance = new liteApi.StaticDataApi();
return new Promise((resolve, reject) => {
apiInstance.dataCurrenciesGet((error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getDataCurrencies() {
try {
const data = await this.fetchCurrencies();
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const result = await liteApi.getCurrencies();
```

@@ -212,4 +146,5 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

<br>
### List of hotels
## List of hotels

@@ -220,35 +155,20 @@ The API returns a list of hotels available based on different search criterion. The minimum required information is the county code in ISO-2 format.

```js
fetchHotels = (countryCode: string,cityName: string,opts:any) => {
const apiInstance = new liteApi.StaticDataApi();
return new Promise((resolve, reject) => {
apiInstance.dataHotelsGet(countryCode, cityName, opts, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
const countryCode = "IT";
const cityName = "Rome";
//Optional values
const offset = 1000;
const limit = 1000;
const longitude = "-115.16988";
const latitude = "36.12510";
const distance = 1000;
const result = await liteApi.getHotels(countryCode, cityName);
```
public async getDataHotels() {
let countryCode = "SG";
let cityName = "Singapore";
let opts = {
'offset': 0,
'limit': 1000,
'longitude': -115.16988,
'latitude': 36.12510,
'distance': 1000
};
try {
const data = await this.fetchHotels(countryCode,cityName,opts);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
To utilize optional values, you can invoke the function as follows:
```js
const result = await liteApi.getHotels(countryCode, cityName, offset, limit, longitude, latitude, distance)
```
* <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

@@ -286,6 +206,6 @@

<br>
## Hotel details
### Hotel details
The hotel details API returns all the static contents details of a hotel or property if the hotel ID is provided. The static content include name, description, address, amenities, cancellation policies, images and more.

@@ -296,26 +216,4 @@

```js
fetchHotelDetails = (hotelId: string) => {
const apiInstance = new liteApi.StaticDataApi();
return new Promise((resolve, reject) => {
apiInstance.dataHotelGet(hotelId, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getDataHotelDetails() {
let hotelId = "lp19c06";
try {
const data = await this.fetchHotelDetails(hotelId);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const hotelID = "lp24373";
const result = await liteApi.getHotelDetails(hotelID);
```

@@ -355,6 +253,6 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

<br>
## IATA code list
### IATA code list
The API returns the IATA (International Air Transport Association) codes for all available airports along with the name of the airport, geographical coordinates and country code in ISO-2 format.

@@ -365,25 +263,3 @@

```js
fetchIataCode = () => {
const apiInstance = new liteApi.StaticDataApi();
return new Promise((resolve, reject) => {
apiInstance.dataIataCodesGet((error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getDataIataCode() {
try {
const data = await this.fetchIataCode();
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const result = await liteApi.getIataCodes();
```

@@ -406,4 +282,5 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

<br>
## Booking flow
# Booking flow

@@ -413,4 +290,8 @@ liteAPI is a comprehensive and simple to implement Hotel Booking API. The booking flow consists of 3 section: Search, Book, and

### Search
#### Hotel Minimum Rates availability
<br>
## Search
### Minimum Rates availability
------
Hotel Minimum Rates API is to search and return the minimum room rates that are available for a list of hotel ID's on the specified search dates.

@@ -428,36 +309,21 @@

```js
fetchHotelMinimumRates = (hotelIds: string,checkin: string,checkout: string,currency: string,guestNationality: string,adults: number, opts: any) => {
const apiInstance = new liteApi.SearchApi();
return new Promise((resolve, reject) => {
apiInstance.hotelsGet(hotelIds, checkin, checkout, currency, guestNationality, adults, opts, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
const checkin = "2023-07-15";
const checkout = "2023-07-16";
const currency = "USD";
const guestNationality = "US";
const hotelIdsList = ["lp3803c", "lp1f982", "lp19b70", "lp19e75"];
const adults = 2;
//Optional values
const childrenAges = [2,3];
const travelerID = "traveler1";
const result = await liteApi.getMinimumRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults);
```
public async getHotelMinimumRates() {
let hotelIds = "lp3803c,lp1f982,lp19b70,lp19e75";
let checkin = "2023-11-15";
let checkout = "2023-11-16";
let currency = "USD";
let guestNationality = "US";
let adults = 1;
let opts = {
'children': "12,9",
'guestId': "testtraveler1"
};
try {
const data = await this.fetchHotelMinimumRates(hotelIds,checkin,checkout,currency,guestNationality,adults,opts);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
To utilize optional values, you can invoke the function as follows:
```js
const result = await liteApi.getMinimumRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults,childrenAges,travelerID);
```
* <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

@@ -489,3 +355,7 @@

#### Hotel full rates availability
<br>
### Hotel full rates availability
------
The Full Rates API is to search and return all available rooms along with its rates, cancellation policies for a list of hotel ID's based on the search dates.

@@ -504,35 +374,18 @@

```js
fetchHotelFullRates = (hotelIds: string,checkin: string,checkout: string,currency: string,guestNationality: string,adults: number, opts: any) => {
const apiInstance = new liteApi.SearchApi();
return new Promise((resolve, reject) => {
apiInstance.hotelsRatesGet(hotelIds, checkin, checkout, currency, guestNationality, adults, opts, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
const checkin = "2023-07-15";
const checkout = "2023-07-16";
const currency = "USD";
const guestNationality = "US";
const hotelIdsList = ["lp3803c", "lp1f982", "lp19b70", "lp19e75"];
const adults = 2;
//Optional values
const childrenAges = [2,3];
const travelerID = "traveler1";
const result = await liteApi.getFullRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults);
```
public async getHotelFullRates() {
let hotelIds = "lp3803c,lp1f982,lp19b70,lp19e75";
let checkin = "2023-11-15";
let checkout = "2023-11-16";
let currency = "USD";
let guestNationality = "US";
let adults = 1;
let opts = {
'children': "12,9",
'guestId': "testtraveler1"
};
try {
const data = await this.fetchHotelFullRates(hotelIds,checkin,checkout,currency,guestNationality,adults,opts);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
To utilize optional values, you can invoke the function as follows:
```js
const result = await liteApi.getFullRates(checkin, checkout, currency, guestNationality, hotelIdsList, adults,childrenAges,travelerID);
```

@@ -579,5 +432,9 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

### book
#### Hotel rate prebook
<br>
## Book
### Hotel rate prebook
------
This API is used to confirm if the room and rates for the search criterion. The input to the endpoint is a specific rate Id coming from the GET hotel full rates availability API.

@@ -591,28 +448,5 @@

```js
fetchHotelRatePrebook = (opts: any) => {
const apiInstance = new liteApi.BookApi();
return new Promise((resolve, reject) => {
apiInstance.ratesPrebookPost(opts, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
const rateId = "NRYDCZRZHAZHYMRQGIZS2MBXFUYTK7BSGAZDGLJQG4WTCNT4GJ6HYVKTPRDVSWSEJVMVUV2HIUZUOS2OKJKEOWKZKRCU2QSXJVETGRCTJZKEMR2ZGNMFSTKKIRDUSWKEIVGVUUKHGRMVISZXIJJUOQK2IRDU2QSYI5CTGSCZLJGE6TBVJNLEON2DKZFU4NSGJNKTERKQKFNEKQ2NINCFAUK2IRCU6QSUKBJEWVCFKZJVST2KGZCEGTSSLFEEKWKEINHFUV2HKUZVIUKOJJNE6QSELBHVKQSEI5CVURCTJZBFER2BKJKEOTKKJZDUKWSEKNHEEUSHII3EMRKSKNHVAUK2IRAU2USUI5ATGVCDJVJFCR2FLFCECN2CKRIFCWKUJFHEEVCHLFJFMRKULJCEWSSEIU2ESWSTI5AVURCHJRFFCRZUK5KEGTKRPRKVGRD4PR6DCNRWFYYDC7BSGAZDGLJQG4WTCMT4IJHXYMJSHE2DCMD4GI";
public async getHotelRatePrebook() {
let opts = {
'body': {"rateId":"2_3P6L4TRYIFKLFM3DRKUQ4SBFCSO3QJBU27UQ76RU6HTAVUULOUZN3HLFLDS6HRUUQXXZNPELVXHLEXZF3J26PGYXGZEMZOPATZGAUBZLMB7BR6OL7QW4FIAIWTOCOLVHBIRGQFE7UJLTQP5RB6AXVPADIRT34YR56BBBSLSAWK2BMTRYBFRZCYG6HQKMULTSO6JIWWTEGVSBOHNFO7KTFXFMGCULXME2B4PZDCFWK62PT3EL4XUVOEB37V2EA7CWJKOZZU4OYDFB36YWUCID6LWVCCRMVU4PYZH2WBTJ6SLVVEGVZHTVGCVXA5GXEOCUE4ARMWXCIGRPASA5WBFI2T557GWUUZ6YMBZZMPUPCWI7DVO2OG6KY36WWASVBLEJRYFHJRRGQKDV5HY6INAD3YARYKVNFMITJ6BX5LVBVXNF33OZF34ZQDE5S74ND73FMHCYSSTZFOBCOBKYDHQ5BWGRYS7GALROITVAFG2OIFSXLUSKRT3MEURPJL7S3MHWEJMAYJFGGPMRZBEQZXAXDJI"}
};
try {
const data = await this.fetchHotelRatePrebook(opts);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const result = await liteApi.preBook(rateId)
```

@@ -663,4 +497,8 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

#### Hotel rate book
<br>
### Hotel rate book
------
This API confirms a booking when the prebook Id and the rate Id from the pre book stage along with the guest and payment information are passed.

@@ -677,32 +515,11 @@

```js
fetchHotelRateBook = (opts: any) => {
const apiInstance = new liteApi.BookApi();
return new Promise((resolve, reject) => {
apiInstance.ratesBookPost(opts, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
const prebookID = "8iaO7PXBU";
const guestInfo = { guestFirstName: 'Kim', guestLastName: 'James', guestEmail: 'test@nlite.ml' };
const paymentMethod = "CREDIT_CARD";
const holderName = "Kim James";
const paymentInfo = { "card_number": "4242424242424242", "exp_month": 11, exp_year: "23", "cvc": 123 }
public async getHotelRateBook() {
let opts = {
'ratesBookPostRequest': {
"prebookId":"UwfMkUWH6",
"guestInfo":{"guestFirstName":"Kim","guestLastName":"James","guestEmail":"test@nlite.ml"},
"payment":{"holderName":"Kim James","number":"4242424242424242","expireDate":"11/29","cvc":"456","method":"CREDIT_CARD"}}
};
const result = await liteApi.book(prebookID, guestInfo, paymentMethod, holderName, paymentInfo)
try {
const data = await this.fetchHotelRateBook(opts);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
```

@@ -753,4 +570,8 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

### Booking management
#### Booking list
<br>
## Booking management
### Booking list
------
The API returns the list of booking Id's for a given guest Id.

@@ -760,26 +581,4 @@

```js
fetchBookingListByGuestId = (guestId: string) => {
const apiInstance = new liteApi.BookingManagementApi();
return new Promise((resolve, reject) => {
apiInstance.bookingsGet(guestId, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getBookingList() {
let guestId = "FrT56hfty";
try {
const data = await this.fetchBookingListByGuestId(guestId);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const guestId = "FrT56hfty";
const result = await liteApi.getBookingListByGuestId(guestId)
```

@@ -803,4 +602,6 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

#### Booking retrieve
<br>
### Booking retrieve
------
The API returns the status and the details for the a specific booking Id.

@@ -811,26 +612,4 @@

```js
fetchBookingDetailsByBookingId = (bookingId: string) => {
const apiInstance = new liteApi.BookingManagementApi();
return new Promise((resolve, reject) => {
apiInstance.bookingsBookingIdGet(bookingId, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async getBookingDetails() {
let bookingId = "uSQ6Zsc5R";
try {
const data = await this.fetchBookingDetailsByBookingId(bookingId);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const bookingId = "uSQ6Zsc5R";
const result = await liteApi.retrievedBooking(bookingId);
```

@@ -877,4 +656,8 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

#### Booking cancel
<br>
### Booking cancel
------
This API is used to request a cancellation of an existing confirmed booking. Cancellation policies and conditions will be used to determine the success of the cancellation. For example a booking with non-refundable (NRFN) tag or a booking with a cancellation policy that was requested past the cancellation date will not be able to cancel the confirmed booking.

@@ -884,26 +667,4 @@

```js
cancelationBookingByBookingId = (bookingId: string) => {
const apiInstance = new liteApi.BookingManagementApi();
return new Promise((resolve, reject) => {
apiInstance.bookingsBookingIdPut(bookingId, (error, data) => {
if (error) {
reject(error);
} else {
resolve(data.data);
}
});
});
};
public async cancelationBooking() {
let bookingId = "uSQ6Zsc5R";
try {
const data = await this.cancelationBookingByBookingId(bookingId);
return {data };
} catch (error) {
console.error(error);
return { error };
}
}
const bookingId = "K8Hvb-85O";
const result = await liteApi.cancelBooking(bookingId);
```

@@ -927,1 +688,33 @@ * <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>

| **currency** | **string** | The currency of the booking. |
<br>
# Guest and loyalty
## Guests
The guests API returns the unique guest IDs
* <h4 style="color:#9155fd; font-weight: 800;"> Example :</h4>
```js
const result = await liteApi.getGuestsIds();
```
If you want to retrieve the guest IDs of a specific user based on their email, you can provide the email as an optional parameter:
```js
const email = "johndoe@nlite.ml"; //Optional
const result = await liteApi.getGuestsIds(email);
```
* <h4 style="color:#9155fd; font-weight: 800;"> Parameters :</h4>
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**email** | **string**| Email ID of the guest | [optional]
* <h4 style="color:#9155fd; font-weight: 800;"> Return type :</h4>
An array containing objects with the following properties:
| Name | Type | Description |
| ---------- | ------ | ---------------- |
| **guestId** | **string** | The guest ID. |
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc