@duffel/api 4.26.0 → 4.27.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.
package/dist/typings.d.ts CHANGED
@@ -460,7 +460,7 @@ declare module '@duffel/api/Stays/StaysTypes' {
460
460
  export type StaysLoyaltyProgrammeReference = 'wyndham_rewards' | 'choice_privileges' | 'marriott_bonvoy' | 'best_western_rewards' | 'world_of_hyatt' | 'hilton_honors' | 'ihg_one_rewards' | 'leaders_club' | 'stash_rewards' | 'omni_select_guest' | 'i_prefer' | 'accor_live_limitless' | 'my_6' | 'jumeirah_one' | 'global_hotel_alliance_discovery' | 'duffel_hotel_group_rewards';
461
461
  export type StaysPaymentMethod = 'balance' | 'card';
462
462
  export type StaysPaymentType = 'guarantee' | 'deposit' | 'pay_now';
463
- export type StaysSource = 'bookingcom' | 'priceline' | 'travelport' | 'expedia' | 'sabre' | 'duffel_hotel_group';
463
+ export type StaysSource = 'bookingcom' | 'priceline' | 'travelport' | 'expedia' | 'sabre' | 'duffel' | 'duffel_hotel_group';
464
464
  export interface StaysRate {
465
465
  /**
466
466
  * The currency of the base_amount, as an ISO 4217 currency code.
@@ -1769,7 +1769,7 @@ declare module '@duffel/api/booking/BatchOfferRequests/BatchOfferRequests' {
1769
1769
  declare module '@duffel/api/booking/OfferRequests/OfferRequests' {
1770
1770
  import { Client } from '@duffel/api/Client';
1771
1771
  import { Resource } from '@duffel/api/Resource';
1772
- import { CreateOfferRequest, CreateOfferRequestQueryParameters, DuffelResponse, OfferRequest, PaginationMeta } from '@duffel/api/types';
1772
+ import { CreateOfferRequest, CreateOfferRequestQueryParameters, DuffelResponse, OfferRequest, OfferRequestItinerariesView, PaginationMeta } from '@duffel/api/types';
1773
1773
  /**
1774
1774
  * To search for flights, you'll need to create an `offer request`.
1775
1775
  * An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
@@ -1804,12 +1804,17 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequests' {
1804
1804
  * To search for flights, you'll need to create an `offer request`.
1805
1805
  * An offer request describes the passengers and where and when they want to travel (in the form of a list of `slices`).
1806
1806
  * It may also include additional filters (e.g. a particular cabin to travel in).
1807
- * @param {Object} [options] - the parameters for making an offer requests (required: slices, passengers; optional: cabin_class, return_offers)
1807
+ * @param {Object} [options] - the parameters for making an offer requests (required: slices, passengers; optional: cabin_class, return_offers, view, include_split_ticket)
1808
1808
  * When `return_offers` is set to `true`, the offer request resource returned will include all the `offers` returned by the airlines.
1809
1809
  * If set to false, the offer request resource won't include any `offers`. To retrieve the associated offers later, use the List Offers endpoint, specifying the `offer_request_id`.
1810
+ * When `view` is set to `'itineraries'`, offers are grouped per slice into a hierarchy of itineraries and fare brands.
1811
+ * Combine `view: 'itineraries'` with `include_split_ticket: true` to surface split-ticket candidates.
1810
1812
  * @link https://duffel.com/docs/api/offer-requests/create-offer-request
1813
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
1811
1814
  */
1812
1815
  create: <QueryParams extends CreateOfferRequestQueryParameters>(options: CreateOfferRequest & QueryParams) => Promise<DuffelResponse<QueryParams extends {
1816
+ view: "itineraries";
1817
+ } ? OfferRequestItinerariesView : QueryParams extends {
1813
1818
  return_offers: false;
1814
1819
  } ? Omit<OfferRequest, "offers"> : OfferRequest>>;
1815
1820
  }
@@ -2412,7 +2417,7 @@ declare module '@duffel/api/booking/AirlineInitiatedChanges/AirlineInitiatedChan
2412
2417
 
2413
2418
  declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2414
2419
  import { Airline, CabinClass, PassengerType, Place, PlaceType } from '@duffel/api/types';
2415
- import { Offer } from '@duffel/api/booking/Offers/OfferTypes';
2420
+ import { Offer, OfferSliceSegment } from '@duffel/api/booking/Offers/OfferTypes';
2416
2421
  export interface OfferRequestSlice {
2417
2422
  /**
2418
2423
  * The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the passengers want to depart
@@ -2640,6 +2645,16 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2640
2645
  * whereas return trips will need two.
2641
2646
  */
2642
2647
  slices: CreateOfferRequestSlice[];
2648
+ /**
2649
+ * When set to `true` and the offer request contains more than one slice,
2650
+ * Duffel will fire additional one-way searches per slice to find
2651
+ * split-ticket itinerary candidates. Split-ticket offers are only returned
2652
+ * when combined with the `view=itineraries` query parameter.
2653
+ *
2654
+ * Requires this capability to be enabled on your Duffel account.
2655
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2656
+ */
2657
+ include_split_ticket?: boolean;
2643
2658
  }
2644
2659
  export type TimeRangeFilter = {
2645
2660
  from: string;
@@ -2670,6 +2685,18 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2670
2685
  */
2671
2686
  departure_time: TimeRangeFilter | null;
2672
2687
  }
2688
+ /**
2689
+ * The shape of the offer request response.
2690
+ *
2691
+ * - `offers` (default) — a flat list of offers under `data.offers`.
2692
+ * - `itineraries` — offers are grouped per slice into a hierarchy of
2693
+ * itineraries and fare brands under `data.slices[].itineraries[]`. This is
2694
+ * the view required to surface split-ticket candidates created with
2695
+ * `include_split_ticket: true`.
2696
+ *
2697
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2698
+ */
2699
+ export type OfferRequestView = 'offers' | 'itineraries';
2673
2700
  export interface CreateOfferRequestQueryParameters {
2674
2701
  /**
2675
2702
  * When set to `true`, the offer request resource returned will include all the offers returned by the airlines.
@@ -2678,6 +2705,14 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2678
2705
  * You should use this option if you want to take advantage of the pagination, sorting and filtering that the [List Offers](https://duffel.com/docs/api/offers/get-offers) endpoint provides.
2679
2706
  */
2680
2707
  return_offers?: boolean;
2708
+ /**
2709
+ * Controls the shape of the response. Defaults to `offers`, which returns a
2710
+ * flat list of offers. Set to `itineraries` to receive offers grouped by
2711
+ * slice, itinerary and fare brand — required to retrieve split-ticket
2712
+ * candidates produced by `include_split_ticket: true`.
2713
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2714
+ */
2715
+ view?: OfferRequestView;
2681
2716
  /**
2682
2717
  * The maximum amount of time in milliseconds to wait for each airline search to complete.
2683
2718
  * This timeout applies to the response time of the call to the airline and includes
@@ -2692,6 +2727,101 @@ declare module '@duffel/api/booking/OfferRequests/OfferRequestsTypes' {
2692
2727
  */
2693
2728
  supplier_timeout?: number;
2694
2729
  }
2730
+ /**
2731
+ * Discriminator for offers returned under the `itineraries` view.
2732
+ *
2733
+ * - `single_ticket` — a single offer from one airline that covers every slice
2734
+ * in the original offer request.
2735
+ * - `split_ticket` — an offer that covers a single slice, intended to be
2736
+ * combined with offers for the remaining slices (potentially from a
2737
+ * different airline) to fulfil the journey.
2738
+ *
2739
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2740
+ */
2741
+ export type ItineraryOfferType = 'single_ticket' | 'split_ticket';
2742
+ /**
2743
+ * An offer returned under the `itineraries` view.
2744
+ *
2745
+ * It is structurally the same as a regular {@link Offer} (minus
2746
+ * `available_services`, which is only populated by the Get single offer
2747
+ * endpoint) but carries a `type` discriminator describing whether the offer
2748
+ * covers the full journey or a single slice that needs to be combined with
2749
+ * other offers.
2750
+ */
2751
+ export interface ItineraryOffer extends Omit<Offer, 'available_services'> {
2752
+ /**
2753
+ * Whether the offer covers every slice from a single airline
2754
+ * (`single_ticket`) or only the slice it is nested under and needs to be
2755
+ * combined with other offers to complete the journey (`split_ticket`).
2756
+ */
2757
+ type: ItineraryOfferType;
2758
+ }
2759
+ /**
2760
+ * A fare brand grouping offers that share the same itinerary segments.
2761
+ */
2762
+ export interface ItineraryBrand {
2763
+ /**
2764
+ * The airline's marketing name for the fare brand, e.g. "Economy Basic".
2765
+ */
2766
+ fare_brand_name: string;
2767
+ /**
2768
+ * The offers available for this fare brand on this itinerary.
2769
+ */
2770
+ offers: ItineraryOffer[];
2771
+ }
2772
+ /**
2773
+ * One way the airline can fly a passenger from the slice's origin to its
2774
+ * destination. A single itinerary is a fixed list of segments which may be
2775
+ * sold under one or more fare brands.
2776
+ */
2777
+ export interface Itinerary {
2778
+ /**
2779
+ * The segments that make up this itinerary, in the order they are flown.
2780
+ */
2781
+ segments: OfferSliceSegment[];
2782
+ /**
2783
+ * The fare brands available for this itinerary, each carrying one or more
2784
+ * bookable offers.
2785
+ */
2786
+ brands: ItineraryBrand[];
2787
+ }
2788
+ /**
2789
+ * A slice as represented in the `itineraries` view of an offer request.
2790
+ *
2791
+ * Unlike {@link OfferRequestSlice}, it does not include the `departure_date`
2792
+ * or origin/destination type fields directly — the per-segment scheduling
2793
+ * lives inside `itineraries[].segments[]`.
2794
+ */
2795
+ export interface OfferRequestItinerariesViewSlice {
2796
+ /**
2797
+ * The city or airport the passengers want to depart from.
2798
+ */
2799
+ origin: Place;
2800
+ /**
2801
+ * The city or airport the passengers want to travel to.
2802
+ */
2803
+ destination: Place;
2804
+ /**
2805
+ * The itineraries available for this slice, each grouping offers by fare
2806
+ * brand.
2807
+ */
2808
+ itineraries: Itinerary[];
2809
+ }
2810
+ /**
2811
+ * The response payload returned when an offer request is created with the
2812
+ * `view=itineraries` query parameter. Offers are grouped per slice rather than
2813
+ * returned as a flat list, which is required to surface split-ticket
2814
+ * candidates produced by `include_split_ticket: true`.
2815
+ *
2816
+ * @link https://duffel.com/docs/guides/selling-split-ticket-itineraries
2817
+ */
2818
+ export interface OfferRequestItinerariesView extends Omit<OfferRequest, 'slices' | 'offers'> {
2819
+ /**
2820
+ * The slices that make up this offer request, each carrying the itineraries
2821
+ * and offers available for that slice.
2822
+ */
2823
+ slices: OfferRequestItinerariesViewSlice[];
2824
+ }
2695
2825
  export {};
2696
2826
  }
2697
2827
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duffel/api",
3
- "version": "4.26.0",
3
+ "version": "4.27.1",
4
4
  "description": "Javascript client library for the Duffel API",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.es.js",
@@ -59,7 +59,7 @@
59
59
  "node-fetch": "2.7.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/core": "7.29.7",
62
+ "@babel/core": "8.0.0",
63
63
  "@babel/preset-env": "7.29.7",
64
64
  "@babel/preset-typescript": "7.29.7",
65
65
  "@commitlint/cli": "17.8.1",