Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@revolugo/booking-api-client

Package Overview
Dependencies
Maintainers
2
Versions
2111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@revolugo/booking-api-client

Javascript Revolugo Booking API Client (browser + server)

  • 1.0.4-beta.4
  • npm
  • Socket score

Version published
Weekly downloads
3.4K
increased by117.81%
Maintainers
2
Weekly downloads
 
Created
Source

Revolugo Booking API Client

The Revolugo Booking API Client provides convenient access to the Revolugo Booking API from applications written in server-side JavaScript or for browser based applications. This client exposes Typescript types.

See the Revolugo Booking API documentation.

Installation

The package can be installed through NPM or Yarn:

# NPM
npm install --save @revolugo/revolugo-client-js

# Yarn
yarn add @revolugo/revolugo-client-js

Getting Started

Import & Configure

import { ApiClient } from '@revolugo/booking-api-client'

const revolugoApiClient = new ApiClient({
  apiEnvironment: Revolugo.Environment.LIVE
  apiKey: '<public-or-private-api-key-here>',
  apiVersion: 'v1',
})
Configuration
OptionDefaultDescription
apiEnvironmentRequiredTarget environment for the client (Environment.PRODUCTION | Environment.SANDBOX)
apiKeyRequiredPublic or Private Api Key provided by Revolugo
apiVersionRequiredApi version

Usage

See the Revolugo Booking API documentation for details about request/reponse data.

 const hotelOfferRequest = await revolugoApiClient.hotelOfferRequests.create({
    adult_count: 5,
    check_in_date: '2021-05-30',
    check_out_date: '2021-06-02',
    children: '2,8',
    latitude: 45.76405021831942,
    longitude: 4.835700988769532,
    room_count: 3,
    source_market: 'FR'
 })

Polling

Some endpoints require polling to get the complete result. Polling is already handled by the library:

revolugoApiClient.hotelOffers.list({
  currency: HotelOffersCurrencyEnum.Eur,
  hotelOfferRequestId: 'xxxx-xxxx-xxxx-xxxx-xxxx'
}, (err, result) => {
    if (err) {
      console.log("Error while Polling")
      handleError(err)
      return
    }

    if (result.meta.status === 'in-progress') {
        console.log("Still Polling")

        doSomething(result)
    } else {
        console.log("Done Polling")

        doSomethingElse(result)
    }
})

Keywords

FAQs

Package last updated on 11 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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