@findhotel/sapi 1.1.4 → 1.1.5
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
|
@@ -38,10 +38,11 @@ hotels, hotels\' offers and rooms.
|
|
|
38
38
|
- [Response](#response-4)
|
|
39
39
|
- [`offers()` method](#offers-method)
|
|
40
40
|
- [Offers parameters](#offers-parameters)
|
|
41
|
-
- [Callbacks](#callbacks-1)
|
|
42
41
|
- [Response](#response-5)
|
|
43
42
|
- [Rooms configuration](#rooms-configuration)
|
|
44
43
|
- [Examples](#examples)
|
|
44
|
+
- [How to generate `searchId`?](#how-to-generate-searchid)
|
|
45
|
+
- [Example](#example)
|
|
45
46
|
|
|
46
47
|
# Release process
|
|
47
48
|
|
|
@@ -339,7 +340,7 @@ const search = await sapiClient.search(searchParameters, callbacks)
|
|
|
339
340
|
All parameters are optional.
|
|
340
341
|
|
|
341
342
|
| name | type | description | example |
|
|
342
|
-
|
|
343
|
+
| --------------- | ------------------------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
|
|
343
344
|
| `hotelId` | `string` | Hotel Id for hotel search. If present, takes precedence over `placeId`, `query` and `geolocation`. | `1371626` |
|
|
344
345
|
| `placeId` | `string` | Place Id for place search. If present, takes precedence over `query` and `geolocation`. | `47319` |
|
|
345
346
|
| `geolocation` | `{lat: number, lon: number}` | Geolocation query. If present, takes precedence over `query` | `{lat: 36.114303, lon: -115.178312}` |
|
|
@@ -694,7 +695,7 @@ const rooms = await sapiClient.rooms({
|
|
|
694
695
|
"type": "checkout"
|
|
695
696
|
}],
|
|
696
697
|
"prices": [{
|
|
697
|
-
"chargeable": {"base": "1352.77", "taxes": "59.94"
|
|
698
|
+
"chargeable": {"base": "1352.77", "taxes": "59.94"},
|
|
698
699
|
"currencyCode": "EUR",
|
|
699
700
|
"hotelFees": {"breakdown": [], "total": "0"},
|
|
700
701
|
"type": "chargeable_currency"
|
|
@@ -850,7 +851,7 @@ const offers = await sapiClient.offers(parameters, callbacks)
|
|
|
850
851
|
<a id="hotel-parameters"></a>
|
|
851
852
|
|
|
852
853
|
| name | type | description | required | example |
|
|
853
|
-
|
|
854
|
+
| ------------------ | ------------------------ | -------------------------------------------------------------------------------- | -------- | ------------------------------------------ |
|
|
854
855
|
| `hotelId` | `string` | Hotel Id | yes | `1196472` |
|
|
855
856
|
| `checkIn` | `string` | Check in date (YYYY-MM-DD) (SDK generates default date if no provided) | no | `2022-10-10` |
|
|
856
857
|
| `checkOut` | `string` | Check out date (YYYY-MM-DD)) (SDK generates default date if no provided) | no | `2022-10-11` |
|
|
@@ -926,3 +927,25 @@ The response with the detailed description can be found in the [Offers Response]
|
|
|
926
927
|
- `3` → One room with three adults and no children
|
|
927
928
|
- `2:4` → One room with two adults and one child aged four
|
|
928
929
|
- `1:0,13,16` → One room with one adult and three children (aged zero, thirteen and sixteen)
|
|
930
|
+
|
|
931
|
+
## How to generate `searchId`?
|
|
932
|
+
|
|
933
|
+
Every search should have a `searchId` - a random unique string used for tracking purposes. SAPI SDK automatically generates a unique `searchId` each time clients call `search()`, `rooms()` or `offers()` methods. Sometimes it might be useful to preserve the `searchId` between multiple actions. For this case all mentioned methods accept `searchId` as a parameter and use it instead of internally generated one.
|
|
934
|
+
|
|
935
|
+
SAPI SDK exposes a special method `generateSearchId` to generate `searchId` which then can be used in the clients app.
|
|
936
|
+
|
|
937
|
+
#### Example
|
|
938
|
+
|
|
939
|
+
```js
|
|
940
|
+
import {generateSearchId} from '@findhotel/sapi'
|
|
941
|
+
|
|
942
|
+
const searchId = generateSearchId()
|
|
943
|
+
|
|
944
|
+
const rooms = await sapiClient.rooms({
|
|
945
|
+
hotelId: '47319',
|
|
946
|
+
checkIn: '2023-10-10',
|
|
947
|
+
checkOut: '2023-10-11',
|
|
948
|
+
rooms: '2',
|
|
949
|
+
searchId
|
|
950
|
+
})
|
|
951
|
+
```
|