1.0.11 • Published 6 years ago

uapi-jester v1.0.11

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

Description

Build Status Coverage NPM Tag

Best Travelport Universal API wrapper ever :airplane: :mountain_railway: :hotel:

Wrapper for Travelport Universal API. Read official docs for more information.

Travelport Universal API offers an array of travel content for air, hotel, car, and rail, including ancillaries (optional services). It also provides functionality to build complete traveler, agency, branch, and account profiles.

This package provides JSON/Promises interface for SOAP calls. Requires uAPI credentials to run.

Contents

Installation

Install package with npm install --save uapi-json.

Basic usage

This package exports an object with three service constructors.

const uAPI = require('uapi-json');

const AirService = uAPI.createAirService(settings);
const HotelService = uAPI.createHotelService(settings);
const UtilsService = uAPI.createUtilsService(settings);
const TerminalService = uAPI.createTerminalService(settings);

It also exports a set of error classes that help to check errors against them

const uAPI = require('uapi-json');

const settings = { auth: {username: 'USERNAME', password: 'PASSWORD'}};
const AirService = uAPI.createAirService(settings);

AirService.importPNR().catch((err) => {
  if (err instanceof uAPI.errors.Common.ValidationError) {
    console.log('Validation error occured');
  }
  if (err instanceof uAPI.errors.Request.RequestValidationError) {
    console.log('Validation error occured in request');
  }
  if (err instanceof uAPI.errors.Request.RequestValidationError.ParamsMissing) {
    console.log('Params are missing for request');
  }
});

As node-errors-helpers library is used for errors generating, we strongly reccomend you to tak a look at it. It also has several useful helpers to handle errors.

Settings

uAPI

Settings object

ParamTypeDefaultDescription
authObject <username, password, targetBranch, emulatePcc>-See auth description below.
debugNumber0Can be 0, 1, or 2.
productionBooleantrueProduction variable is connected with production and pre-production environment. Can be true for production and false for pre-production. For more information read docs.
timeoutNumber-Optional. Used for TerminalService only. See TerminalService
autoCloseBooleanOptional. Used only in TerminalService. Defines if service should make closeSession request.
optionsObject{}Optional. User for all services to all additional options like custom log function, etc. See options description bellow.

Additional options

logFunction - set custom logging function that should match next shape (...args) => {}. Will receive all requests and responses from uapi/terminal.

Auth object

username, password and targetBranch should be set in auth object and are provided by Travelport. Optional emulatePcc is a PCC on behalf of which transactions are executed. This PCC needs to have set SVCB field in the AAT profile.

There are 3 types of debug mode:

  • debug=0 - disabled any logs.
  • debug=1 - logging only request params, request xml and error if it's occurred.
  • debug=2 - same as 1 but also logging all response xml (due to lot of text to log).
  • debug=3 - logs everything.

Services

See the following services pages to take a detailed view

Contributing

Please visit CONTRIBUTING.md

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago