@findhotel/sapi 1.25.8 → 1.26.1

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.
@@ -9,6 +9,8 @@ export interface AppConfig {
9
9
  offersPoll: string;
10
10
  roomsOffers: string;
11
11
  roomsOffersV2: string;
12
+ roomsOffersPoll: string;
13
+ roomsOffersPollV2: string;
12
14
  addressSuggest: string;
13
15
  autocompleteSuggest: string;
14
16
  freeTextSuggest: string;
@@ -1,42 +1,29 @@
1
1
  import { type RoomsRequestParameters, type RoomsResults, type Options as ClientOptions, type RoomsResultsV2 } from './types';
2
- import { type AppConfig, type ProfileKey } from './app-config';
3
- export declare type RoomsHandler = (parameters: RoomsRequestParameters) => Promise<RoomsResults>;
4
- export declare type RoomsHandlerV2 = (parameters: RoomsRequestParameters) => Promise<RoomsResultsV2>;
2
+ import { type AppConfig } from './app-config';
3
+ interface Callbacks {
4
+ onStart?: (parameters: RoomsRequestParameters) => void;
5
+ onOffersReceived?: (response: RoomsResults | RoomsResultsV2) => void;
6
+ onComplete?: (response: RoomsResults | RoomsResultsV2) => void;
7
+ }
8
+ export declare type RoomsHandler = (parameters: RoomsRequestParameters, callbacks?: Callbacks) => Promise<RoomsResults>;
9
+ export declare type RoomsHandlerV2 = (parameters: RoomsRequestParameters, callbacks?: Callbacks) => Promise<RoomsResultsV2>;
5
10
  /**
6
11
  * Creates rooms request string.
7
12
  *
8
13
  * @param parameters - Rooms request parameters - dynamic parameters that change search
9
14
  * @param options - Rooms request options - persistent within single SAPI instance
15
+ * @param sessionId - Long polling session id
10
16
  *
11
17
  * @returns request string
12
- *
13
- * @example
14
- * ```
15
- * const parameters = {
16
- * hotelId: '12345',
17
- * checkIn: '2021-06-16',
18
- * checkOut: '2021-06-17',
19
- * rooms: '2|2',
20
- * }
21
- *
22
- * const options = {
23
- * deviceType: 'mobile',
24
- * language: 'en',
25
- * currency: 'EUR',
26
- * anonymousId: 'abcde',
27
- * }
28
- *
29
- * createRequestString(parameters, options)
30
- * // hotelId=12345&checkIn='2021-06-16'&...
31
- * ```
32
- *
33
18
  */
34
- export declare function createRequestString(profileKey: ProfileKey, parameters: RoomsRequestParameters, options: ClientOptions): string;
19
+ export declare function createRequestString(parameters: RoomsRequestParameters, options: ClientOptions, sessionId?: string): string;
35
20
  export interface Parameters {
36
21
  appConfig: AppConfig;
37
- profileKey: ProfileKey;
38
22
  options: ClientOptions;
39
23
  }
24
+ interface RequestParameters extends RoomsRequestParameters {
25
+ searchId: string;
26
+ }
40
27
  /**
41
28
  * Creates rooms search function with bind base configuration object
42
29
  *
@@ -44,7 +31,7 @@ export interface Parameters {
44
31
  *
45
32
  * @returns rooms search function
46
33
  */
47
- export declare function rooms({ appConfig, profileKey, options, }: Parameters): RoomsHandler;
34
+ export declare function rooms({ appConfig, options }: Parameters): RoomsHandler;
48
35
  /**
49
36
  * Creates rooms search (using v2 version of rooms endpoint) function with bind base configuration object
50
37
  *
@@ -52,4 +39,10 @@ export declare function rooms({ appConfig, profileKey, options, }: Parameters):
52
39
  *
53
40
  * @returns rooms search function
54
41
  */
55
- export declare function roomsV2({ appConfig, profileKey, options, }: Parameters): RoomsHandlerV2;
42
+ export declare function roomsV2({ appConfig, options }: Parameters): RoomsHandlerV2;
43
+ export interface RoomsClient {
44
+ getRoomsOffers: (parameters: RequestParameters, apiVersion: number) => Promise<RoomsResults | RoomsResultsV2>;
45
+ getRoomsOffersAsync: (parameters: RequestParameters, apiVersion: number, onOffersReceived?: (response: RoomsResults | RoomsResultsV2) => void) => Promise<RoomsResults | RoomsResultsV2>;
46
+ }
47
+ export declare function roomsClient({ appConfig, options }: Parameters): RoomsClient;
48
+ export {};
@@ -153,10 +153,16 @@ export interface RoomsResults {
153
153
  searchId: string;
154
154
  anonymousId: AnonymousId;
155
155
  splitBooking?: RoomsSplitBooking;
156
+ status?: {
157
+ complete: boolean;
158
+ };
156
159
  }
157
160
  export interface RoomsResultsV2 {
158
161
  hotelId: HotelId;
159
162
  entities: Entity[];
160
163
  searchId: string;
161
164
  anonymousId: AnonymousId;
165
+ status?: {
166
+ complete: boolean;
167
+ };
162
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@findhotel/sapi",
3
- "version": "1.25.8",
3
+ "version": "1.26.1",
4
4
  "description": "FindHotel Search API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/types/packages/core/src",