Socket
Socket
Sign inDemoInstall

@revolugo/revolugo-client-js

Package Overview
Dependencies
1
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @revolugo/revolugo-client-js

Javascript Revolugo Booking API Client (browser + server)


Version published
Weekly downloads
1
decreased by-50%
Maintainers
2
Install size
959 kB
Created
Weekly downloads
 

Readme

Source

Revolugo Client Javascript

The Revolugo Client Javascript provides convenient access to the Revolugo API from applications written in server-side JavaScript or for browser based applications

Documentation

See the revolugo API docs.

Installation

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

Usage

Import & Configure

Node
const Revolugo = require('@revolugo/revolugo-client-js')

const revolugoClient = new Revolugo.ApiClient({
  apiKey: '<public-or-private-api-key-here>',
  apiVersion: 'v1',
  environment: Revolugo.Environment.SANDBOX
})
Browser && ES6
import * as Revolugo from '@revolugo/revolugo-client-js'

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

Simple Api calls

See the revolugo API docs. for more details about inputs / outputs

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

Polling

Some calls require polling to see the complete output. Polling is already handled by the library

revolugoClient.hotelOffers.list({
    hotel_offer_request_id: <request-id>,
    currency: 'EUR'
}, (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")
        doSomething(result)
    }
})

Keywords

FAQs

Last updated on 08 Mar 2022

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc