Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

amadeus-ts

Package Overview
Dependencies
Maintainers
0
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amadeus-ts

Node library for the Amadeus travel APIs Written in TypeScript

  • 5.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
28
decreased by-22.22%
Maintainers
0
Weekly downloads
 
Created
Source

Amadeus Node SDK Written In TypeScript

NPM Version NPM Downloads GitHub Actions Workflow Status GitHub License

Amadeus provides a rich set of APIs for the travel industry. For more details, check out the Amadeus for Developers portal.

[!IMPORTANT]
This SDK is maintained by the developer community only. The Amadeus for Developers team doesn't support or maintain it.

Key Features

  • ✅ Full TypeScript Support.
  • 🚀 Smaller Package Size.
  • 🛠️ Enhanced Error Handling.

Installation

This module has been tested using Node LTS versions (16.x, 18.x, 20.x). You can install it using npm, pnpm or yarn.

npm install amadeus-ts

Getting Started

To make your first API call, you will need to register for an Amadeus Developer Account and set up your first application.

Usage

import Amadeus, { ResponseError } from "amadeus-ts";

const amadeus = new Amadeus({
  clientId: process.env.AMADEUS_CLIENT_ID,
  clientSecret: process.env.AMADEUS_CLIENT_SECRET,
});

async function getFlightOffers() {
  try {
    const response = await amadeus.shopping.flightOffersSearch.get({
      originLocationCode: "SYD",
      destinationLocationCode: "BKK",
      departureDate: "2024-12-01",
      adults: 2,
    });

    console.log(response.data);
  } catch (error: unknown) {
    if (error instanceof ResponseError) {
      console.log(error.code);
    }
  }
}

getFlightOffers();

Types

You can import the types of each endpoint to define the structure of your objects.

import Amadeus, { FlightOffersSearchGetParams } from "amadeus-ts";

const amadeus = new Amadeus({
  clientId: process.env.AMADEUS_CLIENT_ID,
  clientSecret: process.env.AMADEUS_CLIENT_SECRET,
});

// Define the type of the flightOffersSearch object using FlightOffersSearchGetParams
const flightOffersSearch: FlightOffersSearchGetParams = {
  originLocationCode: "SYD",
  destinationLocationCode: "BKK",
  departureDate: "2024-12-01",
  adults: 2,
};

amadeus.shopping.flightOffersSearch.get(flightOffersSearch);

Project Example

I created flight-path as a reference project to demonstrate how to use the amadeus-ts library with Next.js 15.

Documentation

See the official amadeus-node documentation.

Keywords

FAQs

Package last updated on 10 Nov 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc