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

ndc-client

v0.1.5

Published

IATA NDC-compliant API wrapper

Downloads

15

Readme

NDC client

Build Status

A Node.js client wrapper for IATA's NDC API.

Installation

Use npm to install:

npm install ndc-client

Or install from repo:

npm install iata-ndc/ndc-js-sdk

Or just clone with git:

git clone https://github.com/iata-ndc/ndc-js-sdk.git

Usage

Have a config ready:

{
  "courrencyCode": "USD",
  "countryCode": "US",
  "cityCode": "NYC",
  "providerName": "THISNTHAT NDC GATEWAY",
  "endpoint": "http://thisnthat.example.com/ndcapi",
  "APIAuthKey": "xxxxxxxxxxxxxxxxxxxxxxxxx",
  "agency": {
    "IATANumber": "0000XXXX",
    "name": "ThisNThat Agency",
    "userId": "developer.test",
    "type": "TravelManagementCompany",
    "email": "[email protected]"
  },
  "sender": {
  	"id": "C9",
	"name": "Kronos Air",
	"type": "TravelManagementCompany",
	"email": "[email protected]",
	"IATANumber": "00000001"
  },
  "airline": {
    "id": "XX",
    "name": "ThisNThat Air"
  }
}

And then make a request.

var NDC = require('ndc-client');
var ndc = new NDC(require('./config.json'));

/* OneWay with multiple pax */
var reqData = {
    pointOfSaleEvent: {
        code: 9,
        definition: 'Shop'
    },
    onds: [{
        flights: [{
            departure: {
                date: new Date('2016-01-01'),
                airportCode: 'MUC'
            },
            arrival: {
                airportCode: 'LHR'
            },
            airline: config.sender
        }]
    }],
    cabin: 'C',
    travelers: [
        /* two anonymous adults */
        {
            anonymous: true,
            count: 2,
            type: 'ADT'
        },
        /* 1 anonymous children */
        {
            anonymous: true,
            count: 1,
            type: 'CNN'
        },
        /* 1 anonymous infant */
        {
            anonymous: true,
            count: 1,
            type: 'INF'
        }
    ]
};

// Direct request
ndc.request('AirShopping', reqData, function (err, response) {
    console.log(response);
});

//Or if you need to work with message body:
var message = ndc.messages.AirShopping(reqData);

// print JSON message.
console.log(message.toJSON());
// print pretty XML code.
console.log(message.toXML(true));
// forced XML body
message.forceBody(message.toXML().replace(/thisString/g, 'thatString'))
// make request
message.request(function (err, response) {
    // view response
    console.log(response); 
});

For further details on each message parameters, have a look to the test folder in the test-data.js file, with examples.