@findhotel/sapi 0.24.1 → 0.24.4

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
@@ -14,20 +14,21 @@
14
14
  1. [SAPI client](#sapi-client)
15
15
  1. [Supported options](#client-options)
16
16
  2. [Available client callbacks](#client-callbacks)
17
- 2. [`search()` method](#search-method)
17
+ 2. [Response](#config-response)
18
+ 3. [`search()` method](#search-method)
18
19
  1. [Search parameters](#search-parameters)
19
20
  2. [Callbacks](#search-callbacks)
20
21
  3. [Response](#search-response)
21
- 3. [`suggest()` method](#suggest-method)
22
+ 4. [`suggest()` method](#suggest-method)
22
23
  1. [Suggest parameters](#suggest-parameters)
23
24
  2. [Response](#suggest-response)
24
- 4. [`rooms()` method](#rooms-method)
25
+ 5. [`rooms()` method](#rooms-method)
25
26
  1. [Rooms parameters](#rooms-parameters)
26
27
  2. [Response](#rooms-response)
27
- 5. [`hotel()` method](#hotel-method)
28
+ 6. [`hotel()` method](#hotel-method)
28
29
  1. [Hotel parameters](#hotel-parameters)
29
30
  2. [Response](#hotel-response)
30
- 6. [`offers()` method](#offers-method)
31
+ 7. [`offers()` method](#offers-method)
31
32
  1. [Offers parameters](#hotel-parameters)
32
33
  2. [Callbacks](#offers-callbacks)
33
34
  3. [Response](#offers-response)
@@ -386,7 +387,36 @@ Create SAPI client:
386
387
 
387
388
  1. onConfigReceived(configs)
388
389
 
389
- Returns configuration settings that are in use by sapiClient when received from remote endpoint.
390
+ Returns configuration settings that are used by sapiClient.
391
+
392
+
393
+ <a id="config-response"></a>
394
+
395
+ ## Response
396
+
397
+ {
398
+ "exchangeRates": {
399
+ "EUR": 0.982994
400
+ },
401
+ "lov": [
402
+ {
403
+ "id": 9,
404
+ "categoryID": 19,
405
+ "objectID": "Facility:9",
406
+ "value": {
407
+ "en": "Airport shuttle"
408
+ }
409
+ },
410
+ {
411
+ "categoryID": 2,
412
+ "id": 7,
413
+ "objectID": "Facility:7",
414
+ "value": {
415
+ "en": "Swimming pool"
416
+ }
417
+ }
418
+ ]
419
+ }
390
420
 
391
421
 
392
422
  <a id="search-method"></a>
@@ -539,6 +569,14 @@ All parameters are optional.
539
569
  </tr>
540
570
 
541
571
 
572
+ <tr>
573
+ <td class="org-left">`tier`</td>
574
+ <td class="org-left">`string`</td>
575
+ <td class="org-left">User tier</td>
576
+ <td class="org-left">`member`</td>
577
+ </tr>
578
+
579
+
542
580
  <tr>
543
581
  <td class="org-left">`originId`</td>
544
582
  <td class="org-left">`string`</td>
@@ -589,6 +627,10 @@ Search method receives callbacks object as the second argument:
589
627
  }
590
628
  }
591
629
 
630
+ Each callback returns the full search state available inside SAPI at the time of callbacks executions.
631
+ This means that each subsequent callback incrementally adds new properties and returns updated state.
632
+ The data in the state can be repeated between different callbacks.
633
+
592
634
  1. onStart()
593
635
 
594
636
  Runs at the beginning of the each new search.
@@ -602,30 +644,156 @@ Search method receives callbacks object as the second argument:
602
644
 
603
645
  2. onAnchorReceived()
604
646
 
605
- Runs when SAPI receives anchor (and?) anchor hotel
606
- `response` - *in progress&#x2026;*
647
+ Runs when SAPI receives anchor and(?) anchor hotel (in case of hotel search)
648
+
649
+ Returns static data about anchor `response.anchor`
650
+ and(?) anchor hotel inside `response.hotelEntities` object (in case of hotel search).
607
651
 
608
652
  3. onHotelsReceived()
609
653
 
610
654
  Runs when SAPI receives static search results
611
- `response` - *in progress&#x2026;*
655
+
656
+ Returns static data about hotels inside `response.hotelEntities` object
657
+ as well as appropriate hotel sort order in `response.hotelIds` array (sorted according HSO).
612
658
 
613
659
  4. onOffersReceived()
614
660
 
615
661
  Runs when SAPI receives a bunch of offers
616
- `response` - *in progress&#x2026;*
662
+
663
+ Returns hotel’s offers (incomplete response) in `response.hotelOfferEntities` object
664
+ as well as updated hotel sort order in `response.hotelIds` array (sorted according HSO and taking into account the real offers data)
617
665
 
618
666
  5. onComplete()
619
667
 
620
668
  Runs when current search is complete and all offers are retrieved
621
- `response` - *in progress&#x2026;*
669
+
670
+ Return complete SAPI seearch response.
622
671
 
623
672
 
624
673
  <a id="search-response"></a>
625
674
 
626
675
  ### Response
627
676
 
628
- *in progress&#x2026;*
677
+ The complete SAPI search response is too big to be displayed on the page so there is a simplified example:
678
+
679
+ {
680
+ "anchor": {
681
+ "admDivisionLevel1": "The Netherlands",
682
+ "admDivisionLevel2": "Amsterdam",
683
+ "admDivisionLevel3": "Bedrijventerrein Sloterdijk",
684
+ "hotelName": "Holiday Inn Express Amsterdam - Sloterdijk Station, an IHG Hotel",
685
+ "objectID": "hotel:1714808",
686
+ "objectType": "hotel",
687
+ "pageSize": 26,
688
+ "placeDisplayName": "Bedrijventerrein Sloterdijk, Amsterdam",
689
+ "priceBucketWidth": 19,
690
+ "_geoloc": {"lat": 52.388326, "lon": 4.837264, "precision": 5000, "radius": 20000}
691
+ },
692
+ "anchorHotelId": "1714808",
693
+ "anchorType": "hotel",
694
+ "dealScores": {"1041597": 0.06, "1041618": 0.37, "1041632": 0.75},
695
+ "facets": {
696
+ "facilities": {"1": 212, "2": 348, "3": 116},
697
+ "pricing.medianRateBkt": {"3": 4, "4": 12, "5": 19},
698
+ "pricing.medianRateMoFrBkt": {"3": 4, "4": 6, "5": 8, "6": 9},
699
+ "pricing.medianRateSaSuBkt": {"2": 2, "3": 4, "4": 6, "5": 10},
700
+ "pricing.minRateBkt": {"2": 22, "3": 38, "4": 46, "5": 98},
701
+ "propertyTypeId": {"0": 1030, "2": 6, "3": 601, "4": 86},
702
+ "starRating": {"1": 351, "2": 313, "3": 596, "4": 441, "5": 86},
703
+ "themeIds": {"1": 9, "2": 1373, "3": 143, "5": 1092, "8": 119},
704
+ },
705
+ "hotelEntities": {
706
+ "1041597": {
707
+ "chainID": "351",
708
+ "checkInTime": "15:00",
709
+ "checkOutTime": "12:00",
710
+ "country": "NL",
711
+ "displayAddress": "Stationsplein 49, Burgwallen-Nieuwe Zijde, Amsterdam, The Netherlands",
712
+ "facilities": [1, 2, 5, 8, 9, 11],
713
+ "guestRating": {"cleanliness": 7.94, "dining": 7.51, "facilities": 7.54, "location": 8.09, "overall": 7.83, "service": 8.8},
714
+ "guestType": {"business": 793, "couples": 2558, "families": 1145, "groups": 1276, "solo": 398},
715
+ "hotelName": "ibis Amsterdam Centre",
716
+ "imageURIs": ["https://i.travelapi.com/hotels/1000000/30000/25600/25525/c2387aed_w.jpg"],
717
+ "isDeleted": false,
718
+ "lastBooked": 1658320362,
719
+ "objectID": "1041597",
720
+ "parentChainID": "10",
721
+ "placeDisplayName": "Burgwallen-Nieuwe Zijde, Amsterdam",
722
+ "pricing": {"medianRateBkt": 12, "medianRateMoFrBkt": 13, "medianRateSaSuBkt": 11, "minRate": 116, "minRateBkt": 75, "minRateBkt": 5, "priced": 1},
723
+ "propertyTypeId": 0,
724
+ "regularPriceRange": [224, 243],
725
+ "reviewCount": 5766,
726
+ "sentiments": [177, 250, 300, 419],
727
+ "starRating": 3,
728
+ "tags": ["b220918-1"],
729
+ "themeIds": [2, 5, 12],
730
+ "_geoloc": {"lat": 52.37947, "lon": 4.89699}
731
+ }
732
+ },
733
+ "hotelIds": ["1840170", "2766940", "3310443", "3035769"],
734
+ "hotelOfferEntities": {
735
+ "1041597": {
736
+ "anchorPriceRateBreakdown": {
737
+ "baseRate": 244.6021305,
738
+ "calculatedTotalRate": 288.13897963499994,
739
+ "localTaxes": 23.122149135,
740
+ "nightlyRate": 288.13897963499994,
741
+ "taxes": 20.4147
742
+ },
743
+ "availableOffersCount": 23,
744
+ "fetchedAllOffers": false,
745
+ "hasMoreOffers": true,
746
+ "id": "1041597",
747
+ "offers": [
748
+ {
749
+ "additionalProviderParams": {
750
+ "feedId": "1524856"
751
+ },
752
+ "availableRooms": 10,
753
+ "bookURI": "https://r.findhotel.net?...",
754
+ "calculatedTotalRate": 110.72,
755
+ "canPayLater": true,
756
+ "cug": null,
757
+ "currency": "EUR",
758
+ "hasAnchorPrice": true,
759
+ "hasFreeCancellation": true,
760
+ "id": "oO8jdRHaO8y0",
761
+ "isAnchorPriceOffer": false,
762
+ "isCheapest": false,
763
+ "isTopOffer": true,
764
+ "meals": ["breakfast"],
765
+ "nightlyRate": 110.72,
766
+ "providerCode": "BKS",
767
+ "proxyProviderCode": "BKS",
768
+ "rateBreakdown": {
769
+ "baseRate": 90.28,
770
+ "localTaxes": 12.32,
771
+ "taxes": 8.12
772
+ },
773
+ "roomID": "moc_08Ap8BcbIDg",
774
+ "roomName": "Standard Double Room",
775
+ "tags": ["top_offer"]
776
+ }
777
+ ],
778
+ "topOfferData": {
779
+ "anchorPrice": 288.13897963499994,
780
+ "anchorPriceNightly": 288.13897963499994,
781
+ "offerIndexes": [0, 1, 2, 3]
782
+ }
783
+ }
784
+ },
785
+ "hotelsHaveStaticPosition": true,
786
+ "offset": 0,
787
+ "resultsCount": 26,
788
+ "resultsCountTotal": 3401,
789
+ "searchId": "0f9642a0-eab7-4acb-8313-bc6d19c408f6",
790
+ "searchParameters": {
791
+ "hotelId": "1714808",
792
+ "checkIn": "2022-09-01",
793
+ "checkOut": "2022-09-02",
794
+ "rooms": "2"
795
+ }
796
+ }
629
797
 
630
798
 
631
799
  <a id="suggest-method"></a>
@@ -741,7 +909,7 @@ Rooms is a method of **sapiClient** for retrieving rooms information and
741
909
  offers for a particular itinerary:
742
910
 
743
911
  const rooms = await sapiClient.rooms({
744
- hotelId: '47319',
912
+ hotelId: '1714808',
745
913
  checkIn: '2021-10-10',
746
914
  checkOut: '2021-10-11',
747
915
  rooms: '2'
@@ -782,7 +950,7 @@ offers for a particular itinerary:
782
950
  <td class="org-left">`string`</td>
783
951
  <td class="org-left">Hotel Id to retrieve rooms</td>
784
952
  <td class="org-left">yes</td>
785
- <td class="org-left">`1371626`</td>
953
+ <td class="org-left">`1714808`</td>
786
954
  </tr>
787
955
 
788
956
 
@@ -831,6 +999,15 @@ offers for a particular itinerary:
831
999
  </tr>
832
1000
 
833
1001
 
1002
+ <tr>
1003
+ <td class="org-left">`tier`</td>
1004
+ <td class="org-left">`string`</td>
1005
+ <td class="org-left">User tier</td>
1006
+ <td class="org-left">no</td>
1007
+ <td class="org-left">`plus`</td>
1008
+ </tr>
1009
+
1010
+
834
1011
  <tr>
835
1012
  <td class="org-left">`clickedOfferId`</td>
836
1013
  <td class="org-left">`string`</td>
@@ -846,10 +1023,45 @@ offers for a particular itinerary:
846
1023
 
847
1024
  ### Response
848
1025
 
849
- *in progress&#x2026;*
850
-
851
- SAPI `rooms()` method will have the similar response body as BoFH API
852
- `/rooms` endpoint. For now please refer to [BoFH documentation](https://github.com/FindHotel/bofh-api/blob/master/docs/consumers/default/endpoints/rooms.md#example-1).
1026
+ {
1027
+ "anonymousId": "fd9dbb5f-b337-4dd7-b640-1f177d1d3caa",
1028
+ "hotelId": "1714808",
1029
+ "rooms": [
1030
+ {
1031
+ "amenities": ["Non-Smoking Facility"],
1032
+ "bedTypes": [],
1033
+ "description": "20 sqm room Continental breakfast included Free WiFi LCD TV Spacious work desk Choice of pillows Coffee and tea facilities Large walk-in power shower",
1034
+ "id": "K0LnAe-G9WI",
1035
+ "images": [{"url": "http://images.getaroom-cdn.com/image/....}],
1036
+ "masterId": "9643931",
1037
+ "name": "1 Double Standard",
1038
+ "offers": [
1039
+ {
1040
+ "availableRooms": 0,
1041
+ "canPayLater": false,
1042
+ "cancellationPenalties": [],
1043
+ "cug": ["signed_in"],
1044
+ "id": "o0KDe_mFPN4k",
1045
+ "links": [{
1046
+ "href": "https://secure.findhotel.net/checkout/?hotelID=1714808...",
1047
+ "method": "GET",
1048
+ "type": "checkout"
1049
+ }],
1050
+ "prices": [{
1051
+ "chargeable": {"base": "1352.77", "taxes": "59.94", "total": "1412.71"},
1052
+ "currencyCode": "EUR",
1053
+ "hotelFees": {"breakdown": [], "total": "0"},
1054
+ "type": "chargeable_currency"
1055
+ }],
1056
+ "providerCode": "GAR",
1057
+ "providerRateType": "public",
1058
+ "refundable": false,
1059
+ "services": ["breakfast"]
1060
+ }
1061
+ ]
1062
+ }
1063
+ ]
1064
+ }
853
1065
 
854
1066
 
855
1067
  <a id="hotel-method"></a>
@@ -1103,6 +1315,15 @@ Retrieves offers for a single hotel by provided parameters
1103
1315
  </tr>
1104
1316
 
1105
1317
 
1318
+ <tr>
1319
+ <td class="org-left">`tier`</td>
1320
+ <td class="org-left">`string`</td>
1321
+ <td class="org-left">User tier</td>
1322
+ <td class="org-left">no</td>
1323
+ <td class="org-left">`member`</td>
1324
+ </tr>
1325
+
1326
+
1106
1327
  <tr>
1107
1328
  <td class="org-left">`freeCancellation`</td>
1108
1329
  <td class="org-left">`boolean`</td>