@findhotel/sapi 1.25.8 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -47,7 +47,8 @@ hotels, hotels\' offers and rooms.
47
47
  - [Response](#freeTextSuggest-response)
48
48
  - [`rooms()` method](#rooms-method)
49
49
  - [Rooms parameters](#rooms-parameters)
50
- - [Response](#response-3)
50
+ - [Response](#rooms-response)
51
+ - [Rooms long-polling](#rooms-long-polling)
51
52
  - [`hotel()` method](#hotel-method)
52
53
  - [Hotel parameters](#hotel-parameters)
53
54
  - [Response](#response-4)
@@ -275,6 +276,7 @@ For full documentation, check [search method api](#search-method).
275
276
  <a id="tutorial-get-rooms"></a>
276
277
 
277
278
  Get rooms data and rooms\' offers:
279
+
278
280
  ```js
279
281
  const rooms = await sapiClient.rooms({
280
282
  hotelId: "47319",
@@ -989,7 +991,8 @@ const result = await sapiClient.freeTextSuggest(
989
991
  Rooms is a method of **sapiClient** for retrieving rooms information and
990
992
  offers for a particular itinerary:
991
993
 
992
- V1
994
+ V1
995
+
993
996
  ```js
994
997
  const rooms = await sapiClient.rooms({
995
998
  hotelId: "1714808",
@@ -1000,6 +1003,7 @@ const rooms = await sapiClient.rooms({
1000
1003
  ```
1001
1004
 
1002
1005
  V2
1006
+
1003
1007
  ```js
1004
1008
  const rooms = await sapiClient.roomsV2({
1005
1009
  hotelId: "1714808",
@@ -1039,6 +1043,7 @@ const rooms = await sapiClient.roomsV2({
1039
1043
  ### Response
1040
1044
 
1041
1045
  <a id="rooms-response"></a>
1046
+
1042
1047
  V1 Response
1043
1048
 
1044
1049
  ```json
@@ -1091,277 +1096,316 @@ V2 Respnose
1091
1096
 
1092
1097
  ```json
1093
1098
  {
1094
- "entities": [
1099
+ "entities": [
1100
+ {
1101
+ "id": "b57ac4d3-72bf-4f0c-b82f-28e29543c06a",
1102
+ "entityType": "split_booking",
1103
+ "rooms": [
1095
1104
  {
1096
- "id": "b57ac4d3-72bf-4f0c-b82f-28e29543c06a",
1097
- "entityType": "split_booking",
1098
- "rooms": [
1099
- {
1100
- "id": "SHPLitp7oTk",
1101
- "name": "Room",
1102
- "raaName": "Room",
1103
- "amenities": [],
1104
- "images": [],
1105
- "description": "",
1106
- "smokingOptionsAvailable": false,
1107
- "bedTypes": [],
1108
- "area": {}
1109
- },
1110
- {
1111
- "id": "dn4Qijq4auI",
1112
- "name": "cosy room(City view)",
1113
- "raaName": "cosy room(City view)",
1114
- "amenities": [],
1115
- "images": [],
1116
- "description": "",
1117
- "smokingOptionsAvailable": false,
1118
- "bedTypes": [],
1119
- "area": {}
1120
- }
1121
- ],
1122
- "offers": [
1123
- {
1124
- "isClicked": true,
1125
- "matchType": "by_price",
1126
- "matchedOfferPriceDiff": 0,
1127
- "id": "b57ac4d3-72bf-4f0c-b82f-28e29543c06a",
1128
- "availableRooms": null,
1129
- "canPayLater": false,
1130
- "cancellationPenalties": [],
1131
- "cug": null,
1132
- "links": [
1133
- {
1134
- "href": "https://secure.findhotel.net/checkout/?bundleId=b57ac4d3-72bf-4f0c-b82f-28e29543c06a..",
1135
- "method": "GET",
1136
- "type": "checkout"
1137
- }
1138
- ],
1139
- "prices": [
1140
- {
1141
- "chargeable": {
1142
- "base": "570.7278477192",
1143
- "taxes": "46.6959148134"
1144
- },
1145
- "currencyCode": "EUR",
1146
- "hotelFees": {
1147
- "breakdown": [],
1148
- "total": "74.1946202035"
1149
- },
1150
- "rate": {
1151
- "base": 570.7278477192,
1152
- "taxes": 46.6959148134,
1153
- "hotelFees": 74.1946202035
1154
- },
1155
- "type": "chargeable_currency"
1156
- }
1157
- ],
1158
- "services": null,
1159
- "providerCode": "",
1160
- "tags": [
1161
- "price_matched",
1162
- "sb_single_flow"
1163
- ],
1164
- "metadata": {
1165
- "feedID": ""
1166
- },
1167
- "offerType": "split_booking",
1168
- "itineraries": [
1169
- {
1170
- "checkIn": "2025-03-30",
1171
- "checkOut": "2025-03-31",
1172
- "roomID": "SHPLitp7oTk",
1173
- "offer": {
1174
- "id": "ojnRYasJ3-Ws",
1175
- "availableRooms": null,
1176
- "providerRateType": "public",
1177
- "canPayLater": false,
1178
- "cancellationPenalties": [],
1179
- "cug": [],
1180
- "links": [
1181
- {
1182
- "href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
1183
- "method": "GET",
1184
- "type": "checkout"
1185
- }
1186
- ],
1187
- "prices": [
1188
- {
1189
- "chargeable": {
1190
- "base": "119.8596330275",
1191
- "taxes": "9.8066972477"
1192
- },
1193
- "currencyCode": "EUR",
1194
- "hotelFees": {
1195
- "breakdown": [],
1196
- "total": "15.5817522936"
1197
- },
1198
- "rate": {
1199
- "base": 119.8596330275,
1200
- "taxes": 9.8066972477,
1201
- "hotelFees": 15.5817522936
1202
- },
1203
- "type": "chargeable_currency"
1204
- }
1205
- ],
1206
- "services": [],
1207
- "providerCode": "SMR",
1208
- "tags": [
1209
- "preferred_rate",
1210
- "top_offer",
1211
- "exclusive_cheapest_offer"
1212
- ],
1213
- "metadata": {
1214
- "providerRateType": "public",
1215
- "feedID": ""
1216
- },
1217
- "offerType": "regular",
1218
- "itineraries": null,
1219
- "totalRate": {
1220
- "base": 0,
1221
- "taxes": 0,
1222
- "hotelFees": 0
1223
- }
1224
- }
1225
- },
1226
- {
1227
- "checkIn": "2025-03-31",
1228
- "checkOut": "2025-04-03",
1229
- "roomID": "dn4Qijq4auI",
1230
- "offer": {
1231
- "id": "o33J8HXa4tJY",
1232
- "availableRooms": 99,
1233
- "providerRateType": "plus",
1234
- "canPayLater": false,
1235
- "cancellationPenalties": [],
1236
- "cug": [],
1237
- "links": [
1238
- {
1239
- "href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
1240
- "method": "GET",
1241
- "type": "checkout"
1242
- }
1243
- ],
1244
- "prices": [
1245
- {
1246
- "chargeable": {
1247
- "base": "450.8682146917",
1248
- "taxes": "36.8892175657"
1249
- },
1250
- "currencyCode": "EUR",
1251
- "hotelFees": {
1252
- "breakdown": [],
1253
- "total": "58.6128679099"
1254
- },
1255
- "rate": {
1256
- "base": 450.8682146917,
1257
- "taxes": 36.8892175657,
1258
- "hotelFees": 58.6128679099
1259
- },
1260
- "type": "chargeable_currency"
1261
- }
1262
- ],
1263
- "services": [],
1264
- "providerCode": "DDT",
1265
- "tags": [
1266
- "preferred_rate",
1267
- "top_offer",
1268
- "exclusive_cheapest_offer"
1269
- ],
1270
- "metadata": {
1271
- "providerRateType": "plus",
1272
- "feedID": ""
1273
- },
1274
- "offerType": "regular",
1275
- "itineraries": null,
1276
- "totalRate": {
1277
- "base": 0,
1278
- "taxes": 0,
1279
- "hotelFees": 0
1280
- }
1281
- }
1282
- }
1283
- ],
1284
- "totalRate": {
1285
- "base": 570.7278477192,
1286
- "taxes": 46.6959148134,
1287
- "hotelFees": 74.1946202035
1288
- }
1289
- }
1290
- ],
1291
- "hasClickedOffer": true
1105
+ "id": "SHPLitp7oTk",
1106
+ "name": "Room",
1107
+ "raaName": "Room",
1108
+ "amenities": [],
1109
+ "images": [],
1110
+ "description": "",
1111
+ "smokingOptionsAvailable": false,
1112
+ "bedTypes": [],
1113
+ "area": {}
1292
1114
  },
1293
1115
  {
1294
- "id": "dn4Qijq4auI",
1295
- "entityType": "room",
1296
- "rooms": [
1297
- {
1298
- "id": "dn4Qijq4auI",
1299
- "name": "cosy room(City view)",
1300
- "raaName": "cosy room(City view)",
1301
- "amenities": [],
1302
- "images": [],
1303
- "description": "",
1304
- "smokingOptionsAvailable": false,
1305
- "bedTypes": [],
1306
- "area": {}
1116
+ "id": "dn4Qijq4auI",
1117
+ "name": "cosy room(City view)",
1118
+ "raaName": "cosy room(City view)",
1119
+ "amenities": [],
1120
+ "images": [],
1121
+ "description": "",
1122
+ "smokingOptionsAvailable": false,
1123
+ "bedTypes": [],
1124
+ "area": {}
1125
+ }
1126
+ ],
1127
+ "offers": [
1128
+ {
1129
+ "isClicked": true,
1130
+ "matchType": "by_price",
1131
+ "matchedOfferPriceDiff": 0,
1132
+ "id": "b57ac4d3-72bf-4f0c-b82f-28e29543c06a",
1133
+ "availableRooms": null,
1134
+ "canPayLater": false,
1135
+ "cancellationPenalties": [],
1136
+ "cug": null,
1137
+ "links": [
1138
+ {
1139
+ "href": "https://secure.findhotel.net/checkout/?bundleId=b57ac4d3-72bf-4f0c-b82f-28e29543c06a..",
1140
+ "method": "GET",
1141
+ "type": "checkout"
1142
+ }
1143
+ ],
1144
+ "prices": [
1145
+ {
1146
+ "chargeable": {
1147
+ "base": "570.7278477192",
1148
+ "taxes": "46.6959148134"
1149
+ },
1150
+ "currencyCode": "EUR",
1151
+ "hotelFees": {
1152
+ "breakdown": [],
1153
+ "total": "74.1946202035"
1154
+ },
1155
+ "rate": {
1156
+ "base": 570.7278477192,
1157
+ "taxes": 46.6959148134,
1158
+ "hotelFees": 74.1946202035
1159
+ },
1160
+ "type": "chargeable_currency"
1161
+ }
1162
+ ],
1163
+ "services": null,
1164
+ "providerCode": "",
1165
+ "tags": ["price_matched", "sb_single_flow"],
1166
+ "metadata": {
1167
+ "feedID": ""
1168
+ },
1169
+ "offerType": "split_booking",
1170
+ "itineraries": [
1171
+ {
1172
+ "checkIn": "2025-03-30",
1173
+ "checkOut": "2025-03-31",
1174
+ "roomID": "SHPLitp7oTk",
1175
+ "offer": {
1176
+ "id": "ojnRYasJ3-Ws",
1177
+ "availableRooms": null,
1178
+ "providerRateType": "public",
1179
+ "canPayLater": false,
1180
+ "cancellationPenalties": [],
1181
+ "cug": [],
1182
+ "links": [
1183
+ {
1184
+ "href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
1185
+ "method": "GET",
1186
+ "type": "checkout"
1187
+ }
1188
+ ],
1189
+ "prices": [
1190
+ {
1191
+ "chargeable": {
1192
+ "base": "119.8596330275",
1193
+ "taxes": "9.8066972477"
1194
+ },
1195
+ "currencyCode": "EUR",
1196
+ "hotelFees": {
1197
+ "breakdown": [],
1198
+ "total": "15.5817522936"
1199
+ },
1200
+ "rate": {
1201
+ "base": 119.8596330275,
1202
+ "taxes": 9.8066972477,
1203
+ "hotelFees": 15.5817522936
1204
+ },
1205
+ "type": "chargeable_currency"
1206
+ }
1207
+ ],
1208
+ "services": [],
1209
+ "providerCode": "SMR",
1210
+ "tags": [
1211
+ "preferred_rate",
1212
+ "top_offer",
1213
+ "exclusive_cheapest_offer"
1214
+ ],
1215
+ "metadata": {
1216
+ "providerRateType": "public",
1217
+ "feedID": ""
1218
+ },
1219
+ "offerType": "regular",
1220
+ "itineraries": null,
1221
+ "totalRate": {
1222
+ "base": 0,
1223
+ "taxes": 0,
1224
+ "hotelFees": 0
1307
1225
  }
1308
- ],
1309
- "offers": [
1310
- {
1311
- "id": "o-9NZdSFm3Qc",
1312
- "availableRooms": 99,
1313
- "providerRateType": "plus",
1314
- "canPayLater": false,
1315
- "cancellationPenalties": [],
1316
- "cug": [],
1317
- "links": [
1318
- {
1319
- "href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
1320
- "method": "GET",
1321
- "type": "checkout"
1322
- }
1323
- ],
1324
- "prices": [
1325
- {
1326
- "chargeable": {
1327
- "base": "575.6297833706",
1328
- "taxes": "47.0969822758"
1329
- },
1330
- "currencyCode": "EUR",
1331
- "hotelFees": {
1332
- "breakdown": [],
1333
- "total": "74.8318718382"
1334
- },
1335
- "rate": {
1336
- "base": 575.6297833706,
1337
- "taxes": 47.0969822758,
1338
- "hotelFees": 74.8318718382
1339
- },
1340
- "type": "chargeable_currency"
1341
- }
1342
- ],
1343
- "services": [],
1344
- "providerCode": "DDT",
1345
- "tags": [
1346
- "top_offer",
1347
- "exclusive_cheapest_offer"
1348
- ],
1349
- "metadata": {
1350
- "providerRateType": "plus",
1351
- "feedID": ""
1226
+ }
1227
+ },
1228
+ {
1229
+ "checkIn": "2025-03-31",
1230
+ "checkOut": "2025-04-03",
1231
+ "roomID": "dn4Qijq4auI",
1232
+ "offer": {
1233
+ "id": "o33J8HXa4tJY",
1234
+ "availableRooms": 99,
1235
+ "providerRateType": "plus",
1236
+ "canPayLater": false,
1237
+ "cancellationPenalties": [],
1238
+ "cug": [],
1239
+ "links": [
1240
+ {
1241
+ "href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
1242
+ "method": "GET",
1243
+ "type": "checkout"
1244
+ }
1245
+ ],
1246
+ "prices": [
1247
+ {
1248
+ "chargeable": {
1249
+ "base": "450.8682146917",
1250
+ "taxes": "36.8892175657"
1251
+ },
1252
+ "currencyCode": "EUR",
1253
+ "hotelFees": {
1254
+ "breakdown": [],
1255
+ "total": "58.6128679099"
1352
1256
  },
1353
- "offerType": "regular",
1354
- "itineraries": null,
1355
- "totalRate": {
1356
- "base": 0,
1357
- "taxes": 0,
1358
- "hotelFees": 0
1359
- }
1257
+ "rate": {
1258
+ "base": 450.8682146917,
1259
+ "taxes": 36.8892175657,
1260
+ "hotelFees": 58.6128679099
1261
+ },
1262
+ "type": "chargeable_currency"
1263
+ }
1264
+ ],
1265
+ "services": [],
1266
+ "providerCode": "DDT",
1267
+ "tags": [
1268
+ "preferred_rate",
1269
+ "top_offer",
1270
+ "exclusive_cheapest_offer"
1271
+ ],
1272
+ "metadata": {
1273
+ "providerRateType": "plus",
1274
+ "feedID": ""
1360
1275
  },
1361
- ],
1362
- "hasClickedOffer": false
1276
+ "offerType": "regular",
1277
+ "itineraries": null,
1278
+ "totalRate": {
1279
+ "base": 0,
1280
+ "taxes": 0,
1281
+ "hotelFees": 0
1282
+ }
1283
+ }
1284
+ }
1285
+ ],
1286
+ "totalRate": {
1287
+ "base": 570.7278477192,
1288
+ "taxes": 46.6959148134,
1289
+ "hotelFees": 74.1946202035
1290
+ }
1291
+ }
1292
+ ],
1293
+ "hasClickedOffer": true
1294
+ },
1295
+ {
1296
+ "id": "dn4Qijq4auI",
1297
+ "entityType": "room",
1298
+ "rooms": [
1299
+ {
1300
+ "id": "dn4Qijq4auI",
1301
+ "name": "cosy room(City view)",
1302
+ "raaName": "cosy room(City view)",
1303
+ "amenities": [],
1304
+ "images": [],
1305
+ "description": "",
1306
+ "smokingOptionsAvailable": false,
1307
+ "bedTypes": [],
1308
+ "area": {}
1309
+ }
1310
+ ],
1311
+ "offers": [
1312
+ {
1313
+ "id": "o-9NZdSFm3Qc",
1314
+ "availableRooms": 99,
1315
+ "providerRateType": "plus",
1316
+ "canPayLater": false,
1317
+ "cancellationPenalties": [],
1318
+ "cug": [],
1319
+ "links": [
1320
+ {
1321
+ "href": "https://secure.findhotel.net/checkout/?hotelId=1041597...",
1322
+ "method": "GET",
1323
+ "type": "checkout"
1324
+ }
1325
+ ],
1326
+ "prices": [
1327
+ {
1328
+ "chargeable": {
1329
+ "base": "575.6297833706",
1330
+ "taxes": "47.0969822758"
1331
+ },
1332
+ "currencyCode": "EUR",
1333
+ "hotelFees": {
1334
+ "breakdown": [],
1335
+ "total": "74.8318718382"
1336
+ },
1337
+ "rate": {
1338
+ "base": 575.6297833706,
1339
+ "taxes": 47.0969822758,
1340
+ "hotelFees": 74.8318718382
1341
+ },
1342
+ "type": "chargeable_currency"
1343
+ }
1344
+ ],
1345
+ "services": [],
1346
+ "providerCode": "DDT",
1347
+ "tags": ["top_offer", "exclusive_cheapest_offer"],
1348
+ "metadata": {
1349
+ "providerRateType": "plus",
1350
+ "feedID": ""
1351
+ },
1352
+ "offerType": "regular",
1353
+ "itineraries": null,
1354
+ "totalRate": {
1355
+ "base": 0,
1356
+ "taxes": 0,
1357
+ "hotelFees": 0
1358
+ }
1363
1359
  }
1364
- ]
1360
+ ],
1361
+ "hasClickedOffer": false
1362
+ }
1363
+ ]
1364
+ }
1365
+ ```
1366
+
1367
+ ### Long polling with `rooms()` method
1368
+
1369
+ <a id="rooms-long-polling"></a>
1370
+
1371
+ The `rooms()` method supports both synchronous requests and long-polling.
1372
+ To enable long-polling, simply provide callbacks as the second argument of the `rooms()` method:
1373
+
1374
+ ```js
1375
+ const parameters = {
1376
+ hotelId: "1714808",
1377
+ checkIn: "2021-10-10",
1378
+ checkOut: "2021-10-11",
1379
+ rooms: "2",
1380
+ };
1381
+
1382
+ const callbacks = {
1383
+ onStart(response) {
1384
+ log("Rooms Offers Poll Started", response);
1385
+ },
1386
+ onOffersReceived(response) {
1387
+ log("Rooms Offers Poll Received", response);
1388
+ },
1389
+ onComplete(response) {
1390
+ log("Rooms Offers Poll Completed", response);
1391
+ },
1392
+ };
1393
+
1394
+ const rooms = await sapiClient.rooms(parameters, callbacks);
1395
+ ```
1396
+
1397
+ The response follows the same structure as a standard room offers request, with the addition of a status parameter that indicates the progress of the long-polling
1398
+
1399
+ ```json
1400
+ {
1401
+ "anonymousId": "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
1402
+ "hotelId": "1041597",
1403
+ "searchId": "9248cf1d-1fdd-4aa5-af6d-2ec6e6671009",
1404
+ "rooms": [...],
1405
+ "splitBooking": {...},
1406
+ "status": {
1407
+ "complete": true
1408
+ }
1365
1409
  }
1366
1410
  ```
1367
1411