Create, retrieve, list, and confirm order cancellations.
Endpoints
POST /air/order_cancellations- Create a cancellationGET /air/order_cancellations/{id}- Get a cancellationGET /air/order_cancellations- List cancellationsPOST /air/order_cancellations/{id}/actions/confirm- Confirm a cancellation
Examples
# Create a cancellation
{:ok, response} = Travel.Flights.OrderCancellations.create(%{
order_id: "ord_123"
})
# Get a cancellation
{:ok, response} = Travel.Flights.OrderCancellations.get("ore_123")
# Confirm a cancellation
{:ok, response} = Travel.Flights.OrderCancellations.confirm("ore_123")
Summary
Functions
Confirm a pending cancellation.
Create an order cancellation.
Get a cancellation by ID.
List order cancellations with optional filtering.
Stream all cancellations with automatic pagination.
Functions
@spec confirm(String.t()) :: {:ok, Travel.Types.DuffelResponse.t()} | {:error, Travel.Error.t() | term()}
Confirm a pending cancellation.
Parameters
cancellation_id- The cancellation ID to confirm
Returns
{:ok, %Travel.Types.DuffelResponse{data: %Types.OrderCancellation{}}}on success{:error, %Travel.Error{}}on failure
@spec create(map()) :: {:ok, Travel.Types.DuffelResponse.t()} | {:error, Travel.Error.t() | term()}
Create an order cancellation.
Parameters
params- Cancellation parameters::order_id- (required) The order ID to cancel
Returns
{:ok, %Travel.Types.DuffelResponse{data: %Types.OrderCancellation{}}}on success{:error, %Travel.Error{}}on failure
@spec get(String.t()) :: {:ok, Travel.Types.DuffelResponse.t()} | {:error, Travel.Error.t() | term()}
Get a cancellation by ID.
Parameters
cancellation_id- The cancellation ID
Returns
{:ok, %Travel.Types.DuffelResponse{data: %Types.OrderCancellation{}}}on success{:error, %Travel.Error{}}on failure
@spec list(map() | nil) :: {:ok, Travel.Types.DuffelResponse.t()} | {:error, Travel.Error.t() | term()}
List order cancellations with optional filtering.
Parameters
opts- Optional parameters (limit,before,after,order_id)
Returns
{:ok, %Travel.Types.DuffelResponse{data: [%Types.OrderCancellation{}]}}on success{:error, %Travel.Error{}}on failure
@spec stream(map() | nil) :: Enumerable.t()
Stream all cancellations with automatic pagination.
Returns
A Stream that yields %Travel.Types.DuffelResponse{} for each page.