-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathsabre-dev-studio-flight.js
More file actions
248 lines (232 loc) · 8.5 KB
/
sabre-dev-studio-flight.js
File metadata and controls
248 lines (232 loc) · 8.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
'use strict';
var SabreDevStudioFlight = (function() {
function SabreDevStudioFlight(options) {
var that = this
, SabreDevStudio = require('./sabre-dev-studio')
;
this.sabre_dev_studio = new SabreDevStudio(options);
/**
* List of Air Shopping Themes
*
* https://developer.sabre.com/docs/read/rest_apis/travel_theme_lookup
*
* Example (assumes sabre_dev_studio_flight already initialized):
* sabre_dev_studio_flight.travel_theme_lookup(callback);
*/
this.travel_theme_lookup = function(callback) {
var endpoint = '/v1/lists/supported/shop/themes';
that.sabre_dev_studio.get(endpoint, {}, callback);
};
/**
* Theme Airport Lookup
*
* https://developer.sabre.com/docs/read/rest_apis/theme_airport_lookup
*
* Example (assumes sabre_dev_studio_flight already initialized):
* sabre_dev_studio_flight.theme_airport_lookup('beach', callback);
*/
this.theme_airport_lookup = function(theme, callback) {
var endpoint = '/v1/lists/supported/shop/themes/' + theme;
that.sabre_dev_studio.get(endpoint, {}, callback);
};
/**
* Shop for a destination (from a list of generalized destinations) given a date range
*
* https://developer.sabre.com/docs/read/rest_apis/destination_finder
*
* Note: Timezones are specific to the departure and arrival airports (but not specified).
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = {
* origin : 'LAS',
* departuredate : '2014-06-22',
* returndate : '2014-06-23',
* theme : 'MOUNTAINS'
* };
* sabre_dev_studio_flight.destination_finder(options, callback);
*/
this.destination_finder = function(options, callback) {
var endpoint = '/v1/shop/flights/fares';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Future Dates Lead Fare Search, aka "Calendar Lead"
*
* https://developer.sabre.com/docs/read/rest_apis/lead_price_calendar
*
* Note: Timezones are specific to the departure and arrival airports (but not specified).
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = {
* origin : 'LAS',
* destination : 'ATL',
* lengthofstay : 5
* };
* sabre_dev_studio_flight.lead_price_calendar(options, callback);
*/
this.lead_price_calendar = function(options, callback) {
var endpoint = '/v1/shop/flights/fares';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Shop for a fare with an origin for a destination with departure and return dates
*
* https://developer.sabre.com/docs/read/rest_apis/instaflights_search
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = {
* origin : 'ATL',
* destination : 'LAS',
* departuredate : '2014-06-22',
* returndate : '2014-06-23',
* limit : 10,
* sortby : 'totalfare',
* order : 'asc',
* sortby2 : 'departuretime',
* order2 : 'dsc'
* };
* sabre_dev_studio_flight.instaflights_search(options, callback);
*/
this.instaflights_search = function(options, callback) {
var endpoint = '/v1/shop/flights';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Search for the lowest available priced itineraries based upon a travel date.
* A wide range of user-specified criteria can be applied to the search.
* @param request request to send as a string.
* @param callback
*/
this.bargain_finder_max = function (request, callback) {
var endpoint = '/v4/offers/shop/flights';
var options = {
'mode': 'live',
'Content-Type': 'application/json',
'enabletagging':true,
'limit':200
};
that.sabre_dev_studio.post(endpoint, request, options, callback);
};
/**
* Search for the lowest available priced itineraries based upon +/-1 or +/-3 alternate dates.
* A wide range of user-specified criteria can be applied to the search
* @param request request to send as a string.
* @param callback
*/
this.alternate_date = function (request, callback) {
var endpoint = '/v1.8.5/shop/altdates/flights';
var options = {
'mode': 'live',
'Content-Type': 'application/json'
};
that.sabre_dev_studio.post(endpoint, request, options, callback);
};
/**
* Get up to 200 roundtrip itineraries for a specific origin, destination, and length of stay across a large set or range of travel dates.
* https://developer.sabre.com/docs/rest_apis/air/search/advanced_calendar_search/
* You provide search options within request text.
* @param request request to send as a string.
* @param callback
*/
this.advanced_calendar_search = function(request, callback) {
var endpoint = '/v1.8.1/shop/calendar/flights';
var options = {
'Content-Type': 'application/json'
};
that.sabre_dev_studio.post(endpoint, request, options, callback);
};
/**
* Low Fare Forecast
*
* https://developer.sabre.com/docs/rest_apis/low_fare_forecast
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = {
* origin : 'ATL',
* destination : 'LAS',
* departuredate : '2014-10-01',
* returndate : '2014-10-01'
* };
* sabre_dev_studio_flight.low_fare_forecast(options, callback);
*/
this.low_fare_forecast = function(options, callback) {
var endpoint = '/v1/forecast/flights/fares';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Fare Range
*
* https://developer.sabre.com/docs/read/rest_apis/fare_range
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = {
* origin : 'JFK',
* destination : 'LAX',
* earliestdeparturedate : '2014-06-01',
* latestdeparturedate : '2014-06-01',
* lengthofstay : 4
* };
* sabre_dev_studio_flight.fare_range(options, callback);
*/
this.fare_range = function(options, callback) {
var endpoint = '/v1/historical/flights/fares';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Travel Seasonality
*
* https://developer.sabre.com/docs/read/rest_apis/travel_seasonality
*
* Example (assumes sabre_dev_studio_flight already initialized):
* sabre_dev_studio_flight.travel_seasonality('DFW', callback);
*/
this.travel_seasonality = function(destination, callback) {
var endpoint = '/v1/historical/flights/' + destination + '/seasonality';
that.sabre_dev_studio.get(endpoint, {}, callback);
};
/**
* City Pairs Lookup
*
* https://developer.sabre.com/docs/read/rest_apis/city_pairs_lookup
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = {
* origincountry : 'US',
* destinationcountry : 'US'
* };
* sabre_dev_studio_flight.city_pairs_lookup(options, callback);
*/
this.city_pairs_lookup = function(options, callback) {
var endpoint = '/v1/lists/airports/supported/origins-destinations';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Multi-Airport City Lookup
*
* https://developer.sabre.com/docs/read/rest_apis/multiairport_city_lookup
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = { country: 'US' };
* sabre_dev_studio_flight.multiairport_city_lookup(options, callback);
*/
this.multiairport_city_lookup = function(options, callback) {
var endpoint = '/v1/lists/cities';
that.sabre_dev_studio.get(endpoint, options, callback);
};
/**
* Airports At Cities Lookup
*
* https://developer.sabre.com/docs/read/rest_apis/airports_at_cities_lookup
*
* Example (assumes sabre_dev_studio_flight already initialized):
* options = { city: 'NYC' };
* sabre_dev_studio_flight.airports_at_cities_lookup(options, callback);
*/
this.airports_at_cities_lookup = function(options, callback) {
var endpoint = '/v1/lists/airports';
that.sabre_dev_studio.get(endpoint, options, callback);
};
}
return SabreDevStudioFlight;
})();
module.exports.SabreDevStudioFlight = SabreDevStudioFlight;