npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

uapi-json

v1.17.4

Published

Travelport Universal API

Downloads

376

Readme

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', region: 'REGION'}};
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 the node-errors-helpers library used for error generating, we strongly recommend you to take a look at it. It also has several useful helpers to handle errors.

Settings

uAPI

Settings object

| Param | Type | Default | Description | | --- | --- | --- | --- | | auth | Object <username, password, targetBranch, emulatePcc, region, provider> | - | See auth description below. | | debug | Number | 0 | Can be 0, 1, or 2. | | production | Boolean | true | Production variable is connected with production and pre-production environment. Can be true for production and false for pre-production. For more information read docs. | | timeout | Number | - | Optional. Used for TerminalService only. See TerminalService | | autoClose | Boolean | Optional. Used only in TerminalService. Defines if service should make closeSession request. | | options | Object | {} | 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

| Param | Type | Default | Description | | --- | --- | --- | --- | |  username | String | - | User name identifier, provided by Travelport. | | password | String | - | Password for current username, provided by Travelport. | | targetBranch | String | - | Branch, provided by Travelport. | | region | String | emea | Optional. Used to select region. | | emulatePcc | String/Boolean | False | Optional. A PCC on behalf of which transactions are executed in Air, Hotels, Utils. This PCC needs to have set SVCB field in the AAT profile. Define a PCC if you have a service bureau and want to execute transactions on behalf of some of its PCCs. Follow this documentation to take a detailew view of the emulatePcc for the Terminal. | | provider | String | 1G | Optional. Obtains data directly from specific provider. Be aware, the default provider is 1G, we never tested any other providers, use this option at your own risk.

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