Search for accommodation and fetch the rates for a result.
A search returns the cheapest rate per accommodation. To see every
room and rate for one result, call fetch_all_rates/2.
See the Duffel documentation.
Summary
Functions
@spec create(Duffel.Client.t(), map(), keyword()) :: {:ok, map()} | {:error, Duffel.Error.t()}
Searches for accommodation.
Returns a map with "results" (the matching accommodation) and
"created_at". Build the params by hand or with
Duffel.Stays.SearchParams.
Examples
params =
Duffel.Stays.SearchParams.new(
check_in_date: "2026-07-01",
check_out_date: "2026-07-03",
guests: [%{type: "adult"}],
location: Duffel.Stays.SearchParams.around(51.5074, -0.1278)
)
Duffel.Stays.Search.create(client, params)
@spec fetch_all_rates(Duffel.Client.t(), String.t()) :: {:ok, map()} | {:error, Duffel.Error.t()}
Fetches every room and rate for a search result.