@gojinko/api-client 1.2.1 → 2.0.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 +62 -42
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/tools.d.ts +42 -40
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +25 -35
- package/dist/tools.js.map +1 -1
- package/dist/types/devplatform.d.ts +87 -528
- package/dist/types/devplatform.d.ts.map +1 -1
- package/dist/types/devplatform.js +16 -10
- package/dist/types/devplatform.js.map +1 -1
- package/dist/types/generated.d.ts +1170 -6180
- package/dist/types/generated.d.ts.map +1 -1
- package/package.json +3 -2
- package/public-api.yaml +2378 -0
package/README.md
CHANGED
|
@@ -32,36 +32,50 @@ OAuth tokens auto-refresh when they expire.
|
|
|
32
32
|
|
|
33
33
|
## Methods
|
|
34
34
|
|
|
35
|
+
The client targets the **jinko-api public surface** (`https://api.gojinko.com`,
|
|
36
|
+
canonical `/v1/*` routes). Authenticate with a `jnk_` API key (`X-API-Key`).
|
|
37
|
+
|
|
35
38
|
### Discovery (cached)
|
|
36
39
|
|
|
37
|
-
| Method |
|
|
40
|
+
| Method | Endpoint |
|
|
38
41
|
|---|---|
|
|
39
|
-
| `client.findFlight()` | `POST /
|
|
40
|
-
| `client.
|
|
41
|
-
| `client.
|
|
42
|
+
| `client.findFlight()` | `POST /v1/flight_calendar` |
|
|
43
|
+
| `client.flightCalendar()` | `POST /v1/flight_calendar` |
|
|
44
|
+
| `client.findDestination()` | `POST /v1/find_destination` |
|
|
42
45
|
|
|
43
46
|
### Live search & trip building
|
|
44
47
|
|
|
45
|
-
| Method |
|
|
48
|
+
| Method | Endpoint |
|
|
46
49
|
|---|---|
|
|
47
|
-
| `client.flightSearch()` | `POST /
|
|
48
|
-
| `client.hotelSearch()` | `POST /
|
|
49
|
-
| `client.
|
|
50
|
+
| `client.flightSearch()` | `POST /v1/flight_search` |
|
|
51
|
+
| `client.hotelSearch()` | `POST /v1/hotel_search` |
|
|
52
|
+
| `client.hotelDetails()` | `GET /v1/hotel_details/{hotel_id}` |
|
|
53
|
+
| `client.trip()` | `POST /v1/trip` |
|
|
54
|
+
| `client.getTrip(tripId)` | `GET /v1/trip/{trip_id}` |
|
|
50
55
|
|
|
51
56
|
### Checkout
|
|
52
57
|
|
|
53
|
-
| Method |
|
|
58
|
+
| Method | Endpoint |
|
|
54
59
|
|---|---|
|
|
55
|
-
| `client.book(tripId)` | `POST /
|
|
56
|
-
| `client.selectAncillaries()` | `POST /
|
|
57
|
-
| `client.getTrip(tripId)` | `GET /api/v1/shop/sync/{id}` |
|
|
60
|
+
| `client.book(tripId)` | `POST /v1/book` |
|
|
61
|
+
| `client.selectAncillaries()` | `POST /v1/select_ancillaries` |
|
|
58
62
|
|
|
59
63
|
### Post-booking
|
|
60
64
|
|
|
61
|
-
| Method |
|
|
65
|
+
| Method | Endpoint |
|
|
62
66
|
|---|---|
|
|
63
|
-
| `client.
|
|
64
|
-
| `client.
|
|
67
|
+
| `client.getBooking()` | `POST /v1/get_booking` |
|
|
68
|
+
| `client.refundCheck()` | `POST /v1/refund_check` |
|
|
69
|
+
| `client.refundCommit()` | `POST /v1/refund_commit` |
|
|
70
|
+
| `client.refundStatus()` | `POST /v1/refund_status` |
|
|
71
|
+
| `client.exchangeShop()` | `POST /v1/exchange_shop` |
|
|
72
|
+
| `client.exchangePrice()` | `POST /v1/exchange_price` |
|
|
73
|
+
| `client.exchangeCommit()` | `POST /v1/exchange_commit` |
|
|
74
|
+
| `client.exchangeStatus()` | `POST /v1/exchange_status` |
|
|
75
|
+
| `client.hotelCancelBooking()` | `POST /v1/hotel_cancel` |
|
|
76
|
+
|
|
77
|
+
> `get_booking` returns the **whole** booking (flight + hotel). There is no
|
|
78
|
+
> separate hotel-retrieve method on the public surface.
|
|
65
79
|
|
|
66
80
|
## Usage
|
|
67
81
|
|
|
@@ -70,19 +84,19 @@ OAuth tokens auto-refresh when they expire.
|
|
|
70
84
|
Preferred flight entry point. Returns a bookable `trip_item_token` in one step.
|
|
71
85
|
|
|
72
86
|
```typescript
|
|
73
|
-
// Search mode
|
|
87
|
+
// Search mode — canonical flat body (adults at top level)
|
|
74
88
|
const results = await client.flightSearch({
|
|
75
89
|
origin: 'PAR',
|
|
76
90
|
destination: 'NYC',
|
|
77
91
|
departure_date: '2026-06-15',
|
|
78
92
|
trip_type: 'oneway',
|
|
79
|
-
|
|
93
|
+
adults: 1,
|
|
80
94
|
});
|
|
81
95
|
|
|
82
96
|
// Price-check mode (returns trip_item_token)
|
|
83
97
|
const fares = await client.flightSearch({
|
|
84
98
|
offer_token: 'tok_abc123',
|
|
85
|
-
|
|
99
|
+
adults: 1,
|
|
86
100
|
});
|
|
87
101
|
```
|
|
88
102
|
|
|
@@ -123,14 +137,14 @@ const trip = await client.trip({
|
|
|
123
137
|
// → { trip_id, ... }
|
|
124
138
|
```
|
|
125
139
|
|
|
126
|
-
###
|
|
140
|
+
### book — Schedule checkout
|
|
127
141
|
|
|
128
142
|
```typescript
|
|
129
|
-
const checkout = await client.
|
|
143
|
+
const checkout = await client.book('42');
|
|
130
144
|
// {
|
|
131
145
|
// session_id, checkout_url, expires_at, status,
|
|
132
146
|
// total_amount: { amount, currency },
|
|
133
|
-
// items: [
|
|
147
|
+
// items: [ ... ],
|
|
134
148
|
// }
|
|
135
149
|
|
|
136
150
|
// Send the user to checkout.checkout_url to complete payment.
|
|
@@ -167,9 +181,11 @@ Poll `getTrip()` until `status === 'fulfilled'` (or `'partially_fulfilled'`) to
|
|
|
167
181
|
|
|
168
182
|
### refundCheck / refundCommit
|
|
169
183
|
|
|
184
|
+
Two auth modes: guest (`booking_ref` + `last_name`) or authenticated (`order_id`).
|
|
185
|
+
|
|
170
186
|
```typescript
|
|
171
|
-
const eligibility = await client.refundCheck({
|
|
172
|
-
const refund = await client.refundCommit({
|
|
187
|
+
const eligibility = await client.refundCheck({ booking_ref: 'JNK-ABC123', last_name: 'Doe' });
|
|
188
|
+
const refund = await client.refundCommit({ booking_ref: 'JNK-ABC123', last_name: 'Doe' });
|
|
173
189
|
```
|
|
174
190
|
|
|
175
191
|
## Token Flow
|
|
@@ -179,12 +195,12 @@ findFlight / findDestination / flightCalendar → offer_token (cached, fl
|
|
|
179
195
|
flightSearch (offer_token) → trip_item_token (live, flights)
|
|
180
196
|
hotelSearch → htl_* offer_id (live, hotels)
|
|
181
197
|
trip (trip_item_token OR htl_* + travelers) → trip_id (multi-domain)
|
|
182
|
-
|
|
198
|
+
book (trip_id) → checkout_url + items + ancillaries
|
|
183
199
|
[user pays on checkout_url]
|
|
184
200
|
getTrip (trip_id) → bookings / PNRs
|
|
185
201
|
```
|
|
186
202
|
|
|
187
|
-
Quote is automatic — it's handled internally by `
|
|
203
|
+
Quote is automatic — it's handled internally by `book()`. You don't call it.
|
|
188
204
|
|
|
189
205
|
## Error Handling
|
|
190
206
|
|
|
@@ -205,36 +221,40 @@ try {
|
|
|
205
221
|
|
|
206
222
|
## Types
|
|
207
223
|
|
|
224
|
+
All request/response types are derived from the canonical `public-api.yaml`
|
|
225
|
+
contract (regenerated into `src/types/generated.ts`):
|
|
226
|
+
|
|
208
227
|
```typescript
|
|
209
228
|
import type {
|
|
210
|
-
|
|
211
|
-
|
|
229
|
+
FlightDiscoveryRequest,
|
|
230
|
+
FindDestinationRequest,
|
|
212
231
|
FlightSearchRequest,
|
|
232
|
+
HotelSearchRequest,
|
|
233
|
+
HotelDetailsRequest,
|
|
213
234
|
TripRequest,
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
QuoteSummary,
|
|
221
|
-
FulfillmentSummary,
|
|
222
|
-
BookingRef,
|
|
223
|
-
SelectAncillariesRequest,
|
|
235
|
+
BookRequest,
|
|
236
|
+
BookResponse,
|
|
237
|
+
GetTripResponse,
|
|
238
|
+
AncillaryRequest,
|
|
239
|
+
BookingGetRequest,
|
|
240
|
+
BookingGetResponse,
|
|
224
241
|
RefundCheckRequest,
|
|
225
242
|
RefundCommitRequest,
|
|
226
243
|
Traveler,
|
|
227
|
-
Contact,
|
|
228
244
|
Money,
|
|
229
245
|
} from '@gojinko/api-client';
|
|
230
246
|
```
|
|
231
247
|
|
|
248
|
+
The generated `paths` and `components` from the OpenAPI spec are also exported
|
|
249
|
+
for advanced use.
|
|
250
|
+
|
|
232
251
|
## Raw Client
|
|
233
252
|
|
|
234
|
-
The underlying openapi-fetch client is still accessible
|
|
253
|
+
The underlying openapi-fetch client is still accessible and is typed against the
|
|
254
|
+
jinko-api `/v1/*` surface:
|
|
235
255
|
|
|
236
256
|
```typescript
|
|
237
|
-
const response = await client.raw.POST('/
|
|
238
|
-
body: {
|
|
239
|
-
}
|
|
257
|
+
const response = await client.raw.POST('/v1/flight_search', {
|
|
258
|
+
body: { origin: 'JFK', destination: 'LAX', departure_date: '2026-09-01' },
|
|
259
|
+
});
|
|
240
260
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -5,5 +5,5 @@ export { loadOrCreateCliSession, clearCliSession, extractUserIdFromJwt, getSessi
|
|
|
5
5
|
export { ApiError, AuthError, ValidationError, type ApiErrorDetail } from './errors.js';
|
|
6
6
|
export { requestDeviceAuthorization, pollForToken, refreshAccessToken, isTokenExpired, OAuthError, OAuthRefreshError, resolveExpiresAt, type OAuthTokens, type DeviceAuthorization, } from './oauth.js';
|
|
7
7
|
export type { paths, components } from './types/generated.js';
|
|
8
|
-
export type {
|
|
8
|
+
export type { Money, Amount, DateRange, Itinerary, FlightDiscoveryRequest, FlightFindRequest, FlightCalendarResponse, FindDestinationRequest, FlightDestinationSearchRequest, DestinationSuggestion, FindDestinationResponse, FlightSearchRequest, FlightSearchResponse, FlightOffer, Fare, FlightLeg, PriceMonitoringRequest, PriceMonitoringResponse, HotelOccupancy, HotelSearchRequest, HotelSearchResponse, HotelDetailsRequest, HotelDetailsResponse, Traveler, TripRequest, TripResponse, BookRequest, BookResponse, CheckoutRequest, CheckoutResponse, GetTripResponse, TripStatusResponse, AncillaryRequest, AncillaryResponse, SelectAncillariesRequest, BookingGetRequest, BookingGetResponse, BookingLookupRequest, BookingLookupResponse, RefundCheckRequest, RefundCheckResponse, RefundCommitRequest, RefundCommitResponse, RefundStatusRequest, RefundStatusResponse, ExchangeShopRequest, ExchangeShopResponse, ExchangePriceRequest, ExchangePriceResponse, ExchangeCommitRequest, ExchangeCommitResponse, ExchangeStatusRequest, ExchangeStatusResponse, HotelCancelBookingRequest, HotelCancelBookingResponse, } from './types/devplatform.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3G,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,YAAY,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AACzK,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACjI,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,WAAW,EAChB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,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,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EAExB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -1,52 +1,56 @@
|
|
|
1
1
|
import type { JinkoRawClient } from './client.js';
|
|
2
|
-
import type { FlightFindRequest, FlightDestinationSearchRequest, FlightSearchRequest, HotelSearchRequest, HotelDetailsRequest, HotelDetailsResponse, TripRequest,
|
|
2
|
+
import type { FlightFindRequest, FlightDestinationSearchRequest, FlightSearchRequest, FlightSearchResponse, PriceMonitoringRequest, PriceMonitoringResponse, FlightCalendarResponse, FindDestinationResponse, HotelSearchRequest, HotelSearchResponse, HotelDetailsRequest, HotelDetailsResponse, TripRequest, TripResponse, BookResponse, GetTripResponse, AncillaryRequest, AncillaryResponse, BookingGetRequest, BookingGetResponse, RefundCheckRequest, RefundCheckResponse, RefundCommitRequest, RefundCommitResponse, RefundStatusRequest, RefundStatusResponse, ExchangeShopRequest, ExchangeShopResponse, ExchangePriceRequest, ExchangePriceResponse, ExchangeCommitRequest, ExchangeCommitResponse, ExchangeStatusRequest, ExchangeStatusResponse, HotelCancelBookingRequest, HotelCancelBookingResponse } from './types/devplatform.js';
|
|
3
3
|
/**
|
|
4
|
-
* Tool methods matching
|
|
4
|
+
* Tool methods matching the canonical jinko-api capability names.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* flight_calendar → flightCalendar()
|
|
10
|
-
* hotel_search → hotelSearch()
|
|
11
|
-
* hotel_details → hotelDetails()
|
|
12
|
-
* trip → trip()
|
|
13
|
-
* book → book()
|
|
14
|
-
* select_ancillaries → selectAncillaries()
|
|
15
|
-
* get_trip → getTrip()
|
|
16
|
-
* refund_check → refundCheck()
|
|
17
|
-
* refund_commit → refundCommit()
|
|
18
|
-
* refund_status → refundStatus()
|
|
19
|
-
* exchange_shop → exchangeShop()
|
|
20
|
-
* exchange_price → exchangePrice()
|
|
21
|
-
* exchange_commit → exchangeCommit()
|
|
22
|
-
* exchange_status → exchangeStatus()
|
|
6
|
+
* Wave 6 cutover (JIN-665): every method now targets the public `/v1/*`
|
|
7
|
+
* surface served by jinko-api (`api.gojinko.com`), not the BFF directly. The
|
|
8
|
+
* method NAMES are kept stable to avoid churning the CLI:
|
|
23
9
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* /
|
|
10
|
+
* find_destination → findDestination() POST /v1/find_destination
|
|
11
|
+
* flight_calendar → flightCalendar() POST /v1/flight_calendar
|
|
12
|
+
* find_flight → findFlight() POST /v1/flight_calendar (alias)
|
|
13
|
+
* flight_search → flightSearch() POST /v1/flight_search
|
|
14
|
+
* price_monitoring → priceMonitoring() POST /v1/price_monitoring
|
|
15
|
+
* hotel_search → hotelSearch() POST /v1/hotel_search
|
|
16
|
+
* hotel_details → hotelDetails() GET /v1/hotel_details/{hotel_id}
|
|
17
|
+
* trip → trip() POST /v1/trip
|
|
18
|
+
* get_trip → getTrip() GET /v1/trip/{trip_id}
|
|
19
|
+
* select_ancillaries → selectAncillaries() POST /v1/select_ancillaries
|
|
20
|
+
* book → book() POST /v1/book
|
|
21
|
+
* get_booking → getBooking() POST /v1/get_booking
|
|
22
|
+
* refund_check/_commit/_status → refundCheck/Commit/Status() POST /v1/refund_*
|
|
23
|
+
* exchange_shop/_price/_commit/_status → exchangeShop/Price/Commit/Status() POST /v1/exchange_*
|
|
24
|
+
* hotel_cancel → hotelCancelBooking() POST /v1/hotel_cancel
|
|
25
|
+
*
|
|
26
|
+
* `get_booking` returns the WHOLE booking (flight + hotel). The internal-only
|
|
27
|
+
* hotel-retrieve endpoint is no longer exposed — `hotelRetrieveBooking` was
|
|
28
|
+
* removed at the cutover.
|
|
27
29
|
*/
|
|
28
30
|
export interface JinkoTools {
|
|
29
|
-
/** find_flight — cached flight
|
|
30
|
-
readonly findFlight: (request: FlightFindRequest) => Promise<
|
|
31
|
+
/** find_flight — cached flight discovery (alias of flightCalendar). Returns itineraries. */
|
|
32
|
+
readonly findFlight: (request: FlightFindRequest) => Promise<FlightCalendarResponse>;
|
|
31
33
|
/** find_destination — discover destinations from origin airports (cached). */
|
|
32
|
-
readonly findDestination: (request: FlightDestinationSearchRequest) => Promise<
|
|
33
|
-
/** flight_search — live search or price-check a specific offer.
|
|
34
|
-
readonly flightSearch: (request: FlightSearchRequest) => Promise<
|
|
35
|
-
/**
|
|
36
|
-
readonly
|
|
37
|
-
/**
|
|
38
|
-
readonly
|
|
39
|
-
/**
|
|
34
|
+
readonly findDestination: (request: FlightDestinationSearchRequest) => Promise<FindDestinationResponse>;
|
|
35
|
+
/** flight_search — live search or price-check a specific offer. */
|
|
36
|
+
readonly flightSearch: (request: FlightSearchRequest) => Promise<FlightSearchResponse>;
|
|
37
|
+
/** price_monitoring — cache-only poll for the cheapest itinerary on a fixed route + dates. */
|
|
38
|
+
readonly priceMonitoring: (request: PriceMonitoringRequest) => Promise<PriceMonitoringResponse>;
|
|
39
|
+
/** flight_calendar — cheapest itineraries across a route + flexible dates (cached). */
|
|
40
|
+
readonly flightCalendar: (request: FlightFindRequest) => Promise<FlightCalendarResponse>;
|
|
41
|
+
/** hotel_search — live hotel search by destination, dates, occupancy. */
|
|
42
|
+
readonly hotelSearch: (request: HotelSearchRequest) => Promise<HotelSearchResponse>;
|
|
43
|
+
/** hotel_details — rich metadata (gallery, facilities, policies, per-room details). */
|
|
40
44
|
readonly hotelDetails: (request: HotelDetailsRequest) => Promise<HotelDetailsResponse>;
|
|
41
45
|
/** trip — create trip, add/remove items, set travelers. Returns trip_id. */
|
|
42
|
-
readonly trip: (request: TripRequest) => Promise<
|
|
43
|
-
/** book —
|
|
44
|
-
readonly book: (tripId: string) => Promise<
|
|
46
|
+
readonly trip: (request: TripRequest) => Promise<TripResponse>;
|
|
47
|
+
/** book — checkout a trip: returns checkout_url, items, total. */
|
|
48
|
+
readonly book: (tripId: string) => Promise<BookResponse>;
|
|
45
49
|
/** select_ancillaries — select baggage, seats, meals for a trip item. */
|
|
46
|
-
readonly selectAncillaries: (request:
|
|
50
|
+
readonly selectAncillaries: (request: AncillaryRequest) => Promise<AncillaryResponse>;
|
|
47
51
|
/** getTrip — full lifecycle state: cart, quote, fulfillment, bookings. */
|
|
48
|
-
readonly getTrip: (tripId: string) => Promise<
|
|
49
|
-
/** get_booking — retrieve
|
|
52
|
+
readonly getTrip: (tripId: string) => Promise<GetTripResponse>;
|
|
53
|
+
/** get_booking — retrieve the whole booking by Jinko reference + last name (guest access). */
|
|
50
54
|
readonly getBooking: (request: BookingGetRequest) => Promise<BookingGetResponse>;
|
|
51
55
|
/**
|
|
52
56
|
* @deprecated Renamed to {@link getBooking} by JIN-663. Delegates to `getBooking`.
|
|
@@ -67,8 +71,6 @@ export interface JinkoTools {
|
|
|
67
71
|
readonly exchangeCommit: (request: ExchangeCommitRequest) => Promise<ExchangeCommitResponse>;
|
|
68
72
|
/** exchange_status — poll the status of an in-flight exchange. */
|
|
69
73
|
readonly exchangeStatus: (request: ExchangeStatusRequest) => Promise<ExchangeStatusResponse>;
|
|
70
|
-
/** hotel_lookup_booking — guest-access hotel booking retrieval (status, stay details, cancellation policy). */
|
|
71
|
-
readonly hotelRetrieveBooking: (request: HotelRetrieveBookingRequest) => Promise<HotelRetrieveBookingResponse>;
|
|
72
74
|
/** hotel_cancel — cancel a hotel booking (idempotent: second call re-serves stored result). */
|
|
73
75
|
readonly hotelCancelBooking: (request: HotelCancelBookingRequest) => Promise<HotelCancelBookingResponse>;
|
|
74
76
|
}
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,8BAA8B,EAC9B,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,iBAAiB,EACjB,8BAA8B,EAC9B,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,yBAAyB,EACzB,0BAA0B,EAC3B,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,UAAU;IACzB,4FAA4F;IAC5F,QAAQ,CAAC,UAAU,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,sBAAsB,CAAC,CAAC;IAErF,8EAA8E;IAC9E,QAAQ,CAAC,eAAe,EAAE,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light: async (request) => (await post('/v1/flight_calendar', request)),
|
|
8
|
+
flightCalendar: async (request) => (await post('/v1/flight_calendar', request)),
|
|
9
|
+
findDestination: async (request) => (await post('/v1/find_destination', request)),
|
|
10
|
+
flightSearch: async (request) => (await post('/v1/flight_search', request)),
|
|
11
|
+
priceMonitoring: async (request) => (await post('/v1/price_monitoring', request)),
|
|
12
|
+
hotelSearch: async (request) => (await post('/v1/hotel_search', request)),
|
|
12
13
|
hotelDetails: async ({ hotel_id, checkin, checkout }) => {
|
|
13
14
|
const query = {};
|
|
14
15
|
if (checkin)
|
|
15
16
|
query['checkin'] = checkin;
|
|
16
17
|
if (checkout)
|
|
17
18
|
query['checkout'] = checkout;
|
|
18
|
-
const response = await raw.GET('/
|
|
19
|
+
const response = await raw.GET('/v1/hotel_details/{hotel_id}', {
|
|
19
20
|
params: {
|
|
20
|
-
path: {
|
|
21
|
+
path: { hotel_id },
|
|
21
22
|
...(Object.keys(query).length > 0 ? { query } : {}),
|
|
22
23
|
},
|
|
23
24
|
});
|
|
24
25
|
return response.data;
|
|
25
26
|
},
|
|
26
|
-
trip: (request) => post('/
|
|
27
|
-
book: async (tripId) => {
|
|
28
|
-
|
|
29
|
-
const data = await post('/api/v1/shop/sync/checkout', body);
|
|
30
|
-
return data;
|
|
31
|
-
},
|
|
32
|
-
selectAncillaries: (request) => post('/api/v1/shop/sync/ancillaries', request),
|
|
27
|
+
trip: async (request) => (await post('/v1/trip', request)),
|
|
28
|
+
book: async (tripId) => (await post('/v1/book', { trip_id: tripId })),
|
|
29
|
+
selectAncillaries: async (request) => (await post('/v1/select_ancillaries', request)),
|
|
33
30
|
getTrip: async (tripId) => {
|
|
34
|
-
const response = await raw.GET('/
|
|
35
|
-
params: { path: {
|
|
31
|
+
const response = await raw.GET('/v1/trip/{trip_id}', {
|
|
32
|
+
params: { path: { trip_id: tripId } },
|
|
36
33
|
});
|
|
37
34
|
return response.data;
|
|
38
35
|
},
|
|
39
|
-
getBooking: async (request) =>
|
|
40
|
-
const data = await post('/api/v1/bookings/get', request);
|
|
41
|
-
return data;
|
|
42
|
-
},
|
|
36
|
+
getBooking: async (request) => (await post('/v1/get_booking', request)),
|
|
43
37
|
// Deprecated — kept for back-compat (JIN-663). Delegates to the canonical
|
|
44
|
-
// get_booking
|
|
45
|
-
//
|
|
46
|
-
lookupBooking: async (request) =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
exchangeCommit: async (request) => (await post('/api/v1/flights/exchange-commit', request)),
|
|
56
|
-
exchangeStatus: async (request) => (await post('/api/v1/flights/exchange-status', request)),
|
|
57
|
-
hotelRetrieveBooking: async (request) => (await post('/api/v1/hotels/retrieve-booking', request)),
|
|
58
|
-
hotelCancelBooking: async (request) => (await post('/api/v1/hotels/cancel-booking', request)),
|
|
38
|
+
// get_booking capability so a single SDK bump moves callers onto the new
|
|
39
|
+
// public surface.
|
|
40
|
+
lookupBooking: async (request) => (await post('/v1/get_booking', request)),
|
|
41
|
+
refundCheck: async (request) => (await post('/v1/refund_check', request)),
|
|
42
|
+
refundCommit: async (request) => (await post('/v1/refund_commit', request)),
|
|
43
|
+
refundStatus: async (request) => (await post('/v1/refund_status', request)),
|
|
44
|
+
exchangeShop: async (request) => (await post('/v1/exchange_shop', request)),
|
|
45
|
+
exchangePrice: async (request) => (await post('/v1/exchange_price', request)),
|
|
46
|
+
exchangeCommit: async (request) => (await post('/v1/exchange_commit', request)),
|
|
47
|
+
exchangeStatus: async (request) => (await post('/v1/exchange_status', request)),
|
|
48
|
+
hotelCancelBooking: async (request) => (await post('/v1/hotel_cancel', request)),
|
|
59
49
|
};
|
|
60
50
|
}
|
|
61
51
|
//# sourceMappingURL=tools.js.map
|
package/dist/tools.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"
|
|
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