Skip to content

feat(offer-requests): expose split-ticket itineraries#1165

Open
todor-a wants to merge 2 commits into
duffelhq:mainfrom
todor-a:feat-split-ticket-itineraries
Open

feat(offer-requests): expose split-ticket itineraries#1165
todor-a wants to merge 2 commits into
duffelhq:mainfrom
todor-a:feat-split-ticket-itineraries

Conversation

@todor-a

@todor-a todor-a commented May 28, 2026

Copy link
Copy Markdown

Exposes the split-ticket itineraries flow on POST /air/offer_requests.

  • CreateOfferRequest.include_split_ticket?: boolean — opts into the per-slice fan-out.
  • CreateOfferRequestQueryParameters.view?: 'offers' | 'itineraries'itineraries returns offers grouped per slice / itinerary / fare brand; required to surface split-ticket candidates.
  • New response types: OfferRequestItinerariesView, OfferRequestItinerariesViewSlice, Itinerary, ItineraryBrand, ItineraryOffer, ItineraryOfferType ('single_ticket' | 'split_ticket').
  • OfferRequests.create returns a conditional type so view: 'itineraries' callers get the grouped shape; the existing return_offers: false discriminator is preserved.

Pricing and booking re-use the existing Offers.get / Orders.create resources.

const { data } = await duffel.offerRequests.create({
  cabin_class: 'economy',
  passengers: [{ type: 'adult' }],
  slices: [/* ... */],
  include_split_ticket: true,
  view: 'itineraries',
})
// data.slices[].itineraries[].brands[].offers[].type === 'split_ticket' | 'single_ticket'

Tests: 3 new specs in OfferRequests.spec.ts (body forwarding, query forwarding + response parsing, no view leak when omitted). Full suite 138/138, tsc --noEmit clean, lint clean.

Note: origin / destination on the itineraries-view slice are typed as Place to match OfferRequestSlice; the guide's abbreviated example shows bare ID strings — worth a check against a live response.

@todor-a todor-a requested a review from a team as a code owner May 28, 2026 15:46
todor-a added 2 commits June 9, 2026 15:07
Adds support for the split-ticket itineraries flow on POST /air/offer_requests:

- New body field `include_split_ticket` on `CreateOfferRequest`, which
  opts a multi-slice offer request into the per-slice fan-out the API
  performs to find split-ticket candidates.
- New `view` query parameter (`'offers' | 'itineraries'`) on
  `CreateOfferRequestQueryParameters`. When set to `itineraries`, the
  response is grouped per slice into itineraries and fare brands.
- New response types covering the itineraries view:
  `OfferRequestItinerariesView`, `OfferRequestItinerariesViewSlice`,
  `Itinerary`, `ItineraryBrand`, `ItineraryOffer` and the
  `ItineraryOfferType` discriminator (`'single_ticket' | 'split_ticket'`).
- `OfferRequests.create` returns a conditional type based on the
  `view` parameter so itineraries-view callers get the grouped shape
  and offers-view callers retain the existing typing (including the
  `return_offers: false` discriminator).

See https://duffel.com/docs/guides/selling-split-ticket-itineraries.
@todor-a todor-a force-pushed the feat-split-ticket-itineraries branch from 1df2cc1 to ffab103 Compare June 9, 2026 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants