@duffel/api 2.0.0 → 2.1.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/dist/Stays/Bookings/Bookings.d.ts +36 -0
- package/dist/Stays/Bookings/Bookings.spec.d.ts +1 -0
- package/dist/Stays/Bookings/index.d.ts +1 -0
- package/dist/Stays/Quotes/Quotes.d.ts +16 -0
- package/dist/Stays/Quotes/Quotes.spec.d.ts +1 -0
- package/dist/Stays/Quotes/index.d.ts +1 -0
- package/dist/Stays/SearchResults/SearchResults.d.ts +16 -0
- package/dist/Stays/SearchResults/SearchResults.spec.d.ts +1 -0
- package/dist/Stays/SearchResults/index.d.ts +1 -0
- package/dist/Stays/Stays.d.ts +22 -0
- package/dist/Stays/Stays.spec.d.ts +1 -0
- package/dist/Stays/StaysTypes.d.ts +406 -0
- package/dist/index.es.js +1 -1
- package/dist/index.js +1 -1
- package/dist/typings.d.ts +544 -18
- package/package.json +15 -8
package/dist/typings.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ declare module '@duffel/api' {
|
|
|
13
13
|
import { Refunds } from '@duffel/api/DuffelPayments/Refunds';
|
|
14
14
|
import { Sessions } from '@duffel/api/Links';
|
|
15
15
|
import { Webhooks } from '@duffel/api/notifications';
|
|
16
|
+
import { Stays } from '@duffel/api/Stays/Stays';
|
|
16
17
|
export interface DuffelAPIClient {
|
|
17
18
|
aircraft: Aircraft;
|
|
18
19
|
airlines: Airlines;
|
|
@@ -47,6 +48,7 @@ declare module '@duffel/api' {
|
|
|
47
48
|
suggestions: Suggestions;
|
|
48
49
|
refunds: Refunds;
|
|
49
50
|
webhooks: Webhooks;
|
|
51
|
+
stays: Stays;
|
|
50
52
|
constructor(config: Config);
|
|
51
53
|
}
|
|
52
54
|
export const DuffelError: typeof _DuffelError;
|
|
@@ -127,6 +129,31 @@ declare module '@duffel/api/notifications' {
|
|
|
127
129
|
export * from '@duffel/api/notifications/Webhooks';
|
|
128
130
|
}
|
|
129
131
|
|
|
132
|
+
declare module '@duffel/api/Stays/Stays' {
|
|
133
|
+
import { Client } from '@duffel/api/Client';
|
|
134
|
+
import { StaysSearchParams, StaysSearchResult } from '@duffel/api/Stays/StaysTypes';
|
|
135
|
+
import { Resource } from '@duffel/api/Resource';
|
|
136
|
+
import { DuffelResponse } from '@duffel/api/types';
|
|
137
|
+
import { Bookings } from '@duffel/api/Stays/Bookings';
|
|
138
|
+
import { Quotes } from '@duffel/api/Stays/Quotes';
|
|
139
|
+
import { SearchResults } from '@duffel/api/Stays/SearchResults';
|
|
140
|
+
export class Stays extends Resource {
|
|
141
|
+
/**
|
|
142
|
+
* Endpoint path
|
|
143
|
+
*/
|
|
144
|
+
path: string;
|
|
145
|
+
searchResults: SearchResults;
|
|
146
|
+
quotes: Quotes;
|
|
147
|
+
bookings: Bookings;
|
|
148
|
+
constructor(client: Client);
|
|
149
|
+
/**
|
|
150
|
+
* Search for accommodations
|
|
151
|
+
* @param {object} params - The search parameters
|
|
152
|
+
*/
|
|
153
|
+
search: (params: StaysSearchParams) => Promise<DuffelResponse<StaysSearchResult>>;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
130
157
|
declare module '@duffel/api/DuffelPayments/PaymentIntents' {
|
|
131
158
|
export * from '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntents';
|
|
132
159
|
}
|
|
@@ -194,6 +221,7 @@ declare module '@duffel/api/types' {
|
|
|
194
221
|
export * from '@duffel/api/types/shared';
|
|
195
222
|
export * from '@duffel/api/types/ClientType';
|
|
196
223
|
export * from '@duffel/api/notifications/Webhooks/WebhooksType';
|
|
224
|
+
export * from '@duffel/api/Stays/StaysTypes';
|
|
197
225
|
}
|
|
198
226
|
|
|
199
227
|
declare module '@duffel/api/supportingResources/Aircraft' {
|
|
@@ -270,6 +298,445 @@ declare module '@duffel/api/notifications/Webhooks' {
|
|
|
270
298
|
export * from '@duffel/api/notifications/Webhooks/Webhooks';
|
|
271
299
|
}
|
|
272
300
|
|
|
301
|
+
declare module '@duffel/api/Stays/StaysTypes' {
|
|
302
|
+
export type StaysBedType = 'single' | 'double' | 'queen' | 'king' | 'sofabed';
|
|
303
|
+
export interface StaysBed {
|
|
304
|
+
/**
|
|
305
|
+
* The type of beds available in the room Available types: "single", "double", "queen", "king", "sofabed"
|
|
306
|
+
*/
|
|
307
|
+
type: StaysBedType;
|
|
308
|
+
/**
|
|
309
|
+
* The number of beds of this type in the room.
|
|
310
|
+
*/
|
|
311
|
+
count: number;
|
|
312
|
+
}
|
|
313
|
+
export interface StaysRating {
|
|
314
|
+
/**
|
|
315
|
+
* The source of this rating. Possible values: `"aaa"` (American Automobile Association Diamond Rating), `"northstar"` (Northstar Crown Rating), `"priceline"` (Priceline star rating)
|
|
316
|
+
*/
|
|
317
|
+
source: 'aaa' | 'northstar' | 'priceline';
|
|
318
|
+
/**
|
|
319
|
+
* The rating value. This is an integer from 1 to 5 regardless of the `source`.
|
|
320
|
+
*/
|
|
321
|
+
value: number;
|
|
322
|
+
}
|
|
323
|
+
export interface StaysRateCondition {
|
|
324
|
+
/**
|
|
325
|
+
* One or more paragraphs that outline the rate condition
|
|
326
|
+
*/
|
|
327
|
+
description: string;
|
|
328
|
+
/**
|
|
329
|
+
* The condition title
|
|
330
|
+
*/
|
|
331
|
+
title: string;
|
|
332
|
+
}
|
|
333
|
+
export interface StaysRateCancellationTimeline {
|
|
334
|
+
/**
|
|
335
|
+
* The amount refundable up until the specified before date
|
|
336
|
+
*/
|
|
337
|
+
refund_amount: string;
|
|
338
|
+
/**
|
|
339
|
+
* The ISO 8601 datetime for the deadline of a refund.
|
|
340
|
+
*/
|
|
341
|
+
before: string;
|
|
342
|
+
/**
|
|
343
|
+
* The currency of the amount, as an ISO 4217 currency code.
|
|
344
|
+
*/
|
|
345
|
+
currency: string;
|
|
346
|
+
}
|
|
347
|
+
export interface StaysRate {
|
|
348
|
+
/**
|
|
349
|
+
* The currency of the base_amount, as an ISO 4217 currency code.
|
|
350
|
+
*/
|
|
351
|
+
base_amount: string | null;
|
|
352
|
+
/**
|
|
353
|
+
* The currency of the base_amount, as an ISO 4217 currency code.
|
|
354
|
+
*/
|
|
355
|
+
base_currency: string;
|
|
356
|
+
/**
|
|
357
|
+
* The type of boarding offered by this rate.
|
|
358
|
+
*/
|
|
359
|
+
board_type: 'room_only' | 'breakfast' | 'all_inclusive';
|
|
360
|
+
/**
|
|
361
|
+
* A timeline that contains policies, such as possible refunds, once this rate has been booked. This is sorted in ascending chronological order.
|
|
362
|
+
*/
|
|
363
|
+
cancellation_timeline: StaysRateCancellationTimeline[];
|
|
364
|
+
/**
|
|
365
|
+
* The conditions or policies that apply to the rate. The information provided should be treated as mandatory and displayed to the traveller during and after the booking process.
|
|
366
|
+
*/
|
|
367
|
+
conditions: Array<StaysRateCondition>;
|
|
368
|
+
/**
|
|
369
|
+
* Fees are sometimes payable at time of check in. These fees are not collected during the booking process
|
|
370
|
+
*/
|
|
371
|
+
due_at_accommodation_amount: string | null;
|
|
372
|
+
/**
|
|
373
|
+
* The currency of the due_at_accommodation_amount
|
|
374
|
+
*/
|
|
375
|
+
due_at_accommodation_currency: string;
|
|
376
|
+
/**
|
|
377
|
+
* ID of a given rate for a accommodation
|
|
378
|
+
*/
|
|
379
|
+
id: string;
|
|
380
|
+
/**
|
|
381
|
+
* The accepted payment method for this rate. Prepaid rates require payment at time of reservation. Accepted types: prepaid
|
|
382
|
+
*/
|
|
383
|
+
payment_type: 'prepaid';
|
|
384
|
+
/**
|
|
385
|
+
* The supplier from which Duffel got this rate
|
|
386
|
+
*/
|
|
387
|
+
supplier: 'priceline';
|
|
388
|
+
/**
|
|
389
|
+
* The fee amount, as an ISO 4217 currency code.
|
|
390
|
+
*/
|
|
391
|
+
fee_amount: string | null;
|
|
392
|
+
/**
|
|
393
|
+
* The currency of the fee_amount, as an ISO 4217 currency code
|
|
394
|
+
*/
|
|
395
|
+
fee_currency: string;
|
|
396
|
+
/**
|
|
397
|
+
* The tax amount, as an ISO 4217 currency code.
|
|
398
|
+
*/
|
|
399
|
+
tax_amount: string | null;
|
|
400
|
+
/**
|
|
401
|
+
* The currency of the tax_amount, as an ISO 4217 currency code
|
|
402
|
+
*/
|
|
403
|
+
tax_currency: string;
|
|
404
|
+
/**
|
|
405
|
+
* The total price for the room for all nights and for all occupants. Please note, the occupant may be required to pay fees on arrival at the hotel. These are not included in the total_amount, and are included in due_at_accommodation_amount
|
|
406
|
+
*/
|
|
407
|
+
total_amount: string;
|
|
408
|
+
/**
|
|
409
|
+
* The currency of the total_amount, as an ISO 4217 currency code
|
|
410
|
+
*/
|
|
411
|
+
total_currency: string;
|
|
412
|
+
}
|
|
413
|
+
export interface StaysPhoto {
|
|
414
|
+
url: string;
|
|
415
|
+
}
|
|
416
|
+
export interface StaysRoom {
|
|
417
|
+
/**
|
|
418
|
+
* The room name.
|
|
419
|
+
*/
|
|
420
|
+
name: string;
|
|
421
|
+
/**
|
|
422
|
+
* Available beds in the room
|
|
423
|
+
*/
|
|
424
|
+
beds?: StaysBed[];
|
|
425
|
+
/**
|
|
426
|
+
* Supplied photos for the room
|
|
427
|
+
*/
|
|
428
|
+
photos?: StaysPhoto[];
|
|
429
|
+
/**
|
|
430
|
+
* The available rates for a specific room, including commission, distribution, payment and included services information.
|
|
431
|
+
*/
|
|
432
|
+
rates: StaysRate[];
|
|
433
|
+
}
|
|
434
|
+
export interface StaysAmenity {
|
|
435
|
+
type: 'parking' | 'wi-fi' | 'gym';
|
|
436
|
+
description: string;
|
|
437
|
+
}
|
|
438
|
+
export interface StaysChain {
|
|
439
|
+
/**
|
|
440
|
+
* The hotel chain’s name
|
|
441
|
+
*/
|
|
442
|
+
name: string;
|
|
443
|
+
}
|
|
444
|
+
export interface StaysAddress {
|
|
445
|
+
/**
|
|
446
|
+
* The name of the city or metropolitan area where the accommodation is located.
|
|
447
|
+
*/
|
|
448
|
+
city_name: string;
|
|
449
|
+
/**
|
|
450
|
+
* The ISO 3166-1 alpha-2 code for the country where the hotel is located.
|
|
451
|
+
*/
|
|
452
|
+
country_code: string;
|
|
453
|
+
/**
|
|
454
|
+
* The first line of the accommodation's address
|
|
455
|
+
*/
|
|
456
|
+
line_one: string;
|
|
457
|
+
/**
|
|
458
|
+
* The accommodation's postal code (or zip code)
|
|
459
|
+
*/
|
|
460
|
+
postal_code: string;
|
|
461
|
+
/**
|
|
462
|
+
* The setay's region or state
|
|
463
|
+
*/
|
|
464
|
+
region: string;
|
|
465
|
+
}
|
|
466
|
+
export interface GeographicCoordinates {
|
|
467
|
+
/**
|
|
468
|
+
* The latitude position of the accommodation represented in Decimal degrees with 6 decimal points with a range between -90° and 90°
|
|
469
|
+
*/
|
|
470
|
+
latitude: number;
|
|
471
|
+
/**
|
|
472
|
+
* The longitude position of the accommodation represented in Decimal degrees with 6 decimal points with a range between -180° and 180°
|
|
473
|
+
*/
|
|
474
|
+
longitude: number;
|
|
475
|
+
}
|
|
476
|
+
export interface StaysLocation {
|
|
477
|
+
/**
|
|
478
|
+
* Address information of the location
|
|
479
|
+
*/
|
|
480
|
+
address: StaysAddress;
|
|
481
|
+
/**
|
|
482
|
+
* The exact latitude-longitude position of the accommodation. Useful for map views.
|
|
483
|
+
*/
|
|
484
|
+
geographic_coordinates: GeographicCoordinates | null;
|
|
485
|
+
}
|
|
486
|
+
export interface StaysAccommodation {
|
|
487
|
+
/**
|
|
488
|
+
* The amenities available at the accommodation
|
|
489
|
+
*/
|
|
490
|
+
amenities: StaysAmenity[] | null;
|
|
491
|
+
/**
|
|
492
|
+
* Information about the chain this accommodation belongs to
|
|
493
|
+
*/
|
|
494
|
+
chain: StaysChain | null;
|
|
495
|
+
/**
|
|
496
|
+
* Check in and check out related information
|
|
497
|
+
*/
|
|
498
|
+
check_in_information: {
|
|
499
|
+
/**
|
|
500
|
+
* The ISO 8601 format for the earliest time a traveller can check-in to their room.
|
|
501
|
+
*/
|
|
502
|
+
check_out_before_time: string;
|
|
503
|
+
/**
|
|
504
|
+
* The ISO 8601 format for the earliest time a traveller can check-out to their room.
|
|
505
|
+
*/
|
|
506
|
+
check_in_after_time: string;
|
|
507
|
+
} | null;
|
|
508
|
+
/**
|
|
509
|
+
* The total currency for the cheapest rate for this accommodation, as an ISO 4217 currency code. If rooms data is available, this is equivalent to the cheapest rate for the cheapest room.
|
|
510
|
+
*/
|
|
511
|
+
cheapest_rate_currency: string;
|
|
512
|
+
/**
|
|
513
|
+
* The total amount for the cheapest rate for this accommodation. If rooms data is available, this is equivalent to the cheapest rate for the cheapest room.
|
|
514
|
+
*/
|
|
515
|
+
cheapest_rate_total_amount: string;
|
|
516
|
+
/**
|
|
517
|
+
* The accommodation’s description
|
|
518
|
+
*/
|
|
519
|
+
description?: string;
|
|
520
|
+
/**
|
|
521
|
+
* The accommodation’s email address. Note that this data may differ from the accommodation’s records if it was updated directly by the accommodation after the booking was created.
|
|
522
|
+
*/
|
|
523
|
+
email: string | null;
|
|
524
|
+
/**
|
|
525
|
+
* Information on the accommodation's location
|
|
526
|
+
*/
|
|
527
|
+
location: StaysLocation;
|
|
528
|
+
/**
|
|
529
|
+
* The accommodation's name
|
|
530
|
+
*/
|
|
531
|
+
name: string;
|
|
532
|
+
/**
|
|
533
|
+
* The accommodation's phone number in E.164 (international) format. Note that this data may differ from the accommodation's records if it was updated directly by the accommodation after the booking was created.
|
|
534
|
+
*/
|
|
535
|
+
phone_number: string | null;
|
|
536
|
+
/**
|
|
537
|
+
* Photos for the accommodation
|
|
538
|
+
*/
|
|
539
|
+
photos?: StaysPhoto[];
|
|
540
|
+
/**
|
|
541
|
+
* Ratings of the accommodation
|
|
542
|
+
*/
|
|
543
|
+
ratings: StaysRating[] | null;
|
|
544
|
+
/**
|
|
545
|
+
* Rooms for the accommodation
|
|
546
|
+
*/
|
|
547
|
+
rooms: StaysRoom[];
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* Represents a quote for a stay.
|
|
551
|
+
*/
|
|
552
|
+
export interface StaysQuote {
|
|
553
|
+
/**
|
|
554
|
+
* The id of the stay quote.
|
|
555
|
+
*
|
|
556
|
+
* Example: "quo_0000AS0NZdKjjnnHZmSUbI"
|
|
557
|
+
*/
|
|
558
|
+
id: string;
|
|
559
|
+
/**
|
|
560
|
+
* The ISO 8601 date on which the guest wants to check in.
|
|
561
|
+
* This comes from the search request this quote originates from.
|
|
562
|
+
*
|
|
563
|
+
* Example: "2023-05-24"
|
|
564
|
+
*/
|
|
565
|
+
check_in_date: string;
|
|
566
|
+
/**
|
|
567
|
+
* The ISO 8601 date on which the guest wants to check out.
|
|
568
|
+
* This comes from the search request this quote originates from.
|
|
569
|
+
*
|
|
570
|
+
* Example: "2023-05-28"
|
|
571
|
+
*/
|
|
572
|
+
check_out_date: string;
|
|
573
|
+
/**
|
|
574
|
+
* The accommodation associated with this quote.
|
|
575
|
+
*/
|
|
576
|
+
accommodation: StaysAccommodation;
|
|
577
|
+
/**
|
|
578
|
+
* The total price for the room for all nights and for all guests.
|
|
579
|
+
* Please note, the guest may be required to pay mandatory fees and taxes at the stay.
|
|
580
|
+
* These are not included in the total_amount, and are included in due_at_accommodation_amount.
|
|
581
|
+
*
|
|
582
|
+
* Example: "799.00"
|
|
583
|
+
*/
|
|
584
|
+
total_amount: string;
|
|
585
|
+
/**
|
|
586
|
+
* The currency of the total_amount, as an ISO 4217 currency code.
|
|
587
|
+
*
|
|
588
|
+
* Example: "GBP"
|
|
589
|
+
*/
|
|
590
|
+
total_currency: string;
|
|
591
|
+
/**
|
|
592
|
+
* The base amount for this quote, excluding taxes and fees.
|
|
593
|
+
* Will be null if the base amount is unknown.
|
|
594
|
+
*
|
|
595
|
+
* Example: "665.83"
|
|
596
|
+
*/
|
|
597
|
+
base_amount: string | null;
|
|
598
|
+
/**
|
|
599
|
+
* The currency of the base_amount, as an ISO 4217 currency code.
|
|
600
|
+
*
|
|
601
|
+
* Example: "GBP"
|
|
602
|
+
*/
|
|
603
|
+
base_currency: string;
|
|
604
|
+
/**
|
|
605
|
+
* The fee amount for this quote.
|
|
606
|
+
* Will be null if the fee amount is unknown.
|
|
607
|
+
*
|
|
608
|
+
* Example: "50.94"
|
|
609
|
+
*/
|
|
610
|
+
fee_amount: string | null;
|
|
611
|
+
/**
|
|
612
|
+
* The currency of the fee_amount, as an ISO 4217 currency code.
|
|
613
|
+
*
|
|
614
|
+
* Example: "GBP"
|
|
615
|
+
*/
|
|
616
|
+
fee_currency: string;
|
|
617
|
+
/**
|
|
618
|
+
* The tax amount for this quote.
|
|
619
|
+
* Will be null if the tax amount is unknown.
|
|
620
|
+
*
|
|
621
|
+
* Example: "133.17"
|
|
622
|
+
*/
|
|
623
|
+
tax_amount: string | null;
|
|
624
|
+
/**
|
|
625
|
+
* The currency of the tax_amount, as an ISO 4217 currency code.
|
|
626
|
+
*
|
|
627
|
+
* Example: "GBP"
|
|
628
|
+
*/
|
|
629
|
+
tax_currency: string;
|
|
630
|
+
/**
|
|
631
|
+
* Mandatory fees or taxes that are due by the guest at the accommodation.
|
|
632
|
+
* Depending on the accommodation, these may be payable on check-in or check-out.
|
|
633
|
+
* These fees are not collected during the booking process.
|
|
634
|
+
* Will be null if the amount due at accommodation is unknown.
|
|
635
|
+
*
|
|
636
|
+
* Example: "39.95"
|
|
637
|
+
*/
|
|
638
|
+
due_at_accommodation_amount: string | null;
|
|
639
|
+
/**
|
|
640
|
+
* The currency of the due_at_accommodation_amount, as an ISO 4217 currency code.
|
|
641
|
+
*
|
|
642
|
+
* Example: "GBP"
|
|
643
|
+
*/
|
|
644
|
+
due_at_accommodation_currency: string;
|
|
645
|
+
}
|
|
646
|
+
export type StaysBookingStatus = 'requested' | 'confirmed' | 'failed' | 'cancellation_confirmed';
|
|
647
|
+
export interface StaysBooking {
|
|
648
|
+
/**
|
|
649
|
+
* The ID of the booking
|
|
650
|
+
*/
|
|
651
|
+
id: string;
|
|
652
|
+
/**
|
|
653
|
+
* The accommodation object for the booking
|
|
654
|
+
*/
|
|
655
|
+
accommodation: StaysAccommodation;
|
|
656
|
+
/**
|
|
657
|
+
* The ISO 8601 date on which the guest wants to check in.
|
|
658
|
+
*/
|
|
659
|
+
check_in_date: string;
|
|
660
|
+
/**
|
|
661
|
+
* The ISO 8601 date on which the guest wants to check out.
|
|
662
|
+
*/
|
|
663
|
+
check_out_date: string;
|
|
664
|
+
/**
|
|
665
|
+
* A booking reference for the property you’ll be staying in. This is the reference you should use when contacting the accommodation.
|
|
666
|
+
*/
|
|
667
|
+
reference: string | null;
|
|
668
|
+
/**
|
|
669
|
+
* The status of the booking. Possible values: requested, confirmed, failed,cancellation_requested,cancellation_confirmed.
|
|
670
|
+
*/
|
|
671
|
+
status: StaysBookingStatus;
|
|
672
|
+
/**
|
|
673
|
+
* The ISO 8601 datetime at which the booking was confirmed by the accommodation.
|
|
674
|
+
*/
|
|
675
|
+
confirmed_at: string | null;
|
|
676
|
+
/**
|
|
677
|
+
* The ISO 8601 datetime of the cancellation of this booking.
|
|
678
|
+
* This is null if the booking is not cancelled.
|
|
679
|
+
*/
|
|
680
|
+
cancelled_at: string | null;
|
|
681
|
+
/**
|
|
682
|
+
* The guests for the booking
|
|
683
|
+
*/
|
|
684
|
+
guests: Array<{
|
|
685
|
+
given_name: string;
|
|
686
|
+
family_name: string;
|
|
687
|
+
}>;
|
|
688
|
+
}
|
|
689
|
+
export interface StaysSearchParams {
|
|
690
|
+
check_in_date: string;
|
|
691
|
+
check_out_date: string;
|
|
692
|
+
adults: number;
|
|
693
|
+
rooms: number;
|
|
694
|
+
location: {
|
|
695
|
+
radius: number;
|
|
696
|
+
geographic_coordinates: {
|
|
697
|
+
latitude: number;
|
|
698
|
+
longitude: number;
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
export interface StaysSearchResult {
|
|
703
|
+
id: string;
|
|
704
|
+
check_in_date: string;
|
|
705
|
+
check_out_date: string;
|
|
706
|
+
accommodation: StaysAccommodation;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
|
|
710
|
+
declare module '@duffel/api/Resource' {
|
|
711
|
+
import { Client } from '@duffel/api/Client';
|
|
712
|
+
import { DuffelResponse } from '@duffel/api/types';
|
|
713
|
+
export class Resource {
|
|
714
|
+
constructor(client: Client);
|
|
715
|
+
protected request: <T_Data = any>({ method, path, data, params, }: {
|
|
716
|
+
method: string;
|
|
717
|
+
path: string;
|
|
718
|
+
data?: Record<string, any> | undefined;
|
|
719
|
+
params?: Record<string, any> | undefined;
|
|
720
|
+
}) => Promise<DuffelResponse<T_Data>>;
|
|
721
|
+
protected paginatedRequest: <T_Data = any>({ path, params, }: {
|
|
722
|
+
path: string;
|
|
723
|
+
params?: Record<string, any> | undefined;
|
|
724
|
+
}) => AsyncGenerator<DuffelResponse<T_Data>, void, unknown>;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
declare module '@duffel/api/Stays/Bookings' {
|
|
729
|
+
export * from '@duffel/api/Stays/Bookings/Bookings';
|
|
730
|
+
}
|
|
731
|
+
|
|
732
|
+
declare module '@duffel/api/Stays/Quotes' {
|
|
733
|
+
export * from '@duffel/api/Stays/Quotes/Quotes';
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
declare module '@duffel/api/Stays/SearchResults' {
|
|
737
|
+
export * from '@duffel/api/Stays/SearchResults/SearchResults';
|
|
738
|
+
}
|
|
739
|
+
|
|
273
740
|
declare module '@duffel/api/DuffelPayments/PaymentIntents/PaymentIntents' {
|
|
274
741
|
import { DuffelResponse } from '@duffel/api/types';
|
|
275
742
|
import { Resource } from '@duffel/api/Resource';
|
|
@@ -3451,24 +3918,6 @@ declare module '@duffel/api/supportingResources/Airports/Airports' {
|
|
|
3451
3918
|
}
|
|
3452
3919
|
}
|
|
3453
3920
|
|
|
3454
|
-
declare module '@duffel/api/Resource' {
|
|
3455
|
-
import { Client } from '@duffel/api/Client';
|
|
3456
|
-
import { DuffelResponse } from '@duffel/api/types';
|
|
3457
|
-
export class Resource {
|
|
3458
|
-
constructor(client: Client);
|
|
3459
|
-
protected request: <T_Data = any>({ method, path, data, params, }: {
|
|
3460
|
-
method: string;
|
|
3461
|
-
path: string;
|
|
3462
|
-
data?: Record<string, any> | undefined;
|
|
3463
|
-
params?: Record<string, any> | undefined;
|
|
3464
|
-
}) => Promise<DuffelResponse<T_Data>>;
|
|
3465
|
-
protected paginatedRequest: <T_Data = any>({ path, params, }: {
|
|
3466
|
-
path: string;
|
|
3467
|
-
params?: Record<string, any> | undefined;
|
|
3468
|
-
}) => AsyncGenerator<DuffelResponse<T_Data>, void, unknown>;
|
|
3469
|
-
}
|
|
3470
|
-
}
|
|
3471
|
-
|
|
3472
3921
|
declare module '@duffel/api/DuffelPayments/Refunds/RefundsType' {
|
|
3473
3922
|
export interface Refund {
|
|
3474
3923
|
/**
|
|
@@ -3662,6 +4111,83 @@ declare module '@duffel/api/notifications/Webhooks/Webhooks' {
|
|
|
3662
4111
|
}
|
|
3663
4112
|
}
|
|
3664
4113
|
|
|
4114
|
+
declare module '@duffel/api/Stays/Bookings/Bookings' {
|
|
4115
|
+
import { Client } from '@duffel/api/Client';
|
|
4116
|
+
import { StaysBooking } from '@duffel/api/Stays/StaysTypes';
|
|
4117
|
+
import { Resource } from '@duffel/api/Resource';
|
|
4118
|
+
import { DuffelResponse } from '@duffel/api/types';
|
|
4119
|
+
export interface StaysBookingPayload {
|
|
4120
|
+
quote_id: string;
|
|
4121
|
+
guests: Array<{
|
|
4122
|
+
given_name: string;
|
|
4123
|
+
family_name: string;
|
|
4124
|
+
born_on: string;
|
|
4125
|
+
}>;
|
|
4126
|
+
email: string;
|
|
4127
|
+
phone_number: string;
|
|
4128
|
+
accommodation_special_requests?: string;
|
|
4129
|
+
}
|
|
4130
|
+
export class Bookings extends Resource {
|
|
4131
|
+
/**
|
|
4132
|
+
* Endpoint path
|
|
4133
|
+
*/
|
|
4134
|
+
path: string;
|
|
4135
|
+
constructor(client: Client);
|
|
4136
|
+
/**
|
|
4137
|
+
* Create a booking
|
|
4138
|
+
* @param {object} payload - The booking payload, including quote id and guest information
|
|
4139
|
+
*/
|
|
4140
|
+
create: (payload: StaysBookingPayload) => Promise<DuffelResponse<StaysBooking>>;
|
|
4141
|
+
/**
|
|
4142
|
+
* Get a booking
|
|
4143
|
+
* @param {string} bookingId - The ID of the booking
|
|
4144
|
+
*/
|
|
4145
|
+
get: (bookingId: string) => Promise<DuffelResponse<StaysBooking>>;
|
|
4146
|
+
/**
|
|
4147
|
+
* list bookings
|
|
4148
|
+
*/
|
|
4149
|
+
list: () => Promise<DuffelResponse<StaysBooking>>;
|
|
4150
|
+
}
|
|
4151
|
+
}
|
|
4152
|
+
|
|
4153
|
+
declare module '@duffel/api/Stays/Quotes/Quotes' {
|
|
4154
|
+
import { Client } from '@duffel/api/Client';
|
|
4155
|
+
import { StaysQuote } from '@duffel/api/Stays/StaysTypes';
|
|
4156
|
+
import { Resource } from '@duffel/api/Resource';
|
|
4157
|
+
import { DuffelResponse } from '@duffel/api/types';
|
|
4158
|
+
export class Quotes extends Resource {
|
|
4159
|
+
/**
|
|
4160
|
+
* Endpoint path
|
|
4161
|
+
*/
|
|
4162
|
+
path: string;
|
|
4163
|
+
constructor(client: Client);
|
|
4164
|
+
/**
|
|
4165
|
+
* Create a quote for the selected rate
|
|
4166
|
+
* @param {string} rateId - The ID of the rate to create a quote for
|
|
4167
|
+
*/
|
|
4168
|
+
create: (rateId: string) => Promise<DuffelResponse<StaysQuote>>;
|
|
4169
|
+
}
|
|
4170
|
+
}
|
|
4171
|
+
|
|
4172
|
+
declare module '@duffel/api/Stays/SearchResults/SearchResults' {
|
|
4173
|
+
import { Client } from '@duffel/api/Client';
|
|
4174
|
+
import { StaysSearchResult } from '@duffel/api/Stays/StaysTypes';
|
|
4175
|
+
import { Resource } from '@duffel/api/Resource';
|
|
4176
|
+
import { DuffelResponse } from '@duffel/api/types';
|
|
4177
|
+
export class SearchResults extends Resource {
|
|
4178
|
+
/**
|
|
4179
|
+
* Endpoint path
|
|
4180
|
+
*/
|
|
4181
|
+
path: string;
|
|
4182
|
+
constructor(client: Client);
|
|
4183
|
+
/**
|
|
4184
|
+
* Fetch all rates for the given search result
|
|
4185
|
+
* @param {string} searchResultId - The ID of the search result to fetch rates for
|
|
4186
|
+
*/
|
|
4187
|
+
fetchAllRates: (searchResultId: string) => Promise<DuffelResponse<StaysSearchResult>>;
|
|
4188
|
+
}
|
|
4189
|
+
}
|
|
4190
|
+
|
|
3665
4191
|
declare module '@duffel/api/booking/PartialOfferRequests/PartialOfferRequestTypes' {
|
|
3666
4192
|
export interface SelectedPartialOffersParams {
|
|
3667
4193
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duffel/api",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Javascript client library for the Duffel API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"start": "node ./dist/index.js",
|
|
23
23
|
"dev": "ts-node ./src/index.ts",
|
|
24
24
|
"lint": "eslint . --ext .ts,.tsx",
|
|
25
|
-
"test": "jest",
|
|
25
|
+
"test": "jest --runInBand",
|
|
26
26
|
"pre-commit-check": "yarn lint-staged && yarn test && yarn build:test",
|
|
27
27
|
"prepare": "husky install",
|
|
28
28
|
"example": "ts-node ./examples/example.ts",
|
|
@@ -49,15 +49,16 @@
|
|
|
49
49
|
},
|
|
50
50
|
"resolutions": {
|
|
51
51
|
"ansi-regex": "^5.0.1",
|
|
52
|
-
"set-value": "^4.0.1"
|
|
52
|
+
"set-value": "^4.0.1",
|
|
53
|
+
"minimist": "1.2.8"
|
|
53
54
|
},
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@types/node": "^17.0.21",
|
|
56
57
|
"@types/node-fetch": "^2.6.2",
|
|
57
|
-
"node-fetch": "2.6.
|
|
58
|
+
"node-fetch": "2.6.11"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
|
-
"@babel/core": "7.21.
|
|
61
|
+
"@babel/core": "7.21.8",
|
|
61
62
|
"@babel/preset-env": "7.21.5",
|
|
62
63
|
"@babel/preset-typescript": "7.21.5",
|
|
63
64
|
"@commitlint/cli": "17.5.1",
|
|
@@ -79,13 +80,13 @@
|
|
|
79
80
|
"lint-staged": "13.1.2",
|
|
80
81
|
"nock": "13.2.9",
|
|
81
82
|
"prettier": "2.8.8",
|
|
82
|
-
"rollup": "3.21.
|
|
83
|
+
"rollup": "3.21.8",
|
|
83
84
|
"rollup-plugin-dts-bundle": "^1.0.0",
|
|
84
85
|
"rollup-plugin-inject-process-env": "1.3.1",
|
|
85
86
|
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
86
87
|
"rollup-plugin-terser": "7.0.2",
|
|
87
88
|
"rollup-plugin-typescript2": "0.33.0",
|
|
88
|
-
"ts-jest": "
|
|
89
|
+
"ts-jest": "29.1.0",
|
|
89
90
|
"ts-node": "10.9.1",
|
|
90
91
|
"typescript": "4.9.5"
|
|
91
92
|
},
|
|
@@ -101,7 +102,13 @@
|
|
|
101
102
|
"@semantic-release/release-notes-generator"
|
|
102
103
|
],
|
|
103
104
|
"@semantic-release/npm",
|
|
104
|
-
|
|
105
|
+
[
|
|
106
|
+
"@semantic-release/github",
|
|
107
|
+
{
|
|
108
|
+
"successComment": false,
|
|
109
|
+
"failTitle": false
|
|
110
|
+
}
|
|
111
|
+
]
|
|
105
112
|
],
|
|
106
113
|
"branches": [
|
|
107
114
|
"main"
|