An offer request returned in the itineraries shape.
Ask for this shape with view: "itineraries", then decode the response:
{:ok, raw} = Duffel.OfferRequests.get(client, "orq_123", params: [view: "itineraries"])
view = Duffel.Schema.ItineraryView.from_map(raw)Instead of a flat list of offers, the offers are grouped: a slice per slice you searched for, an itinerary per set of identical flights, a brand per fare on those flights, and the priced offers inside each brand. It is also the only shape that carries split-ticket itineraries.
Airlines, places and aircraft appear once under references and are
named by ID everywhere else, which is what makes this shape smaller over
the wire. Use airline/2, place/2 and aircraft/2 to look them up:
slice = hd(view.slices)
Duffel.Schema.ItineraryView.place(view, slice.origin)
#=> %{"iata_code" => "JFK", "type" => "airport"}Segments and the offers inside a brand stay raw maps. Duffel documents the tree but not the fields at those two levels, and a struct would drop what it does not know about.
Summary
Functions
Looks up an aircraft by ID. Returns nil when the response does not
name it.
Looks up an airline by the ID used elsewhere in the tree, such as an
offer's "owner". Returns nil when the response does not name it.
Decodes a raw itineraries-shaped offer request into a Duffel.Schema.ItineraryView.
Looks up a place — an airport or a city — by ID, such as a slice's
origin. Returns nil when the response does not name it.
Types
@type t() :: %Duffel.Schema.ItineraryView{ id: String.t() | nil, references: map(), slices: [Duffel.Schema.ItineraryView.Slice.t()] }
Functions
Looks up an aircraft by ID. Returns nil when the response does not
name it.
Looks up an airline by the ID used elsewhere in the tree, such as an
offer's "owner". Returns nil when the response does not name it.
Decodes a raw itineraries-shaped offer request into a Duffel.Schema.ItineraryView.
Looks up a place — an airport or a city — by ID, such as a slice's
origin. Returns nil when the response does not name it.