Duffel.BatchOfferRequests (Duffel v0.1.0)

Copy Markdown View Source

Batched flight search: create returns immediately with total_batches; poll get/3 to receive offers batch by batch as airlines respond.

get/3 long-polls until the next batch is available or all batches have been returned.

See the Duffel documentation.

Summary

Functions

Creates a batch offer request.

Long-polls for the next batch of offers.

Functions

create(client, params, opts \\ [])

@spec create(Duffel.Client.t(), map(), keyword()) ::
  {:ok, map()} | {:error, Duffel.Error.t()}

Creates a batch offer request.

Takes the same search parameters as Duffel.OfferRequests.create/3.

Options

  • :params - query string parameters, e.g. params: [supplier_timeout: 10_000]

get(client, id, opts \\ [])

@spec get(Duffel.Client.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, Duffel.Error.t()}

Long-polls for the next batch of offers.

Call repeatedly until remaining_batches reaches zero.

Options

  • :params - query string parameters. view: "itineraries" groups the offers into slices, itineraries and brands with shared airlines, places and aircraft in top-level reference maps, instead of the flat list of offers view: "offers" (the default) returns

Examples

Duffel.BatchOfferRequests.get(client, "brq_123", params: [view: "itineraries"])

Decode that shape with Duffel.Schema.ItineraryView.from_map/1.