<commit_before># Air :airplane:

The Air workflow allows you to do what most travel agents did in the past and what many search engines still do today: book a trip for a customer. Air service provides:

* Air Shop: Search for flight options by lowest fare (LowFareSearch(Asynch)Req) or availability (AirAvailability).
* Air Price: Price the selected flights and request additional information about rules, flight details, and seating.
* Air Book: Book the flights when you are satisfied with the times, price, and rules.

# API

**AirService**
* [.shop(params)](#shop)
* [.book(params)](#book)
* [.ticket(params)](#ticket)
* [.toQueue(params)](#toQueue)
* [.getPNR(params)](#getPNR)
* [.importPNR(params)](#importPNR)
* [.getUniversalRecordByPNR(params)](#getUniversalRecordByPNR)
* [.flightInfo(params)](#flightInfo)
* [.getPNRByTicketNumber(params)](#getPNRByTicketNumber)
* [.searchBookingsByPassengerName(params)](#searchBookingsByPassengerName)
* [.getTicket(params)](#getTicket)
* [.getTickets(params)](#getTickets)
* [.cancelTicket(params)](#cancelTicket)
* [.cancelPNR(params)](#cancelPNR)

## .shop(params)
<a name="shop"></a>
Low Fare Shop functionality combines air availability and a fare quote request to return the lowest available fares for a specified itinerary, using origin/destination and date information. Fares are available for one-way, round-trip, and multi-city travel. Low Fare Shop does not require a booked itinerary to return fare data.

**Returns**: `Promise`
**See**: [Low Fare Shopping Model](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Air_Models/Low_Fare_Shopping_Model.htm%3FTocPath%3DAir%7CAir%2520Shopping%2520and%2520Booking%7CLow%2520Fare%2520Shopping%7C_____1)


| Param | Type | Description |
| --- | --- | --- |
| legs | `Array<Leg>` | See `Leg` description [below](#leg). |
| passengers | `Search Passengers` | See `Search Passengers` description [below](#passengers). |
| cabins | `Cabins array` | See `Cabins array` description [below](#cabins). |
| requestId | `string` | Trace id of this request. |

### Leg object
<a name="leg"></a>
Each leg represents one part of the journey. For example, a typical roundtrip IEV-PAR-IEV should have two legs: IEV-PAR and PAR-IEV. An open-jaw route would still consist of two legs, e.g. IEV-PAR, AMS-IEV. For a more complicated route, more than two legs can be requested.

| Param | Type | Description |
| --- | --- | --- |
| from | `String` | IATA code. |
| to | `String` | IATA code. |
| departureDate | `String` | Date in format `YYYY-MM-DD`. |

### Search Passengers object
<a name="passengers"></a>

| Param | Type | Description |
| --- | --- | --- |
| ADT | `Number` | Adults count. |
| INF | `Number` | Infants count ( < 2 years ) . |
| CNN | `Number` | Children count ( < 12 years ). |
| [Other types](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Shared_Air_Topics/Passenger_Type_Codes.htm) | `Number` | Other IATA Passenger Type Codes available  (see uAPI documentation). |

### Cabins array
<a name="cabins"></a>
The cabins array lists requested cabin types, currently `Economy` or `Business` or both.


**See: <a href="../examples/Air/shop.js">Shop example</a>**


## .book(params)
<a name="book"></a>
After searching for air segments and fares, air bookings are created using the results from an Air Pricing response. Book is aggregated function which do AirPrice request before making booking request. So you don't need to make AirPrice request manually.

**Returns**: `Promise`
**See**: [Create Air Booking](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Air_Booking/Create_Air_Booking/Creating_Air_Bookings.htm%3FTocPath%3DAir%7CAir%2520Shopping%2520and%2520Booking%7CAir%2520Booking%7CCreating%2520Air%2520Bookings%7C_____0)

| Param | Type | Description |
| --- | --- | --- |
| segments | `Array<Segment>` | See `Segment` description [below](#segment). |
| passengers | `Book Passengers` | See `Book Passengers` description [below](#book-passengers). |
| phone | `Phone`  | Booking agency/traveller phone. See `Phone` description [below](#phone). |
| deliveryInformation | `Delivery Information` | Optional param. See `Delivery Information` description [below](#delivery-info). |
| rule | `String` | Custom check rule. |

### Segment object
<a name="segment"></a>
Each search response has `Directions` array which represents different variations of the same trip (with same price), but with the different flight options. Each index of `Directions` array represents leg index. For example if you have IEV-PAR-IEV roundtrip search request it will have IEV-PAR, PAR-IEV legs. And `Directions` array will have length 2. Under `Directions[0]` and `Directions[1]` will be different options for the flight.
So under `Directions[0][1]` you will find `Segments` array. This segments are used for booking.
Please specify `transfer` field to mark connection segment.

`Segment` object sample.
```json
{
  "from": "KBP",
  "to": "AMS",
  "bookingClass": "G",
  "departure": "2016-11-10T19:40:00.000+02:00",
  "arrival": "2016-11-10T21:45:00.000+01:00",
  "airline": "KL",
  "flightNumber": "3098",
  "serviceClass": "Economy",
  "plane": "E90",
  "fareBasisCode": "GSRUA",
  "group": 0
}
```

### Book Passengers object
<a name="book-passengers"></a>

| Param | Type | Description |
| --- | --- | --- |
| lastName | `String` | Passenger last name. |
| firstName | `String` | Passenger first name. |
| birthDate | `String` | Birth date in format `YYYY-MM-DD`. |
| gender | `String` | One of `['M', 'F']`. |
| ageCategory | `String` | One of `['ADT', 'CNN', 'INF']`. Or [other types](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Shared_Air_Topics/Passenger_Type_Codes.htm) |
| passNumber| `String` | Pass number. |
| passCountry| `String` | 2-letter code of country. |

### Phone object
<a name="phone"></a>

| Param | Type | Description |
| --- | --- | --- |
| location | `String` | City code of the phone number origin. |
| countryCode | `String` | Country code, prepending telephone number. |
| number | `String` | Phone number. |

### Delivery info object
<a name="delivery-info"></a>

| Param | Type | Description |
| --- | --- | --- |
| name | `String` | First and last name of the delivery recipient |
| street | `String` | Street address |
| zip | `String` | Postal code |
| country | `String` | Country |
| city | `String` | City |

**See: <a href="../examples/Air/book.js">Book example</a>**


## .ticket(params)
<a name="ticket"></a>
**This library is designed to do `getPNR` right after ticketing is finished with success.**
Ticketing is typically included as a follow-on request to an Air Booking response.
Any number of tickets can be issued from one Stored Fare Quote when a booking has multiple passengers. Tickets can also be issued when there is more than one Stored Fare Quote in the PNR.
Ticketing function returns `true` if the process is finished with success or `Error`.
**Returns**: `Promise(true | Error)`.
**See**: [Air Ticketing](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Air_Ticketing/Air_Ticketing.htm%3FTocPath%3DAir%7CAir%2520Shopping%2520and%2520Booking%7CAir%2520Ticketing%2520(Document%2520Production)%7C_____0)
<commit_msg>#272 document allowWaitlist<commit_after># Air :airplane:

The Air workflow allows you to do what most travel agents did in the past and what many search engines still do today: book a trip for a customer. Air service provides:

* Air Shop: Search for flight options by lowest fare (LowFareSearch(Asynch)Req) or availability (AirAvailability).
* Air Price: Price the selected flights and request additional information about rules, flight details, and seating.
* Air Book: Book the flights when you are satisfied with the times, price, and rules.

# API

**AirService**
* [.shop(params)](#shop)
* [.book(params)](#book)
* [.ticket(params)](#ticket)
* [.toQueue(params)](#toQueue)
* [.getPNR(params)](#getPNR)
* [.importPNR(params)](#importPNR)
* [.getUniversalRecordByPNR(params)](#getUniversalRecordByPNR)
* [.flightInfo(params)](#flightInfo)
* [.getPNRByTicketNumber(params)](#getPNRByTicketNumber)
* [.searchBookingsByPassengerName(params)](#searchBookingsByPassengerName)
* [.getTicket(params)](#getTicket)
* [.getTickets(params)](#getTickets)
* [.cancelTicket(params)](#cancelTicket)
* [.cancelPNR(params)](#cancelPNR)

## .shop(params)
<a name="shop"></a>
Low Fare Shop functionality combines air availability and a fare quote request to return the lowest available fares for a specified itinerary, using origin/destination and date information. Fares are available for one-way, round-trip, and multi-city travel. Low Fare Shop does not require a booked itinerary to return fare data.

**Returns**: `Promise`
**See**: [Low Fare Shopping Model](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Air_Models/Low_Fare_Shopping_Model.htm%3FTocPath%3DAir%7CAir%2520Shopping%2520and%2520Booking%7CLow%2520Fare%2520Shopping%7C_____1)


| Param | Type | Description |
| --- | --- | --- |
| legs | `Array<Leg>` | See `Leg` description [below](#leg). |
| passengers | `Search Passengers` | See `Search Passengers` description [below](#passengers). |
| cabins | `Cabins array` | See `Cabins array` description [below](#cabins). |
| requestId | `string` | Trace id of this request. |

### Leg object
<a name="leg"></a>
Each leg represents one part of the journey. For example, a typical roundtrip IEV-PAR-IEV should have two legs: IEV-PAR and PAR-IEV. An open-jaw route would still consist of two legs, e.g. IEV-PAR, AMS-IEV. For a more complicated route, more than two legs can be requested.

| Param | Type | Description |
| --- | --- | --- |
| from | `String` | IATA code. |
| to | `String` | IATA code. |
| departureDate | `String` | Date in format `YYYY-MM-DD`. |

### Search Passengers object
<a name="passengers"></a>

| Param | Type | Description |
| --- | --- | --- |
| ADT | `Number` | Adults count. |
| INF | `Number` | Infants count ( < 2 years ) . |
| CNN | `Number` | Children count ( < 12 years ). |
| [Other types](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Shared_Air_Topics/Passenger_Type_Codes.htm) | `Number` | Other IATA Passenger Type Codes available  (see uAPI documentation). |

### Cabins array
<a name="cabins"></a>
The cabins array lists requested cabin types, currently `Economy` or `Business` or both.


**See: <a href="../examples/Air/shop.js">Shop example</a>**


## .book(params)
<a name="book"></a>
After searching for air segments and fares, air bookings are created using the results from an Air Pricing response. Book is aggregated function which do AirPrice request before making booking request. So you don't need to make AirPrice request manually.

**Returns**: `Promise`
**See**: [Create Air Booking](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Air_Booking/Create_Air_Booking/Creating_Air_Bookings.htm%3FTocPath%3DAir%7CAir%2520Shopping%2520and%2520Booking%7CAir%2520Booking%7CCreating%2520Air%2520Bookings%7C_____0)

| Param | Type | Description |
| --- | --- | --- |
| segments | `Array<Segment>` | See `Segment` description [below](#segment). |
| passengers | `Book Passengers` | See `Book Passengers` description [below](#book-passengers). |
| phone | `Phone`  | Booking agency/traveller phone. See `Phone` description [below](#phone). |
| deliveryInformation | `Delivery Information` | Optional param. See `Delivery Information` description [below](#delivery-info). |
| rule | `String` | Custom check rule. |
| allowWaitlist | `Boolean` | Allow open waitlisted segments, do not cancel booking. See `allowWaitlist` description [below](#allow-waitlist). |

### Segment object
<a name="segment"></a>
Each search response has `Directions` array which represents different variations of the same trip (with same price), but with the different flight options. Each index of `Directions` array represents leg index. For example if you have IEV-PAR-IEV roundtrip search request it will have IEV-PAR, PAR-IEV legs. And `Directions` array will have length 2. Under `Directions[0]` and `Directions[1]` will be different options for the flight.
So under `Directions[0][1]` you will find `Segments` array. This segments are used for booking.
Please specify `transfer` field to mark connection segment.

`Segment` object sample.
```json
{
  "from": "KBP",
  "to": "AMS",
  "bookingClass": "G",
  "departure": "2016-11-10T19:40:00.000+02:00",
  "arrival": "2016-11-10T21:45:00.000+01:00",
  "airline": "KL",
  "flightNumber": "3098",
  "serviceClass": "Economy",
  "plane": "E90",
  "fareBasisCode": "GSRUA",
  "group": 0
}
```

### Book Passengers object
<a name="book-passengers"></a>

| Param | Type | Description |
| --- | --- | --- |
| lastName | `String` | Passenger last name. |
| firstName | `String` | Passenger first name. |
| birthDate | `String` | Birth date in format `YYYY-MM-DD`. |
| gender | `String` | One of `['M', 'F']`. |
| ageCategory | `String` | One of `['ADT', 'CNN', 'INF']`. Or [other types](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Shared_Air_Topics/Passenger_Type_Codes.htm) |
| passNumber| `String` | Pass number. |
| passCountry| `String` | 2-letter code of country. |

### Phone object
<a name="phone"></a>

| Param | Type | Description |
| --- | --- | --- |
| location | `String` | City code of the phone number origin. |
| countryCode | `String` | Country code, prepending telephone number. |
| number | `String` | Phone number. |

### Delivery info object
<a name="delivery-info"></a>

| Param | Type | Description |
| --- | --- | --- |
| name | `String` | First and last name of the delivery recipient |
| street | `String` | Street address |
| zip | `String` | Postal code |
| country | `String` | Country |
| city | `String` | City |

**See: <a href="../examples/Air/book.js">Book example</a>**

### allowWaitlist
<a name="allow-waitlist"></a>

Default behavior is to cancel the entire Universal Record when part of the booking has failed.
This includes both open and closed waitlisting and other errors.
With `allowWaitlist`=true the UR is canceled only for a closed wait list, but open waitlist reservation is kept and returned to user.


## .ticket(params)
<a name="ticket"></a>
**This library is designed to do `getPNR` right after ticketing is finished with success.**
Ticketing is typically included as a follow-on request to an Air Booking response.
Any number of tickets can be issued from one Stored Fare Quote when a booking has multiple passengers. Tickets can also be issued when there is more than one Stored Fare Quote in the PNR.
Ticketing function returns `true` if the process is finished with success or `Error`.
**Returns**: `Promise(true | Error)`.
**See**: [Air Ticketing](https://support.travelport.com/webhelp/uapi/uAPI.htm#Air/Air_Ticketing/Air_Ticketing.htm%3FTocPath%3DAir%7CAir%2520Shopping%2520and%2520Booking%7CAir%2520Ticketing%2520(Document%2520Production)%7C_____0)

{'fraction_non_alphanumeric': 0.14825990746328707, 'fraction_numerical': 0.01964728760142158, 'mean_word_length': 4.742780130920293, 'pattern_counts': {'":': 22, '<': 61, '<?xml version=': 0, '>': 57, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '558299', 'n_tokens_mistral': 5023, 'n_tokens_neox': 4688, 'n_words': 1493}