1.0.1 • Published 2 years ago

@revolugo/revolugo-client-js v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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)
    }
})
1.0.1

2 years ago

1.0.0

2 years ago

0.1.11

2 years ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.15

2 years ago

0.1.16

2 years ago

0.1.17

2 years ago

0.1.18

2 years ago

0.1.10

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.0

3 years ago

0.0.9

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago