Giter Site home page Giter Site logo

amadeus4dev / amadeus-node Goto Github PK

View Code? Open in Web Editor NEW
175.0 17.0 65.0 2.76 MB

Node library for the Amadeus Self-Service travel APIs

Home Page: https://developers.amadeus.com

License: MIT License

JavaScript 100.00%
amadeus flights hotels sdk library travel api self-service travel-insight ai

amadeus-node's People

Contributors

akshitsingla avatar alnacle avatar anthonyroux avatar cbetta avatar darseen avatar dependabot[bot] avatar divdavem avatar gustavo-bertoldi avatar jabrena avatar jromay avatar minjikarin avatar pablopda avatar torresc24 avatar tsolakoua avatar xianqiliu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amadeus-node's Issues

Fail to initialize client without any parameters

When the environmental variables AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET are present, the client fails to be initialized without any parameters and throws an authentication error ArgumentError: Missing required argument: clientId

How to reproduce:

  • Add your AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET as environmental variables
  • Run the following code:
var Amadeus = require('amadeus');

var amadeus = new Amadeus();

amadeus.shopping.flightOffersSearch.get({
    originLocationCode: 'SYD',
    destinationLocationCode: 'BKK',
    departureDate: '2021-11-01',
    adults: '2'
}).then(function(response){
  console.log(response.data);
}).catch(function(responseError){
  console.log(responseError.code);
});

Chose market (point of sale) from which flight rates are taken

I think the title is clear enough but just in case.

When I do a Flight Offers request

amadeus.client.get('/v2/shopping/flight-offers', params)

The rates on the response are not the ones I get from other GDS on a local search (Argentina)

Is there a way to change the market for which the requests are made? Because the price difference is quite high in some cases, and when I check the fare details the itinerary might be the same but the fare code is different

From what I’ve checked prices correspond more to a Spain search/market (if I do a conversion and compare), but still not sure.

Using The Node SDK on a React Native (Expo) Project.

Description

I am building a mobile app with React Native (Expo), after installing the Node SDK I discovered that I need to install some other dependencies probably because the SDK was written specifically for web apps.

Steps to Reproduce

  1. First, you will need to create a new React Native (Expo) app.
  2. Then you will install the Node SDK in the project.
  3. Try to emulate the app.

Expected Behavior: The app should start without any errors.

Actual Behavior: It returns the following errors:
image

Stable Behavior? [What percentage of the time does it reproduce?]

Versions

Node/NPM Version: 12.18.1 / 6.14.5
Expo CLI Version: 3.21.13

Old token will be taken from cache even when Amadeus user credentials change

Description

If you want to switch to another Amadeus account, you change the credentials but instead of requesting a new token, it seems like the old token is used from the first Amadeus account. How is it possible to ignore the old token In order to get a correct token for the new Amadeus account?

Steps to Reproduce

  1. Use the credentials from a second Amadeus account
  2. Run your project

Expected Behavior: I would expect the package to request a new token since it is a new Amadeus account

Actual Behavior: It seems like the old existing token from the first Amadeus account is used which produces the error Invalid token

Stable Behavior? 100%

Versions

Node: v14.8.0
npm: 6.14.15
OS: macOS Big Sur

Checklist

Please make sure you checked the following:

  • Are you running any of the current Node LTS versions?
  • Did you download the latest version of this library?

Typescript Types

Description

This package is missing TypeScript Types defination

Issue with token expiration handling

Description

I'm implementing Amadeus with AngularJS. I used the amadeus-node as a reference, especially regarding the token expiration-refreshing flow.
After I read the code I pointed out there might be an issue with the token handling here:
this.expiresAt = Date.now() + response.result['expires_in'];

  • According to the OAuth's doc, the expires_in is the lifetime in seconds of the access token.
  • The Date.now() method returns the number of milliseconds elapsed since January 1, 1970.

Steps to Reproduce

No need to reproduce

Expected Behavior:
Correct expiration time:
this.expiresAt = Date.now() + (response.result['expires_in']*1000);

Actual Behavior:
this.expiresAt = Date.now() + response.result['expires_in']; returns wrong expiration time due to the mixed format (ms + s).

Stable Behavior? [What percentage of the time does it reproduce?]

Versions

[What version of Node/NPM are you running? What Operating System are you on?]

Checklist

Please make sure you checked the following:

  • Are you running Node 2.2+?
  • Did you download the latest version of this gem?

Error missing module while implementing amadeus-node into angular project

Description

I gett the error "Module not found: Error: Can't resolve 'http'" while building an angular project with amadeus-node.

Steps to Reproduce

  1. Create new angular project with "ng new my-app-name"
  2. Install amadeus-node with "npm install amadeus --save"
  3. Import to app.component.ts with "import * as Amadeus from 'amadeus';"
  4. Create instance of class Amadeus in ngOnInit of app.component.ts
  5. Start with "ng s -o" from the visual studio code terminal.

image

Expected Behavior: The app starts in my default browser.

Actual Behavior: Errors in the terminal at the end of the build:
ERROR in ./node_modules/amadeus/lib/amadeus/client/validator.js
Module not found: Error: Can't resolve 'http' in 'd:\workspace\my-app-name\node_modules\amadeus\lib\amadeus\client'

As soon as I remove the Instance of class Amadeus everything is fine.

image

Stable Behavior? 100%

Versions

Windows 10 Home x64: 10.0.18362 Build 18362
Visual Studio Code: 1.48.1
Node.js: 12.18.3
Angular CLI: 10.0.6
NPM: 6.14.6
amadeus-node: 5.2.0

Checklist

No, I'm not running node 6 and yes, I've downloaded the newest version of this library (as you can see above).
As far as I can see, all necessary files of the package are where they should be.
image

a promise was rejected with a non-error

Description

Two unexpected / unnecessary warnings in the handling of promises (looks like related to a network error):

bluebird.js?f684:1564 Warning: a promise was rejected with a non-error: [object Object]    at EventEmitter.eval (webpack-internal:///./node_modules/amadeus/lib/amadeus/client.js:253:18)    at EventEmitter.emit (webpack-internal:///./node_modules/node-libs-browser/node_modules/events/events.js:146:5)    at Listener.eval (webpack-internal:///./node_modules/amadeus/lib/amadeus/client/listener.js:183:24)    at exports.IncomingMessage.emit (webpack-internal:///./node_modules/node-libs-browser/node_modules/events/events.js:146:5)    at eval (webpack-internal:///./node_modules/stream-http/lib/response.js:27:9)    at Item.run (webpack-internal:///./node_modules/process/browser.js:153:14)    at drainQueue (webpack-internal:///./node_modules/process/browser.js:123:42)
printWarning @ bluebird.js?f684:1564
formatAndLogError @ bluebird.js?f684:1280
warn @ bluebird.js?f684:1175
Promise._warn @ bluebird.js?f684:771
Promise._rejectCallback @ bluebird.js?f684:3256
(anonymous) @ bluebird.js?f684:3271
(anonymous) @ client.js?9cbe:253
emit @ events.js?7e25:146
(anonymous) @ listener.js?2211:183
emit @ events.js?7e25:146
(anonymous) @ response.js?c90b:27
Item.run @ browser.js?f28c:153
drainQueue @ browser.js?f28c:123
setTimeout (async)
runTimeout @ browser.js?f28c:41
process.nextTick @ browser.js?f28c:143
nextTick @ index.js?966d:26
resume @ _stream_readable.js?8b77:783
Readable.resume @ _stream_readable.js?8b77:775
Readable.on @ _stream_readable.js?8b77:745
onResponse @ listener.js?2211:60
emit @ events.js?7e25:146
ClientRequest._connect @ request.js?925e:268
(anonymous) @ request.js?925e:159
Promise.then (async)
ClientRequest._onFinish @ request.js?925e:157
(anonymous) @ request.js?925e:62
emit @ events.js?7e25:146
finishMaybe @ _stream_writable.js?5bc2:630
afterWrite @ _stream_writable.js?5bc2:492
afterTick @ index.js?966d:40
Item.run @ browser.js?f28c:153
drainQueue @ browser.js?f28c:123
setTimeout (async)
runTimeout @ browser.js?f28c:41
process.nextTick @ browser.js?f28c:143
nextTick @ index.js?966d:39
onwrite @ _stream_writable.js?5bc2:480
WritableState.onwrite @ _stream_writable.js?5bc2:180
ClientRequest._write @ request.js?925e:275
doWrite @ _stream_writable.js?5bc2:428
writeOrBuffer @ _stream_writable.js?5bc2:417
Writable.write @ _stream_writable.js?5bc2:334
execute @ client.js?9cbe:203
unauthenticatedRequest @ client.js?9cbe:184
loadAccessToken @ access_token.js?50dc:134
emitOrLoadAccessToken @ access_token.js?50dc:96
bearerToken @ access_token.js?50dc:56
request @ client.js?9cbe:150
get @ client.js?9cbe:106
get @ locations.js?d315:69
getAirports @ TravelData.js?c2e7:31
AirportSelector._this.populateAirports @ AirportSelector.js?4781:41
(anonymous) @ AirportSelector.js?4781:29
setTimeout (async)
AirportSelector._this.mouseDown @ AirportSelector.js?4781:28
handleChange @ Autocomplete.js?ffc0:128
callCallback @ react-dom.development.js?61bb:149
invokeGuardedCallbackDev @ react-dom.development.js?61bb:199
invokeGuardedCallback @ react-dom.development.js?61bb:256
invokeGuardedCallbackAndCatchFirstError @ react-dom.development.js?61bb:270
executeDispatch @ react-dom.development.js?61bb:561
executeDispatchesInOrder @ react-dom.development.js?61bb:583
executeDispatchesAndRelease @ react-dom.development.js?61bb:680
executeDispatchesAndReleaseTopLevel @ react-dom.development.js?61bb:688
forEachAccumulated @ react-dom.development.js?61bb:660
runEventsInBatch @ react-dom.development.js?61bb:816
runExtractedEventsInBatch @ react-dom.development.js?61bb:824
handleTopLevel @ react-dom.development.js?61bb:4826
batchedUpdates$1 @ react-dom.development.js?61bb:20233
batchedUpdates @ react-dom.development.js?61bb:2151
dispatchEvent @ react-dom.development.js?61bb:4905
(anonymous) @ react-dom.development.js?61bb:20284
unstable_runWithPriority @ scheduler.development.js?3069:255
interactiveUpdates$1 @ react-dom.development.js?61bb:20283
interactiveUpdates @ react-dom.development.js?61bb:2170
dispatchInteractiveEvent @ react-dom.development.js?61bb:4882

Steps to Reproduce

class TravelData {
  constructor() {
    const client = new Amadeus({
      clientId: config.amadeus.key,
      clientSecret: config.amadeus.secret
    });

    this.client = client;
  }

  getAirports(prefix) {
    return this.client.referenceData.locations.get({
      keyword: prefix,
      subType: Amadeus.location.airport
    }).then(resp => {
      // console.log(resp);
      return resp.data;
    }).catch(console.log)
  }
}

new TravelData().getAirports('aus');

Expected Behavior: Success with no warnings

Actual Behavior: Warnings

Stable Behavior? 100%

Versions

  • Macosx Mojave
  • Chrome 73.0.3683.103
  • Amadeus-node 3.1.0
  • node v11.14.0
  • webpack 4.29.5

Checklist

Please make sure you checked the following:

  • Are you running Node 2.2+? uh, yeah
  • Did you download the latest version of this gem? not any gems involved here..

Proxy Server Settings

Description

How to connect behind proxy server to Amadeus APIs? I am not able to find the documentation around this.

Steps to Reproduce

  1. Take any of the samples provided in Git Repository.
  2. Execute the program

Expected Behavior: Output should be coming as expected for the API

Actual Behavior: Network error is returned

Versions

Node 14

Checklist

Checklist

Amadeus SDK Specification Document

Table of Content | Templates

Status

Overview

The goal of this document is to set a shared standard for implementation and development of all Amadeus SDKs. For the sake of this document, there is no differentiation between SDKs and API client SDKs.

This document is a work in progress, and should be changed and updated as changes are made to the APIs or developer needs are discovered.

Requirement Prioritization

The following document follows the MoSCoW method of prioritising rules. Please follow the following guidelines when evaluating rules.

  • MUST - Rules labeled as must are requirements that should not be deviated from at any cost
  • SHOULD - Rules labeled as should are requirements that could be deviated from if needed, though this will have to be documented and cleared with all stakeholders before it can be disregarded.
  • COULD - Rules labeled as could are requirements that are desirable but not necessary and therefore would be nice to have where time and resources permit.

We do not use the fourth won't level in this specification.

Limitations

Currently this specification is limited due to various reasons. This means that currently:

  • This specification mostly focusses on read-only API methods
  • This specification assumes a language that has objects, or object-like features
  • This specification does not assume the SDK is automatically generated

Table of Contents

Maintenance Requirements

1. Source Control

  • 1.1 The source code for the SDK must be maintained within Git version control
  • 1.2 Development of new features should happen on feature branches
  • 1.3 Feature branches should pass all tests and linting before they can be merged into the master branch
  • 1.4 Source control should contain tags for each release of the SDK
  • 1.5 The master branch should be kept in a condition that allows for direct use through checkout
  • 1.6 The source code must be hosted publicly
  • 1.7 The source code should use GitHub for public hosting
  • 1.8 The source code should not include build packages, compiled assets, or any other intermediary files used to package the source code into a release

2. Releases & Versioning

  • 2.1 The SDK must use Semantic Versioning to increment the version number as changes are made
  • 2.2 The version number of the SDK could be incremented when the SDK has gathered enough changes to warrant a new release
  • 2.3 For every release a tag must created within Git
  • 2.4 New releases should be deployed automatically to the package manager using the CI server
  • 2.5 For every new release the CHANGELOG file must to be updated with the Major, Minor and Patch changes
  • 2.6 Releases must be pushed to package managers as an Amadeus user not exclusively under any personal accounts
  • 2.7 The version number of the SDK should be independent of the API version
  • 2.8 A release package should not include unnecessary source code files or intermediarry files for the SDK.
  • 2.9 A release package must include the documentation README file
  • 2.10 A release package must include the LICENSE file
  • 2.11 A release package should include the CHANGELOG file
  • 2.12 The name of the SDK should follow language best practices, and be one of amadeus, Amadeus, or amadeus/amadeus.
  • 2.13 If the preferred name of the SDK is not available, it could be one of amadeus-sdk, AmadeusSDK, or amadeusdev/amadeus.
  • 2.14 The name of the SDK must exclude the programming language (e.g. not amadeus-php) or a reference to this being an SDK client library (e.g. not amadeus-sdk)
    practices, and be one of amadeus, Amadeus, or amadeus/amadeus.
  • 2.15 As soon as the first public version of the library has been signed off, the version should be bumped to 1.0.0

3. CI Server

  • 3.1 A Continuous Integration (CI) server must be used to automatically test any branch of the Git repository
  • 3.2 The CI server should be Travis CI.
  • 3.3 The CI server must test against all current LTS language versions
  • 3.4 The CI server could test against popular non-LTS versions
  • 3.5 The CI server could test on different platforms, including Windows, Linux, and macOS.
  • 3.6 The CI server should test new Git tags, and build and push the package to the package manager

Additional Content Requirements

4. Documentation

  • 4.1 The SDKs must include a README file
    • 4.1.1 The README file should include a version badge
    • 4.1.2 The README file should include a test status badge
    • 4.1.3 The README file must link to the LICENSE file
    • 4.1.4 The README file should be written in Markdown
    • 4.1.5 The README file must have instructions on how to install the SDK using a package manager
    • 4.1.6 The README file could have instructions on how to install the SDK from version control
    • 4.1.7 The README file must have instructions on how to initialise the SDK with the API credentials
      • 4.1.7.1 Where possible, the initialised client variable should be named amadeus. For example, amadeus = new Amadeus::Client()
    • 4.1.8 The README file should document all the different ways the SDK can be initialized
    • 4.1.9 The README file must include a basic sample on how to make a first API call
    • 4.1.10 The README file must link to the developer portal
    • 4.1.11 The README file should link to documentation on the developer portal
    • 4.1.12 The README file must document any installation requirements and prerequisites
    • 4.1.13 The README file should to official support channels
    • 4.1.14 The README file must document where a developer can find their API credentials
  • 4.2 The SDKs should have its public methods documented in a way that allows for autogenerated method documentation. For example, for Ruby this would be yard and for Java this would be using Javadoc.
  • 4.3 The SDKs could use the CI server or any other build tool to autogenerate the method documentation on deploy
  • 4.4 The GitHub repository should have a title in the format "Ruby library for the Amadeus travel APIs"
  • 4.5 The GitHub repository should have the following tags: amadeus, travel, flights, hotels, sdk, library
  • 4.6 The SDKs must include a CHANGELOG file
  • 4.7 The SDKs must include a CODE_OF_CONDUCT file
  • 4.8 The SDKs must include a CONTRIBUTING file
    • 4.8.1 The Contribution Guidelines should include instructions on how to run the SDK in development/testing mode.
  • 4.9 The SDKs must include a ISSUE_TEMPLATE file
  • 4.10 The SDKs must include a PULL_REQUEST_TEMPLATE file
  • 4.11 The SDKs must include a SUPPORT file

Templates for a lot of these files have been provided in the templates folder

5. Testing

  • 5.1 The SDKs must be thoroughly tested
  • 5.2 The tests should have integration tests to make the API calls
  • 5.3 The tests should test response objects
  • 5.4 The tests must not actually make any HTTP calls to the API in testing and instead use some kind of VCR method
  • 5.5 The tests must not include actual API credentials

6. Linting

  • 6.1 The SDKs must have their files linted
  • 6.2 The linting must ensure that tabs/spaces are consistently used
  • 6.3 The linting should ensure no trailing whitespace is left in the code
  • 6.4 The linting should ensure quotes and brackets are consistently applied
  • 6.5 The linting could ensure semicolons are present when needed
  • 6.6 The linting could ensure comments are present on public methods

Dependencies & Infrastructure Requirements

7. Dependencies

  • 7.1 The SDK must limit its runtime dependencies
  • 7.2 The SDK should have no runtime dependencies
  • 7.3 The SDK could use any amount of development and test dependencies

8. HTTP Client

  • 8.1 The SDK must use a well supported HTTP client
  • 8.2 A HTTP client from the standard libraries should be used
  • 8.3 The HTTP should support proxies
  • 8.4 The SDK could allow a developer to provide an alternative HTTP client

9. Logging

  • 9.1 The SDK must be able to log activities to a logger
  • 9.2 The logger should use the default runtime log
  • 9.3 The logger must allow enabling/disabling of debug mode per instance
  • 9.4 The logger should allow a developer to provide an alternative logger
  • 9.5 When debugging is enabled, the logger should log (and only log) the request object, response object, and optionally any raw HTTP response object of no response object could be formed.

10. Reporting

  • 10.1 The SDK must identify requests to the API as originating from the SDK
  • 10.2 The SDK must report the SDK version number to the API
  • 10.3 The SDK should report the language version number to the API
  • 10.4 The HTTP client should use the following format user agent to identify the library:
    • Specification: library_name/library_version language_name/language_version
    • Example with known language version: amadeus-ruby/1.0.0 ruby/2.4.2
  • 10.5 The SDK should allow a developer to provide an additional custom app id and custom app version to be passed along in the user agent.
    • Specification: library_name/library_version language_name/language_version app_name/app_version
    • Example: amadeus-ruby/1.0.0 ruby/2.4.2 test_ios_app/1.0.0

Initialization & Interaction Requirements

11. Initialization

  • 11.1 The SDK could be included or imported when needed, and where applicable must use the amadeus, com.amadeus.developer, or Amadeus package name
  • 11.2 The SDK should reside in its own namespace and avoid polluting the global namespace
  • 11.3 The actual client object for the SDK should exist as a subclass within the Amadeus namespace where the language allows. For for example Amadeus::Client in Ruby, or Amadeus\Client in PHP
  • 11.4 The SDK client must allow for the creation of multiple clients per runtime environment, allowing the creation of multiple clients with different credentials
  • 11.5 The SDK client must be able to accept SDK credentials as method parameters
  • 11.6 The SDK client should accept the SDK credentials implicitly as environment variables AMADEUS_CLIENT_ID and AMADEUS_CLIENT_SECRET
  • 11.7 The SDK client must accept a parameter to turn set the logger level
  • 11.8 The SDK client should be able to implicitly accept the debug level as environment variable AMADEUS_DEBUG
  • 11.9 The SDK client should be able to accept an alternative logger object
  • 11.10 The SDK client could accept an alternative HTTP client
  • 11.11 The SDK client must allow selection of the base URL by name (test and production)
  • 11.12 The SDK client must allow for setting a custom base URL directly

12. Namespacing

  • 12.1 The SDK should use namespaced methods to create a match between the API and the SDK
    • GET /v1/flights : amadeus.flights.get
    • GET /v2/hotels/offers: amadeus.hotels.offers.get
  • 12.2 The SDK could use resource IDs as parameters to the namespace, or as a name or unnamed parameter to the call used to execute the API call
    • GET /v1/hotels/123 : amadeus.hotels(123)
    • GET /v1/hotels/123 : amadeus.hotels.get(123)
    • GET /v1/hotels/123 : amadeus.hotels.get(id: 123)
  • 12.3 The SDK should limit API calls when selecting sub resources. All of these should make 1 API call only
    • GET /v1/hotels/123/hotel-offers : amadeus.hotels(123).offers
    • GET /v1/hotels/123/hotel-offers : amadeus.hotels.get(123).offers
    • GET /v1/hotels/123/hotel-offers : amadeus.hotels.get(id: 123).offers
  • 12.4 The SDK could drop the HTTP verb methods where lazy loading is possible
    • GET /v1/flights/123/legs : amadeus.flights(123).legs() (should make 1 API call only)
    • GET /v1/flights/123/legs/345 : amadeus.flights(123).legs(345) (should make 1 API call only)
  • 12.5- The SDK could convert the API namespace (e.g. reference-data) to a more idiomatic format (e.g. reference_data or ReferenceData)

13. Method Syntax

  • 13.1 The SDK API calls should allow for a method to fetch all records for a resource with or without any parameters
    • Example: amadeus.flights().get() : GET /v1/flights
    • Example: amadeus.flights().get({ foo: 123 } : GET /v1/flights?foo=123
  • 13.2 The SDK API calls should allow for a method to take a record ID to fetch a specific resource
    • Example: amadeus.flights(123).get() : GET /v1/flights/123
  • 13.3 When making a POST or PUT request, the SDK API calls should accept a key/value data structure for the data to be submitted
    • Example: amadeus.flights().post({ from: "LHR", to: "LAX" })
  • 13.4 In asynchronous programming languages, the SDK API calls should allow for a callback method to be provided, or a promise to be returned
    • Example with callback amadeus.flights().get(params, callback_function)
    • Example with promise amadeus.flights().get(params).then(...).catch(...)
  • 13.5 The SDK API calls should return a response object

14. Error Handling

  • 14.1 The SDK should raise a ResponseError for any request that did not result a HTTP 200 or 201 response code
  • 14.2 The SDK should differentiate between different errors
    • 14.2.1 The SDK should raise a NetworkError when a transport error occurs (e.g. if the API could not be reached, or unexpected data was returned from the API)
    • 14.2.2 The SDK should raise a AuthenticationError when incorrect credentials were provided
    • 14.2.3 The SDK should raise a NotFoundError when the API call returned a 404
    • 14.2.4 The SDK should raise a ClientError when a generic client error occurs (e.g. incorrect data was sent to the API, basically any 4XXX error)
    • 14.2.5 The SDK should raise a ServerError if the API returned a 5XX error]
    • 14.2.6 The SDK should raise a ParserError if the response was JSON but could not be parsed
  • 14.3 The response error object must contain a reference to the response object, which itself has a reference to the request object that made the call
  • 14.4 The response error object should contain a code attribute containing the name of the error, e.g. NetworkError.
  • 14.5 The response error object should contain a description attribute containing the parsed JSON from the API, if the API errored and contained JSON.
  • 14.6 The SDK should not validate submitted data within the SDK, instead leaving this task to the API and raising exceptions on receiving an error response from the API

API Mapping Requirements

15. API Calls

  • 15.1 The SDK should define the reference-data namespace
  • 15.2 The SDK should define the shopping namespace
    • 15.2.1 The SDK must implement the GET /v1/shopping/flight-destinations endpoint
      • Example: amadeus.shopping.flight_destinations.get({ origin: 'LAX' })
    • 15.2.2 The SDK must implement the GET /v1/shopping/flight-offers endpoint
      • Example: amadeus.shopping.flight_offers.get({ origin: 'LAX', destination: 'LHR', departureDate: '2020-12-01' })
    • 15.2.3 The SDK must implement the GET /v1/shopping/flight-dates endpoint
      • Example: amadeus.shopping.flight_dates.get({ origin: 'LAX', destination: 'LHR' })
  • 15.3 The SDK should define the travel/analytics namespace
  • 15.4 The SDK should define the shopping/hotels namespace

16. Responses

  • 16.1 The SDK must return a response object where possible, instead of the JSON data directly
  • 16.2 The response object must contain a result attribute with the parsed JSON content if the content could be parsed
  • 16.4 The response object must contain a data attribute with the content from the data key from the result hash, if it is present
  • 16.5 The response object must be parsed as well when an error occurred
  • 16.6 An error must be thrown if the response was JSON but could not be parsed
  • 16.7 The response object must contain a statusCode attribute with HTTP status code of the response
  • 16.8 The response object must contain a request attribute with the details of the original request made
  • 16.9 The response object should contain a parsed attribute which should be true when the JSON was successfully parsed
  • 16.10 The response object should be able to deal with any new parameters returned from the API without needing an SDK update. In other words, the class definition of response objects should not define the attributes of the object statically
  • 16.11 The response object should remain lightweight and not contain any instance variables besides those needed to track what the API returned, keeping the logged output of the instance to the important details of the API call.

17. Requests

  • 17.1 The SDK must keep track of the details of a request in a request object that's accessible through the response object
  • 17.2 The request object must track the host, port, verb, path, params, bearerToken, headers (including User Agent) used for the call
  • 17.3 The request object should remain lightweight and not contain any instance variables besides those needed to track what API call was made, keeping the logged output of the instance to the important details of the API call.

18. Pagination

  • 18.1 The SDK must allow for easy pagination of responses
  • 18.2 The SDK must expose .next, .first, .last, .previous methods on the API client to find the relevant page for a response
    • Example given a previous response: let next_response = amadeus.next(response);
  • 18.3 The SDK should not expose any pagination function on the response objects, as this would require the response objects to keep a reference to the API client, limiting the ability to easily debug a response object

Key Developer Experience Interactions

19. Successful Path Interactions

  • 19.1 Finding a location by type should allow for using a built in type
    • Ruby example: locations = amadeus.reference_data.locations.get(keyword: 'lon', subType: Amadeus::Location::Airport)
    • Node example: let locations = amadeus.referenceData.locations.get({ keyword: 'lon', subType: Amadeus.location.airport });
  • 19.2 Making a query using a location code should be able to use the response from a location query
    • Ruby example: amadeus.foo.bar(origin: locations.data.first['iataCode'])
    • Node example: amadeus.foo.bar({ origin: locations.data.first.iataCode });

20. Unsuccessful Path Interactions

  • 20.1 When incorrect credentials are provided, the error returned should be clear even when debug mode is off
Ruby example:
amadeus.get('/foo/bar')
W, [2018-02-19T16:06:29.881202 #67814]  WARN -- Amadeus AuthenticationError: {
  "error": "invalid_client",
  "error_description": "Client credentials are invalid",
  "code": 38187,
  "title": "Invalid parameters"
}
Node example:
amadeus.client.get('/foo/bar').then(...).catch(...);
Amadeus AuthenticationError { error: 'invalid_client',
  error_description: 'Client credentials are invalid',
  code: 38187,
  title: 'Invalid parameters' }

  • 20.2 When an unknown path is provided, the error returned should be clear even when debug mode is off
Ruby example:
amadeus.get('/foo/bar')
W, [2018-02-19T16:06:13.523516 #67786]  WARN -- Amadeus NotFoundError: [
  {
    "code": 38196,
    "title": "Resource not found",
    "detail": "The targeted resource doesn't exist",
    "status": 404
  }
]
Node example:
amadeus.client.get('/foo/bar').then(...).catch(...);
Amadeus NotFoundError [ { code: 38196,
    title: 'Resource not found',
    detail: 'The targeted resource doesn\'t exist',
    status: 404 } ]

  • 20.3 When incorrect params are provided, the error returned should be clear even when debug mode is off
Ruby example:
amadeus.reference_data.locations.get(
  subType: Amadeus::Location::ANY
)
W, [2018-02-19T16:05:55.923870 #67772]  WARN -- Amadeus ClientError: [
  {
    "status": 400,
    "code": 32171,
    "title": "MANDATORY DATA MISSING",
    "detail": "Missing mandatory query parameter",
    "source": {

      "parameter": "keyword"
    }
  }
]
Node example:
amadeus.referenceData.locations.get({
  keyword: 'lon'
}).then(...).catch(...);
Amadeus ClientError [ { status: 400,
    code: 32171,
    title: 'MANDATORY DATA MISSING',
    detail: 'Missing mandatory query parameter',
    source: { parameter: 'subType' } } ]

  • 20.4 When a server error occurs, the error returned should be clear even when debug mode is off
Ruby example:
amadeus.get('/something/that/errors/');
W, [2018-02-19T16:07:42.651272 #67846]  WARN -- Amadeus ServerError: [
  {
    "code": 38189,
    "title": "Internal error",
    "detail": "An internal error occured, please contact your administrator",
    "status": 500
  }
]
Node example:
amadeus.get('/something/that/errors/').then(...).catch(...);
Amadeus ServerError [ { code: 38189,
    title: 'Internal error',
    detail: 'An internal error occured, please contact your administrator',
    status: 500 } ]

  • 20.5 When a network error occurs, the error returned should be clear even when debug mode is off
Ruby example:
amadeus.get('/something/that/errors/');
W, [2018-02-19T16:13:14.374444 #68060]  WARN -- Amadeus NetworkError: nil
Node example:
amadeus.get('/something/that/errors/').then(...).catch(...);
Amadeus NetworkError null

  • 20.6 When a rate limit occurs, the error returned should be clear even when debug mode is off
Ruby example:
amadeus.get('/something/that/rate/limits/');
W, [2018-02-19T16:07:42.651272 #67846]  WARN -- Amadeus ServerError: [
  { 
    code: 38194,
    title: 'Too many requests',
    detail: 'The network rate limit is exceeded, please try again later',
    status: 429 
  }
]
Node example:
amadeus.get('/something/that/errors/').then(...).catch(...);
Amadeus ClientError [ { code: 38194,
    title: 'Too many requests',
    detail: 'The network rate limit is exceeded, please try again later',
    status: 429 } ]

Specific Language Requirements

22. Node / Javascript

  • 22.1 The SDK should promises
  • 22.2 The SDK could support ES7's async/await
  • 22.3 The SDK should be written in ES6+
  • 22.4 The SDK should work in an ES5 environment
  • 22.5 The SDK should support ES6 modules

Question: Optional/Required fields in responses

Hi there!
I'm sorry if it is not appropriate to ask questions here, but I consider to use this service in my project and would like to know if there are any list of fields which a required in any response?
So, for example for the city autocomplete request, can I trust that all fields of the object will be there or some of them might be absent (optional) or even all fields are optional?

Upsell data is always in EUR

Description

I'm trying to use the flight offers upsell endpoint in order to get other fares (ex: not Basic Economy) for a flight. It seems to work fine with the exception that the upsell data is all in EUR when my initial data is in USD. I've tried adding currencyCode to the request but that doesn't help.

It looked like this was the best way to get other fares for a flight, but please let me know if I missed something.

Here's the code snippet and the corresponding data:

const search = async () => {
  const flightOffer = await amadeus.shopping.flightOffersSearch.get({
    adults: 1,
    currencyCode: 'USD',
    includedAirlineCodes: 'AS',
    departureDate: '2021-09-22',
    destinationLocationCode: 'PHX',
    originLocationCode: 'SFO',
    nonStop: true,
  });

  const upsell = await amadeus.shopping.flightOffers.upselling.post(
    JSON.stringify({
      data: {
        type: 'flight-offers-upselling',
        flightOffers: [flightOffer.data[0]],
      },
    })
  );
  return upsell.data;
};
Flight offer data
{
  "type": "flight-offer",
  "id": "1",
  "source": "GDS",
  "instantTicketingRequired": false,
  "nonHomogeneous": false,
  "paymentCardRequired": false,
  "lastTicketingDate": "2021-07-30",
  "itineraries": [
    {
      "segments": [
        {
          "departure": {
            "iataCode": "SFO",
            "terminal": "2",
            "at": "2021-09-22T12:50:00"
          },
          "arrival": {
            "iataCode": "PHX",
            "terminal": "3",
            "at": "2021-09-22T14:50:00"
          },
          "carrierCode": "AS",
          "number": "2028",
          "aircraft": { "code": "E75" },
          "operating": { "carrierCode": "AS" },
          "duration": "PT2H",
          "id": "1",
          "numberOfStops": 0
        }
      ]
    }
  ],
  "price": {
    "currency": "USD",
    "total": "78.39",
    "base": "59.53",
    "fees": [
      { "amount": "0.00", "type": "SUPPLIER" },
      { "amount": "0.00", "type": "TICKETING" },
      { "amount": "0.00", "type": "FORM_OF_PAYMENT" }
    ],
    "grandTotal": "78.39",
    "billingCurrency": "USD"
  },
  "pricingOptions": {
    "fareType": ["PUBLISHED"],
    "includedCheckedBagsOnly": false
  },
  "validatingAirlineCodes": ["AS"],
  "travelerPricings": [
    {
      "travelerId": "1",
      "fareOption": "STANDARD",
      "travelerType": "ADULT",
      "price": {
        "currency": "USD",
        "total": "78.39",
        "base": "59.53",
        "taxes": [
          { "amount": "4.30", "code": "ZP" },
          { "amount": "5.60", "code": "AY" },
          { "amount": "4.46", "code": "US" },
          { "amount": "4.50", "code": "XF" }
        ],
        "refundableTaxes": "5.60"
      },
      "fareDetailsBySegment": [
        {
          "segmentId": "1",
          "cabin": "ECONOMY",
          "fareBasis": "OH2OAVBN",
          "brandedFare": "SV",
          "class": "X",
          "includedCheckedBags": { "quantity": 0 }
        }
      ]
    }
  ]
}
Upsell Response ```json [ { "type": "flight-offer", "id": "2", "source": "GDS", "instantTicketingRequired": false, "paymentCardRequired": false, "lastTicketingDate": "2021-07-30", "itineraries": [ { "segments": [ { "departure": { "iataCode": "SFO", "terminal": "2", "at": "2021-09-22T12:50:00" }, "arrival": { "iataCode": "PHX", "at": "2021-09-22T14:50:00" }, "carrierCode": "AS", "number": "2028", "aircraft": { "code": "E75" }, "operating": { "carrierCode": "AS" }, "duration": "PT2H", "id": "1", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "67.05", "base": "51.00", "fees": [{ "amount": "0.00", "type": "TICKETING" }], "grandTotal": "67.05" }, "pricingOptions": { "fareType": ["PUBLISHED"], "includedCheckedBagsOnly": false, "refundableFare": false, "noRestrictionFare": false, "noPenaltyFare": false }, "validatingAirlineCodes": ["AS"], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "67.05", "base": "51.00", "taxes": [ { "amount": "3.65", "code": "ZP" }, { "amount": "4.75", "code": "AY" }, { "amount": "3.83", "code": "US" }, { "amount": "3.82", "code": "XF" } ] }, "fareDetailsBySegment": [ { "segmentId": "1", "cabin": "ECONOMY", "fareBasis": "OH2OAVBN", "brandedFare": "SV", "class": "X", "includedCheckedBags": { "quantity": 0 }, "amenities": [ { "code": "0B1", "description": "IN FLIGHT ENTERTAINMENT", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "0MU", "description": "CARRY ON UP TO 45 LI 115 LCM", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "02P", "description": "110V AC POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "02Q", "description": "USB POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "06D", "description": "100 PERCENT MILES EARNED", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0BX", "description": "LOUNGE ACCESS", "isChargeable": true, "amenityType": "LOUNGE" }, { "code": "0CL", "description": "INTERNET ACCESS", "isChargeable": true, "amenityType": "ENTERTAINMENT" }, { "code": "0B3", "description": "MEAL 1", "isChargeable": true, "amenityType": "MEAL" }, { "code": "0GO", "description": "STANDARD PIECE MAX 50LB 62LI", "isChargeable": true, "amenityType": "BAGGAGE" } ] } ] } ] }, { "type": "flight-offer", "id": "3", "source": "GDS", "instantTicketingRequired": false, "paymentCardRequired": false, "lastTicketingDate": "2021-07-30", "itineraries": [ { "segments": [ { "departure": { "iataCode": "SFO", "terminal": "2", "at": "2021-09-22T12:50:00" }, "arrival": { "iataCode": "PHX", "at": "2021-09-22T14:50:00" }, "carrierCode": "AS", "number": "2028", "aircraft": { "code": "E75" }, "operating": { "carrierCode": "AS" }, "duration": "PT2H", "id": "1", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "91.77", "base": "74.00", "fees": [{ "amount": "0.00", "type": "TICKETING" }], "grandTotal": "91.77" }, "pricingOptions": { "fareType": ["PUBLISHED"], "includedCheckedBagsOnly": false, "refundableFare": false, "noRestrictionFare": false, "noPenaltyFare": false }, "validatingAirlineCodes": ["AS"], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "91.77", "base": "74.00", "taxes": [ { "amount": "3.65", "code": "ZP" }, { "amount": "4.75", "code": "AY" }, { "amount": "5.55", "code": "US" }, { "amount": "3.82", "code": "XF" } ] }, "fareDetailsBySegment": [ { "segmentId": "1", "cabin": "ECONOMY", "fareBasis": "OH2OAVMN", "brandedFare": "MA", "class": "O", "includedCheckedBags": { "quantity": 0 }, "amenities": [ { "code": "059", "description": "CHANGEABLE TICKET", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0B1", "description": "IN FLIGHT ENTERTAINMENT", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "0B5", "description": "SEAT ASSIGNMENT", "isChargeable": false, "amenityType": "PRE_RESERVED_SEAT" }, { "code": "0MU", "description": "CARRY ON UP TO 45 LI 115 LCM", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "02P", "description": "110V AC POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "02Q", "description": "USB POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "06D", "description": "100 PERCENT MILES EARNED", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0BX", "description": "LOUNGE ACCESS", "isChargeable": true, "amenityType": "LOUNGE" }, { "code": "0CL", "description": "INTERNET ACCESS", "isChargeable": true, "amenityType": "ENTERTAINMENT" }, { "code": "0B3", "description": "MEAL 1", "isChargeable": true, "amenityType": "MEAL" }, { "code": "0BJ", "description": "UPGRADE", "isChargeable": true, "amenityType": "UPGRADES" }, { "code": "0GO", "description": "STANDARD PIECE MAX 50LB 62LI", "isChargeable": true, "amenityType": "BAGGAGE" } ] } ] } ] }, { "type": "flight-offer", "id": "4", "source": "GDS", "instantTicketingRequired": false, "paymentCardRequired": false, "lastTicketingDate": "2021-07-30", "itineraries": [ { "segments": [ { "departure": { "iataCode": "SFO", "terminal": "2", "at": "2021-09-22T12:50:00" }, "arrival": { "iataCode": "PHX", "at": "2021-09-22T14:50:00" }, "carrierCode": "AS", "number": "2028", "aircraft": { "code": "E75" }, "operating": { "carrierCode": "AS" }, "duration": "PT2H", "id": "1", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "126.17", "base": "106.00", "fees": [{ "amount": "0.00", "type": "TICKETING" }], "grandTotal": "126.17" }, "pricingOptions": { "fareType": ["PUBLISHED"], "includedCheckedBagsOnly": false, "refundableFare": false, "noRestrictionFare": false, "noPenaltyFare": false }, "validatingAirlineCodes": ["AS"], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "126.17", "base": "106.00", "taxes": [ { "amount": "3.65", "code": "ZP" }, { "amount": "4.75", "code": "AY" }, { "amount": "7.95", "code": "US" }, { "amount": "3.82", "code": "XF" } ] }, "fareDetailsBySegment": [ { "segmentId": "1", "cabin": "BUSINESS", "fareBasis": "OH2OAVFN", "brandedFare": "FR", "class": "I", "includedCheckedBags": { "quantity": 2 }, "amenities": [ { "code": "059", "description": "CHANGEABLE TICKET", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0BX", "description": "LOUNGE ACCESS", "isChargeable": false, "amenityType": "LOUNGE" }, { "code": "0B1", "description": "IN FLIGHT ENTERTAINMENT", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "0B3", "description": "MEAL 1", "isChargeable": false, "amenityType": "MEAL" }, { "code": "0G6", "description": "PRIORITY BOARDING", "isChargeable": false, "amenityType": "TRAVEL_SERVICES" }, { "code": "0B5", "description": "SEAT ASSIGNMENT", "isChargeable": false, "amenityType": "PRE_RESERVED_SEAT" }, { "code": "0GO", "description": "STANDARD PIECE MAX 50LB 62LI", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "0MU", "description": "CARRY ON UP TO 45 LI 115 LCM", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "02P", "description": "110V AC POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "02Q", "description": "USB POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "06G", "description": "175 PERCENT MILES EARNED", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0CL", "description": "INTERNET ACCESS", "isChargeable": true, "amenityType": "ENTERTAINMENT" } ] } ] } ] }, { "type": "flight-offer", "id": "5", "source": "GDS", "instantTicketingRequired": false, "paymentCardRequired": false, "lastTicketingDate": "2021-07-30", "itineraries": [ { "segments": [ { "departure": { "iataCode": "SFO", "terminal": "2", "at": "2021-09-22T12:50:00" }, "arrival": { "iataCode": "PHX", "at": "2021-09-22T14:50:00" }, "carrierCode": "AS", "number": "2028", "aircraft": { "code": "E75" }, "operating": { "carrierCode": "AS" }, "duration": "PT2H", "id": "1", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "359.45", "base": "323.00", "fees": [{ "amount": "0.00", "type": "TICKETING" }], "grandTotal": "359.45" }, "pricingOptions": { "fareType": ["PUBLISHED"], "includedCheckedBagsOnly": false, "refundableFare": false, "noRestrictionFare": false, "noPenaltyFare": false }, "validatingAirlineCodes": ["AS"], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "359.45", "base": "323.00", "taxes": [ { "amount": "3.65", "code": "ZP" }, { "amount": "4.75", "code": "AY" }, { "amount": "24.23", "code": "US" }, { "amount": "3.82", "code": "XF" } ] }, "fareDetailsBySegment": [ { "segmentId": "1", "cabin": "ECONOMY", "fareBasis": "MH0OAVMR", "brandedFare": "FM", "class": "M", "includedCheckedBags": { "quantity": 0 }, "amenities": [ { "code": "056", "description": "REFUNDABLE TICKET", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "059", "description": "CHANGEABLE TICKET", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0B1", "description": "IN FLIGHT ENTERTAINMENT", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "0B5", "description": "SEAT ASSIGNMENT", "isChargeable": false, "amenityType": "PRE_RESERVED_SEAT" }, { "code": "0MU", "description": "CARRY ON UP TO 45 LI 115 LCM", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "02P", "description": "110V AC POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "02Q", "description": "USB POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "0BX", "description": "LOUNGE ACCESS", "isChargeable": true, "amenityType": "LOUNGE" }, { "code": "0CL", "description": "INTERNET ACCESS", "isChargeable": true, "amenityType": "ENTERTAINMENT" }, { "code": "0B3", "description": "MEAL 1", "isChargeable": true, "amenityType": "MEAL" }, { "code": "0BJ", "description": "UPGRADE", "isChargeable": true, "amenityType": "UPGRADES" }, { "code": "0GO", "description": "STANDARD PIECE MAX 50LB 62LI", "isChargeable": true, "amenityType": "BAGGAGE" } ] } ] } ] }, { "type": "flight-offer", "id": "6", "source": "GDS", "instantTicketingRequired": false, "paymentCardRequired": false, "lastTicketingDate": "2021-08-01", "itineraries": [ { "segments": [ { "departure": { "iataCode": "SFO", "terminal": "2", "at": "2021-09-22T12:50:00" }, "arrival": { "iataCode": "PHX", "at": "2021-09-22T14:50:00" }, "carrierCode": "AS", "number": "2028", "aircraft": { "code": "E75" }, "operating": { "carrierCode": "AS" }, "duration": "PT2H", "id": "1", "numberOfStops": 0, "blacklistedInEU": false } ] } ], "price": { "currency": "EUR", "total": "398.15", "base": "359.00", "fees": [{ "amount": "0.00", "type": "TICKETING" }], "grandTotal": "398.15" }, "pricingOptions": { "fareType": ["PUBLISHED"], "includedCheckedBagsOnly": false, "refundableFare": false, "noRestrictionFare": false, "noPenaltyFare": false }, "validatingAirlineCodes": ["AS"], "travelerPricings": [ { "travelerId": "1", "fareOption": "STANDARD", "travelerType": "ADULT", "price": { "currency": "EUR", "total": "398.15", "base": "359.00", "taxes": [ { "amount": "3.65", "code": "ZP" }, { "amount": "4.75", "code": "AY" }, { "amount": "26.93", "code": "US" }, { "amount": "3.82", "code": "XF" } ] }, "fareDetailsBySegment": [ { "segmentId": "1", "cabin": "BUSINESS", "fareBasis": "MH0OAVFR", "brandedFare": "FF", "class": "D", "includedCheckedBags": { "quantity": 2 }, "amenities": [ { "code": "056", "description": "REFUNDABLE TICKET", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "059", "description": "CHANGEABLE TICKET", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0BX", "description": "LOUNGE ACCESS", "isChargeable": false, "amenityType": "LOUNGE" }, { "code": "0B1", "description": "IN FLIGHT ENTERTAINMENT", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "0B3", "description": "MEAL 1", "isChargeable": false, "amenityType": "MEAL" }, { "code": "0G6", "description": "PRIORITY BOARDING", "isChargeable": false, "amenityType": "TRAVEL_SERVICES" }, { "code": "0B5", "description": "SEAT ASSIGNMENT", "isChargeable": false, "amenityType": "PRE_RESERVED_SEAT" }, { "code": "0GO", "description": "STANDARD PIECE MAX 50LB 62LI", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "0MU", "description": "CARRY ON UP TO 45 LI 115 LCM", "isChargeable": false, "amenityType": "BAGGAGE" }, { "code": "02P", "description": "110V AC POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "02Q", "description": "USB POWER", "isChargeable": false, "amenityType": "ENTERTAINMENT" }, { "code": "06G", "description": "175 PERCENT MILES EARNED", "isChargeable": false, "amenityType": "BRANDED_FARES" }, { "code": "0CL", "description": "INTERNET ACCESS", "isChargeable": true, "amenityType": "ENTERTAINMENT" } ] } ] } ] } ] ```

Steps to Reproduce

  1. Search for a flight offer
  2. Use that flight offer to search for upsells

Expected Behavior: [What you expect to happen]
Currency to match the flight offer or to be able to specify

Actual Behavior: [What actually happens]
Currency is always in EUR

Stable Behavior? [What percentage of the time does it reproduce?]
100%

Versions

Node 14.1.0
Npm 6.14.4
Yarn 1.12.1
OS: Debian Buster

Checklist

Please make sure you checked the following:

[x] Are you running any of the current Node LTS versions?
[x] Did you download the latest version of this library?

Including all accepted options (parameters) for all endpoints.

Description

Working with the endpoints without knowing all possible parameters which include optional parameters makes it a lot more difficult to play around with the SDKs.

Steps to Reproduce

  1. I am using the Node SDK, but the example codes did not spell out all possible parameters. For example, I was trying out the Flight Offer Search Endpoint with the number of passengers that are children. I had to provide both children: 2 and child: 2 before I was sure which was the right parameter.

/v2/shopping/hotel-offers endpoint bug

Description

const response = await amadeus.shopping.hotelOffers.get({citycode})

returns AuthorizationError, but access_token is valid.

other endpoints are working.

Versions

v14.16.1

Uncaught ReferenceError: require is not defined when initializing amadeus

Description

When running my javascript code on Chrome and initialize amadeus, got the error:
Uncaught ReferenceError: require is not defined

Steps to Reproduce

I used "npm install amadeus --save"
and wrote the below function in javascript:

function fetchHotelInfo() {
let Amadeus = require('amadeus');
let amadeus = new Amadeus({
clientId: '',
clientSecret: ''
});
amadeus.referenceData.urls.checkinLinks.get({
airlineCode: 'BA'
}).then(function(response){
console.log(response.body); //=> The raw body
console.log(response.result); //=> The fully parsed result
console.log(response.data); //=> The data attribute taken from the result
}).catch(function(error){
console.log(error.response); //=> The response object with (un)parsed data
console.log(error.response.request); //=> The details of the request made
console.log(error.code); //=> A unique error code to identify the type of error
});

}

Expected Behavior: something should be logged

Actual Behavior: Uncaught ReferenceError: require is not defined

Stable Behavior? always

Versions

NPM: 6.14.4, MAC 10.15.4

Checklist

Please make sure you checked the following:

  • Are you running Node 6? yes
  • Did you download the latest version of this library? amadeus 4.0.0

Screen Shot 2020-04-26 at 11 04 22 PM

Screen Shot 2020-04-26 at 11 02 51 PM

amadeus hotelrating api shows error

Description

In hotel-sentiments api throws error
'{"errors":[{"status":415,"code":477,"title":"INVALID FORMAT","detail":"Accept header value specified in the request is not supported"}]}'
i am using this syntax,
amadeus.client.get('/v2/e-reputation/hotel-sentiments',{hotelIds :"ADNYCCTB"});

Suggestion to update the ```departureDate``` in README

Description

The departureDate in getting started code snippet is outdated and causes ClientError.
It would be nice if the date can be set to some future dates. :D

Steps to Reproduce

var Amadeus = require('amadeus');

var amadeus = new Amadeus({
  clientId: 'REPLACE_BY_YOUR_API_KEY',
  clientSecret: 'REPLACE_BY_YOUR_API_SECRET'
});

amadeus.shopping.flightOffersSearch.get({
    originLocationCode: 'SYD',
    destinationLocationCode: 'BKK',
    departureDate: '2020-08-01',
    adults: '2'
}).then(function(response){
  console.log(response.data);
}).catch(function(responseError){
  console.log(responseError.code);
});

Expected Behavior: Response.data

Actual Behavior: ClientError

FlightOrders POST - expects different payload

Description

The creation of a flight order expects a different payload than the one documented. (data wrapper to the request object)

Expected Behavior: [What you expect to happen]

amadeus.booking.flightOrders.post(
      JSON.stringify({
         data: {
           'type': 'flight-order',
           'flightOffers': response.flightOffers,
           'travelers_info': []
         }
      })

or handle the data internally.

Actual Behavior: [What actually happens]

amadeus.booking.flightOrders.post(
      JSON.stringify({
        'type': 'flight-order',
        'flightOffers': response.flightOffers,
        'travelers_info': []
      })

Results an error: MANDATORY DATA MISSING - data needed 400/32171

Versions

[What version of Node/NPM are you running? What Operating System are you on?]
v12.16.1

Checklist

Please make sure you checked the following:

  • Are you running any of the current Node LTS versions? yes
  • Did you download the latest version of this library? yes

Let me know if I can help with a PR.

Thank you.

Todos before shipping

  • Enable travis
  • Make the project public
  • Update plural/singular namespaces to match ruby
  • Update hotels to match Ruby
  • Add new locations API
  • Remove docs from repo
  • Bump version to 1.0.0
  • Release 1.0.0
  • Update changelog
  • Remove checklist issue and this issue
  • Check and fix all links in Readme
  • Use Travis to deploy docs
  • Decouple from cbetta github account by setting up an amadeus*** github account
    • Decouple travis from this GH account
    • Decouple codeclimate from this GH account
  • Remove beta tag from Travis and docs
  • Deprecate 0.1.0 release

Package install not working

Packaging broken; not installing the module?

$ npm install amadeus4dev/amadeus-node --save
npm WARN [email protected] No repository field.

  • [email protected]
    added 1 package from 2 contributors in 3.927s
    [+] no known vulnerabilities found [15 packages audited]

$ ls -alt node_modules/amadeus/
total 72
drwxrwxr-x 2 hari hari 4096 May 14 22:54 .
drwxrwxr-x 15 hari hari 4096 May 14 22:54 ..
-rw-rw-r-- 1 hari hari 2309 May 14 22:54 package.json
-rw-rw-r-- 1 hari hari 791 Oct 26 1985 CHANGELOG.md
-rw-rw-r-- 1 hari hari 1085 Oct 26 1985 LICENSE
-rw-rw-r-- 1 hari hari 8027 Oct 26 1985 README.md
-rw-rw-r-- 1 hari hari 534 Oct 26 1985 .travis.yml

$ node amadeus_test.js
internal/modules/cjs/loader.js:573
throw err;
^

Error: Cannot find module 'amadeus'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:571:15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.