Documentation ¶
Overview ¶
Order change flow: 1. Get an existing order by ID using client.GetOrder(...) 2. Create a new order change request using client.CreateOrderChangeRequest(...) 3. Get the order change offer using client.CreatePendingOrderChange(...)
Index ¶
- Constants
- Variables
- func Collect[T any](it *Iter[T]) ([]*T, error)
- func ErrIsRetryable(err error) bool
- func IsErrorCode(err error, code ErrorCode) bool
- func IsErrorType(err error, typ ErrorType) bool
- func RequestIDFromError(err error) (string, bool)
- type API
- func (a *API) Cities(ctx context.Context) *Iter[City]
- func (a *API) City(ctx context.Context, id string) (*City, error)
- func (a *API) ConfirmOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error)
- func (a *API) ConfirmOrderChange(ctx context.Context, orderChangeRequestID string, payment PaymentCreateInput) (*OrderChange, error)
- func (a *API) CreateOfferRequest(ctx context.Context, requestInput OfferRequestInput) (*OfferRequest, error)
- func (a *API) CreateOrder(ctx context.Context, input CreateOrderInput) (*Order, error)
- func (a *API) CreateOrderCancellation(ctx context.Context, orderID string) (*OrderCancellation, error)
- func (a *API) CreateOrderChangeRequest(ctx context.Context, params OrderChangeRequestParams) (*OrderChangeRequest, error)
- func (a *API) CreatePayment(ctx context.Context, req CreatePaymentRequest) (*Payment, error)
- func (a *API) CreatePendingOrderChange(ctx context.Context, offerID string) (*OrderChange, error)
- func (a *API) GetAircraft(ctx context.Context, id string) (*Aircraft, error)
- func (a *API) GetAirline(ctx context.Context, id string) (*Airline, error)
- func (a *API) GetAirport(ctx context.Context, id string) (*Airport, error)
- func (a *API) GetOffer(ctx context.Context, offerID string, params ...GetOfferParams) (*Offer, error)
- func (a *API) GetOfferRequest(ctx context.Context, id string) (*OfferRequest, error)
- func (a *API) GetOrder(ctx context.Context, id string) (*Order, error)
- func (a *API) GetOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error)
- func (a *API) GetOrderChangeRequest(ctx context.Context, orderChangeRequestID string) (*OrderChangeRequest, error)
- func (a *API) GetSeatmap(ctx context.Context, offerID string) ([]*Seatmap, error)
- func (a *API) LastRequestID() (string, bool)
- func (a *API) ListAircraft(ctx context.Context) *Iter[Aircraft]
- func (a *API) ListAirlines(ctx context.Context) *Iter[Airline]
- func (a *API) ListAirports(ctx context.Context, params ...ListAirportsParams) *Iter[Airport]
- func (a *API) ListOfferRequests(ctx context.Context) *Iter[OfferRequest]
- func (a *API) ListOffers(ctx context.Context, offerRequestID string, options ...ListOffersParams) *Iter[Offer]
- func (a *API) ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order]
- func (a *API) PlaceSuggestions(ctx context.Context, query string) ([]*Place, error)
- func (a *API) SeatmapForOffer(ctx context.Context, offer Offer) ([]*Seatmap, error)
- func (a *API) UpdateOfferPassenger(ctx context.Context, offerRequestID, passengerID string, ...) (*OfferRequestPassenger, error)
- func (a *API) UpdateOrder(ctx context.Context, id string, params OrderUpdateParams) (*Order, error)
- type Aircraft
- type AircraftClient
- type Airline
- type AirlinesClient
- type Airport
- type AirportsClient
- type AvailableService
- type AvailableServiceMetadata
- type Baggage
- type BaseSlice
- type Cabin
- type CabinClass
- type ChangeCondition
- type City
- type Conditions
- type CreateOrderInput
- type CreatePayment
- type CreatePaymentRequest
- type Date
- type DateTime
- type Distance
- type Document
- type Duffel
- type DuffelError
- type Duration
- type ElementType
- type EmptyPayload
- type Error
- type ErrorCode
- type ErrorMeta
- type ErrorType
- type Flight
- type Gender
- type GetOfferParams
- type IdentityDocument
- type Iter
- type List
- type ListAirportsParams
- type ListContainer
- type ListMeta
- type ListOffersParams
- type ListOffersSortParam
- type ListOrdersParams
- type ListOrdersSort
- type Location
- type LoyaltyProgrammeAccount
- type Metadata
- type Offer
- type OfferClient
- type OfferPaymentRequirement
- type OfferRequest
- type OfferRequestClient
- type OfferRequestInput
- type OfferRequestPassenger
- type OfferRequestSlice
- type Offers
- type Option
- type Options
- type Order
- type OrderCancellation
- type OrderCancellationClient
- type OrderCancellationRequest
- type OrderChange
- type OrderChangeClient
- type OrderChangeOffer
- type OrderChangeRequest
- type OrderChangeRequestParams
- type OrderClient
- type OrderPassenger
- type OrderPaymentClient
- type OrderType
- type OrderUpdateParams
- type PageFn
- type ParamEncoder
- type PassengerTitle
- type PassengerType
- type PassengerUpdateInput
- type Payload
- type Payment
- type PaymentCreateInput
- type PaymentMethod
- type PaymentStatus
- type PaymentType
- type Place
- type PlaceType
- type PlacesClient
- type RateLimit
- type RequestBuilder
- func (r *RequestBuilder[Req, Resp]) Body(body *Req) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Get(path string, opts ...RequestOption) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Getf(path string, a ...any) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Iter(ctx context.Context) *Iter[Resp]
- func (r *RequestBuilder[Req, Resp]) Patch(path string, body *Req, opts ...RequestOption) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Post(path string, body *Req, opts ...RequestOption) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Postf(path string, a ...any) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Single(ctx context.Context) (*Resp, error)
- func (r *RequestBuilder[Req, Resp]) Slice(ctx context.Context) ([]*Resp, error)
- func (r *RequestBuilder[Req, Resp]) WithOptions(opts ...RequestOption) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) WithParam(key, value string) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) WithParams(obj ...ParamEncoder[Req]) *RequestBuilder[Req, Resp]
- type RequestMiddleware
- type RequestOption
- type ResponseMiddleware
- type ResponsePayload
- type Row
- type Seat
- type SeatSection
- type Seatmap
- type SeatmapClient
- type SectionElement
- type SectionService
- type SegmentPassenger
- type Service
- type ServiceCreateInput
- type Slice
- type SliceAdd
- type SliceChange
- type SliceChangeset
- type SliceConditions
- type SliceRemove
- type TimeFilter
- type Wing
Constants ¶
const ( // deprecated PassengerTypeAdult PassengerType = "adult" // deprecated PassengerTypeChild PassengerType = "child" // deprecated PassengerTypeInfantWithoutSeat PassengerType = "infant_without_seat" CabinClassEconomy CabinClass = "economy" CabinClassPremium CabinClass = "premium_economy" CabinClassBusiness CabinClass = "business" CabinClassFirst CabinClass = "first" GenderMale Gender = "m" GenderFemale Gender = "f" PassengerTitleMr PassengerTitle = "mr" PassengerTitleMs PassengerTitle = "ms" PassengerTitleMrs PassengerTitle = "mrs" PassengerTitleMiss PassengerTitle = "miss" PaymentMethodBalance PaymentMethod = "balance" ARCBSPCash PaymentMethod = "arc_bsp_cash" Card PaymentMethod = "card" Voucher PaymentMethod = "voucher" AwaitingPayment PaymentMethod = "awaiting_payment" OriginalFormOfPayment PaymentMethod = "original_form_of_payment" )
const ( AuthenticationError ErrorType = "authentication_error" AirlineError ErrorType = "airline_error" InvalidStateError ErrorType = "invalid_state_error" RateLimitError ErrorType = "rate_limit_error" ValidationError ErrorType = "validation_error" InvalidRequestError ErrorType = "invalid_request_error" ApiError ErrorType = "api_error" // The access token used is not recognized by our system AccessTokenNotFound ErrorCode = "access_token_not_found" // The airline has responded with an internal error, please contact support AirlineInternal ErrorCode = "airline_internal" // The airline responded with an unexpected error, please contact support AirlineUnknown ErrorCode = "airline_unknown" // Requested ancillary service item(s) (e.g. seats) are no longer available, please update your requested services or create a new offer request AncillaryServiceNotAvailable ErrorCode = "ancillary_service_not_available" // The provided order has already been cancelled AlreadyCancelled ErrorCode = "already_cancelled" // The request was unacceptable BadRequest ErrorCode = "bad_request" // A booking with the same details was already found for the selected itinerary, please select another offer DuplicateBooking ErrorCode = "duplicate_booking" // The order cannot contain more than one passenger with with the same name DuplicatePassengerName ErrorCode = "duplicate_passenger_name" // The provided access token has expired ExpiredAccessToken ErrorCode = "expired_access_token" // There wasn't enough balance in the wallet for the operation - for example, you booked a flight for £300 with only £200 available in the wallet InsufficientBalance ErrorCode = "insufficient_balance" // The provided token doesn't have sufficient permissions to perform the requested action InsufficientPermissions ErrorCode = "insufficient_permissions" // There was something wrong on our end, please contact support InternalServerError ErrorCode = "internal_server_error" // The Authorization header must conform to the following format: Bearer API_TOKEN InvalidAuthorizationHeader ErrorCode = "invalid_authorization_header" // The Content-Type should be set to application/json InvalidContentTypeHeader ErrorCode = "invalid_content_type_header" // The data in the request body should be a JSON object InvalidDataParam ErrorCode = "invalid_data_param" // The airline did not recognise the loyalty programme account details for one or more of the passengers InvalidLoyaltyCard ErrorCode = "invalid_loyalty_card" // The Duffel-Version header must be a known version of our API as indicated in our Docs InvalidVersionHeader ErrorCode = "invalid_version_header" // The data in the request body is not valid MalformedDataParam ErrorCode = "malformed_data_param" // The Authorization header must be set and contain a valid API token MissingAuthorizationHeader ErrorCode = "missing_authorization_header" // The Content-Type header needs to be set to application/json MissingContentTypeHeader ErrorCode = "missing_content_type_header" // The data in the request body should be nested under the data key MissingDataParam ErrorCode = "missing_data_param" // The Duffel-Version header is required and must be a valid API version MissingVersionHeader ErrorCode = "missing_version_header" // The resource you are trying to access does not exist NotFound ErrorCode = "not_found" // The provided offer is no longer available, please select another offer or create a new offer request to get the latest availability OfferNoLongerAvailable ErrorCode = "offer_no_longer_available" // Too many requests have hit the API too quickly. Please retry your request after the time specified in the ratelimit-reset header returned to you RateLimitExceeded ErrorCode = "rate_limit_exceeded" UnavailableFeature ErrorCode = "unavailable_feature" // The resource does not support the following action UnsupportedAction ErrorCode = "unsupported_action" // The API does not support the format set in the Accept header, please use a supported format UnsupportedFormat ErrorCode = "unsupported_format" // The version set to the Duffel-Version header is no longer supported by the API, please upgrade UnsupportedVersion ErrorCode = "unsupported_version" )
const ( ListOrdersSortPaymentRequiredByAsc ListOrdersSort = "payment_required_by" ListOrdersSortPaymentRequiredByDesc ListOrdersSort = "-payment_required_by" OrderTypeHold OrderType = "hold" OrderTypeInstant OrderType = "instant" )
const ( PaymentTypeBalance = PaymentType("balance") PaymentTypeCash = PaymentType("arc_bsp_cash") )
const DateFormat = "2006-01-02"
const PlaceTypeAirport = "airport"
const PlaceTypeCity = "city"
const RequestIDHeader = "x-request-id"
Variables ¶
var ErrNullValue = fmt.Errorf("null value")
Functions ¶
func ErrIsRetryable ¶ added in v0.2.4
ErrIsRetryable returns true if the request that generated this error is retryable.
func IsErrorCode ¶ added in v0.2.3
IsErrorCode is a concenience method to check if an error is a specific error code from Duffel. This simplifies error handling branches without needing to type cast multiple times in your code.
func IsErrorType ¶ added in v0.2.3
IsErrorType is a concenience method to check if an error is a specific error type from Duffel. This simplifies error handling branches without needing to type cast multiple times in your code.
func RequestIDFromError ¶ added in v0.2.4
RequestIDFromError returns the request ID from the error. Use this when contacting Duffel support for non-retryable errors such as `AirlineInternal` or `AirlineUnknown`.
Types ¶
type API ¶
type API struct { APIToken string // contains filtered or unexported fields }
func (*API) ConfirmOrderCancellation ¶ added in v0.2.0
func (a *API) ConfirmOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error)
func (*API) ConfirmOrderChange ¶ added in v0.2.0
func (a *API) ConfirmOrderChange(ctx context.Context, orderChangeRequestID string, payment PaymentCreateInput) (*OrderChange, error)
func (*API) CreateOfferRequest ¶
func (a *API) CreateOfferRequest(ctx context.Context, requestInput OfferRequestInput) (*OfferRequest, error)
func (*API) CreateOrder ¶
func (a *API) CreateOrder(ctx context.Context, input CreateOrderInput) (*Order, error)
CreateOrder creates a new order.
func (*API) CreateOrderCancellation ¶ added in v0.2.0
func (a *API) CreateOrderCancellation(ctx context.Context, orderID string) (*OrderCancellation, error)
func (*API) CreateOrderChangeRequest ¶ added in v0.2.0
func (a *API) CreateOrderChangeRequest(ctx context.Context, params OrderChangeRequestParams) (*OrderChangeRequest, error)
func (*API) CreatePayment ¶ added in v0.2.2
func (a *API) CreatePayment(ctx context.Context, req CreatePaymentRequest) (*Payment, error)
func (*API) CreatePendingOrderChange ¶ added in v0.2.0
func (a *API) CreatePendingOrderChange(ctx context.Context, offerID string) (*OrderChange, error)
func (*API) GetAircraft ¶
func (*API) GetOffer ¶
func (a *API) GetOffer(ctx context.Context, offerID string, params ...GetOfferParams) (*Offer, error)
GetOffer gets a single offer by ID.
func (*API) GetOfferRequest ¶
func (a *API) GetOfferRequest(ctx context.Context, id string) (*OfferRequest, error)
func (*API) GetOrderCancellation ¶ added in v0.2.0
func (a *API) GetOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error)
func (*API) GetOrderChangeRequest ¶ added in v0.2.0
func (a *API) GetOrderChangeRequest(ctx context.Context, orderChangeRequestID string) (*OrderChangeRequest, error)
func (*API) GetSeatmap ¶ added in v0.4.3
func (*API) LastRequestID ¶ added in v0.4.2
func (*API) ListAirports ¶
func (a *API) ListAirports(ctx context.Context, params ...ListAirportsParams) *Iter[Airport]
func (*API) ListOfferRequests ¶
func (a *API) ListOfferRequests(ctx context.Context) *Iter[OfferRequest]
func (*API) ListOffers ¶
func (a *API) ListOffers(ctx context.Context, offerRequestID string, options ...ListOffersParams) *Iter[Offer]
ListOffers lists all the offers for an offer request. Returns an iterator.
func (*API) ListOrders ¶
func (a *API) ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order]
func (*API) PlaceSuggestions ¶ added in v0.3.1
func (*API) SeatmapForOffer ¶ added in v0.4.3
func (*API) UpdateOfferPassenger ¶
func (a *API) UpdateOfferPassenger(ctx context.Context, offerRequestID, passengerID string, input PassengerUpdateInput) (*OfferRequestPassenger, error)
UpdateOfferPassenger updates a single offer passenger.
func (*API) UpdateOrder ¶
type AircraftClient ¶
type AirlinesClient ¶
type Airport ¶
type Airport struct { ID string `json:"id" ` Name string `json:"name" ` City City `json:"city,omitempty" ` CityName string `json:"city_name" ` IATACode string `json:"iata_code" ` IATACountryCode string `json:"iata_country_code" ` ICAOCode string `json:"icao_code" ` Latitude float32 `json:"latitude" ` Longitude float32 `json:"longitude" ` TimeZone string `json:"time_zone" ` }
type AirportsClient ¶
type AvailableService ¶ added in v0.4.6
type AvailableService struct { // Duffel's unique identifier for service ID string `json:"id"` MaximumQuantity int `json:"maximum_quantity"` Metadata AvailableServiceMetadata `json:"metadata"` PassengerIDs []string `json:"passenger_ids"` SegmentIDs []string `json:"segment_ids"` RawTotalAmount string `json:"total_amount"` RawTotalCurrency string `json:"total_currency"` // Possible values: "baggage" Type string `json:"type"` }
type AvailableServiceMetadata ¶ added in v0.4.6
type AvailableServiceMetadata struct { MaximumDepthCM int `json:"maximum_depth_cm,omitempty"` MaximumHeightCM int `json:"maximum_height_cm,omitempty"` MaximumLengthCM int `json:"maximum_length_cm,omitempty"` MaximumWeightKg int `json:"maximum_weight_kg,omitempty"` // Possible values: "checked", "carry_on" Type string `json:"type"` }
type Cabin ¶
type Cabin struct { Aisles int `json:"aisles"` CabinClass CabinClass `json:"cabin_class"` Deck int `json:"deck"` // A list of rows in this cabin. Rows []Row `json:"rows"` // Where the wings of the aircraft are in relation to rows in the cabin. Wings Wing `json:"wings"` }
type CabinClass ¶
type CabinClass string
func (CabinClass) String ¶ added in v0.2.0
func (p CabinClass) String() string
type ChangeCondition ¶
type ChangeCondition struct { Allowed bool `json:"allowed"` RawPenaltyAmount *string `json:"penalty_amount,omitempty"` RawPenaltyCurrency *string `json:"penalty_currency,omitempty"` }
func (*ChangeCondition) PenaltyAmount ¶
func (c *ChangeCondition) PenaltyAmount() *currency.Amount
type Conditions ¶
type Conditions struct { RefundBeforeDeparture *ChangeCondition `json:"refund_before_departure,omitempty"` ChangeBeforeDeparture *ChangeCondition `json:"change_before_departure,omitempty"` }
type CreateOrderInput ¶
type CreateOrderInput struct { Type OrderType `json:"type"` // Metadata contains a set of key-value pairs that you can attach to an object. // It can be useful for storing additional information about the object, in a // structured format. Duffel does not use this information. // // You should not store sensitive information in this field. Metadata Metadata `json:"metadata,omitempty"` // The personal details of the passengers, expanding on // the information initially provided when creating the offer request. Passengers []OrderPassenger `json:"passengers"` Payments []PaymentCreateInput `json:"payments,omitempty"` // The ids of the offers you want to book. You must specify an array containing exactly one selected offer. SelectedOffers []string `json:"selected_offers"` Services []ServiceCreateInput `json:"services,omitempty"` }
type CreatePayment ¶ added in v0.2.2
type CreatePayment struct { Amount string `json:"amount"` Currency string `json:"currency"` Type PaymentType `json:"type"` }
type CreatePaymentRequest ¶ added in v0.2.2
type CreatePaymentRequest struct { OrderID string `json:"order_id"` Payment CreatePayment `json:"payment"` }
type Date ¶
func (Date) MarshalJSON ¶
func (*Date) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler from date string to time.Time
type DateTime ¶
func (DateTime) MarshalJSON ¶
func (*DateTime) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler from date string to time.Time
type Distance ¶
type Distance float64
func (Distance) MarshalJSON ¶
func (*Distance) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler from date string to time.Time
type Duffel ¶
type Duffel interface { OfferRequestClient OfferClient OrderClient OrderChangeClient OrderCancellationClient OrderPaymentClient SeatmapClient AirportsClient AirlinesClient AircraftClient PlacesClient LastRequestID() (string, bool) }
type DuffelError ¶
type DuffelError struct { Meta ErrorMeta `json:"meta"` Errors []Error `json:"errors"` StatusCode int `json:"-"` Retryable bool `json:"-"` }
func (*DuffelError) Error ¶
func (e *DuffelError) Error() string
func (*DuffelError) IsCode ¶
func (e *DuffelError) IsCode(t ErrorCode) bool
func (*DuffelError) IsType ¶
func (e *DuffelError) IsType(t ErrorType) bool
type Duration ¶
func (Duration) MarshalGQL ¶ added in v0.2.2
MarshalGQL implements the graphql.Marshaler interface
func (Duration) MarshalJSON ¶
func (*Duration) UnmarshalGQL ¶ added in v0.2.2
UnmarshalGQL implements the graphql.Unmarshaler interface
func (*Duration) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler from date string to time.Time
type ElementType ¶
type ElementType string
const ( ElementTypeSeat ElementType = "seat" ElementTypeBassinet ElementType = "bassinet" ElementTypeEmpty ElementType = "empty" ElementTypeExitRow ElementType = "exit_row" ElementTypeLavatory ElementType = "lavatory" ElementTypeGalley ElementType = "galley" ElementTypeCloset ElementType = "closet" ElementTypeStairs ElementType = "stairs" )
func (ElementType) String ¶
func (e ElementType) String() string
type EmptyPayload ¶
type EmptyPayload struct{}
type Flight ¶
type Flight struct { ID string `json:"id"` Passengers []SegmentPassenger `json:"passengers"` Origin Location `json:"origin"` OriginTerminal string `json:"origin_terminal"` OperatingCarrierFlightNumber string `json:"operating_carrier_flight_number"` OperatingCarrier Airline `json:"operating_carrier"` MarketingCarrierFlightNumber string `json:"marketing_carrier_flight_number"` MarketingCarrier Airline `json:"marketing_carrier"` Duration Duration `json:"duration"` Distance Distance `json:"distance,omitempty"` DestinationTerminal string `json:"destination_terminal"` Destination Location `json:"destination"` RawDepartingAt string `json:"departing_at"` RawArrivingAt string `json:"arriving_at"` Aircraft *Aircraft `json:"aircraft,omitempty"` }
type GetOfferParams ¶ added in v0.2.0
type GetOfferParams struct {
ReturnAvailableServices bool
}
type IdentityDocument ¶
type IdentityDocument struct { // The unique identifier of the identity document. // We currently only support passport so this would be the passport number. UniqueIdentifier string `json:"unique_identifier"` // The date on which the identity document expires ExpiresOn Date `json:"expires_on"` // The ISO 3166-1 alpha-2 code of the country that issued this identity document IssuingCountryCode string `json:"issuing_country_code"` Type string `json:"type"` }
type Iter ¶
type Iter[T any] struct { // contains filtered or unexported fields }
Iter is an iterator for a list of items. Based on the iterator used in https://github.com/stripe/stripe-go
func (*Iter[T]) Current ¶
func (it *Iter[T]) Current() *T
Current returns the most recent item visited by a call to Next.
func (*Iter[T]) Err ¶
Err returns the error, if any, that caused the Iter to stop. It must be inspected after Next returns false.
func (*Iter[T]) LastRequestID ¶ added in v0.4.2
func (*Iter[T]) List ¶
func (it *Iter[T]) List() ListContainer[T]
List returns the current list object which the iterator is currently using. List objects will change as new API calls are made to continue pagination.
type ListAirportsParams ¶
type ListAirportsParams struct {
IATACountryCode string `url:"iata_country_code,omitempty"`
}
type ListContainer ¶
type ListContainer[T any] interface { SetListMeta(*ListMeta) GetListMeta() *ListMeta GetItems() []*T SetItems(items []*T) LastRequestID() (string, bool) }
ListContainer is a general interface for which all list object structs should comply. They achieve this by embedding a ListMeta struct and inheriting its implementation of this interface.
type ListMeta ¶
type ListMeta struct { // After is a string that contains the token for the next page of results After string `json:"after,omitempty" url:"after,omitempty"` // Before is a string that contains the token for the previous page of results Before string `json:"before,omitempty" url:"-"` // Limit is a number that indicates the maximum number of items to return Limit int `json:"limit,omitempty" url:"limit,omitempty"` }
ListMeta is the structure that contains the common properties of List iterators.
func (*ListMeta) GetListMeta ¶
GetListMeta returns a ListMeta struct (itself). It exists because any structs that embed ListMeta will inherit it, and thus implement the ListContainer interface.
type ListOffersParams ¶
type ListOffersParams struct { Sort ListOffersSortParam `url:"sort,omitempty"` MaxConnections int `url:"max_connections,omitempty"` }
type ListOffersSortParam ¶
type ListOffersSortParam string
const ( ListOffersSortTotalAmount ListOffersSortParam = "total_amount" ListOffersSortTotalDuration ListOffersSortParam = "total_duration" )
type ListOrdersParams ¶
type ListOrdersParams struct { // Filters orders by their booking reference. // The filter requires an exact match but is case insensitive. BookingReference string `url:"booking_reference,omitempty"` // Whether to filter orders that are awaiting payment or not. // If not specified, all orders regardless of their payment state will be returned. AwaitingPayment bool `url:"awaiting_payment,omitempty"` // By default, orders aren't returned in any specific order. // This parameter allows you to sort the list of orders by the payment_required_by date Sort ListOrdersSort `url:"sort,omitempty"` // Filters the returned orders by owner.id. Values must be valid airline.ids. // Check the Airline schema for details. OwnerIDs []string `url:"owner_id,omitempty"` // Filters the returned orders by origin. Values must be valid origin identifiers. // Check the Order schema for details. OriginIDs []string `url:"origin_id,omitempty"` // Filters the returned orders by destination. Values must be valid destination identifiers. // Check the Order schema for details. DestinationIDs []string `url:"destination_id,omitempty"` // Filters the returned orders by departure datetime. // Orders will be included if any of their segments matches the given criteria DepartingAt *TimeFilter `url:"departing_at,omitempty"` // Filters the returned orders by arrival datetime. // Orders will be included if any of their segments matches the given criteria. ArrivingAt *TimeFilter `url:"arriving_at,omitempty"` // Filters the returned orders by creation datetime. CreatedAt *TimeFilter `url:"created_at,omitempty"` // Orders will be included if any of their passengers matches any of the given names. // Matches are case insensitive, and include partial matches. PassengerNames []string `url:"passenger_name,omitempty"` }
type ListOrdersSort ¶
type ListOrdersSort string
type Location ¶
type Location struct { ID string `json:"id"` Type string `json:"type"` Name string `json:"name"` TimeZone string `json:"time_zone,omitempty"` Longitude *float64 `json:"longitude,omitempty"` Latitude *float64 `json:"latitude,omitempty"` ICAOCode string `json:"icao_code,omitempty"` IATACountryCode *string `json:"iata_country_code,omitempty"` IATACode string `json:"iata_code,omitempty"` IATACityCode *string `json:"iata_city_code,omitempty"` CityName *string `json:"city_name,omitempty"` City *City `json:"city,omitempty"` Airports []Airport `json:"airports,omitempty"` }
type LoyaltyProgrammeAccount ¶
type Offer ¶
type Offer struct { ID string `json:"id"` LiveMode bool `json:"live_mode"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` ExpiresAt time.Time `json:"expires_at"` TotalEmissionsKg string `json:"total_emissions_kg"` RawTotalCurrency string `json:"total_currency"` RawTotalAmount string `json:"total_amount"` RawTaxAmount string `json:"tax_amount"` RawTaxCurrency string `json:"tax_currency"` RawBaseAmount string `json:"base_amount"` RawBaseCurrency string `json:"base_currency"` Owner Airline `json:"owner"` Slices []Slice `json:"slices"` Passengers []OfferRequestPassenger `json:"passengers"` Partial bool `json:"partial"` PassengerIdentityDocumentsRequired bool `json:"passenger_identity_documents_required"` AllowedPassengerIdentityDocumentTypes []string `json:"allowed_passenger_identity_document_types"` PaymentRequirements OfferPaymentRequirement `json:"payment_requirements"` AvailableServices []AvailableService `json:"available_services"` Conditions Conditions `json:"conditions"` }
func (*Offer) BaseAmount ¶ added in v0.4.4
func (*Offer) TotalAmount ¶
type OfferClient ¶
type OfferClient interface { UpdateOfferPassenger(ctx context.Context, offerRequestID, passengerID string, input PassengerUpdateInput) (*OfferRequestPassenger, error) ListOffers(ctx context.Context, reqId string, options ...ListOffersParams) *Iter[Offer] GetOffer(ctx context.Context, id string, params ...GetOfferParams) (*Offer, error) }
type OfferPaymentRequirement ¶ added in v0.2.2
type OfferRequest ¶
type OfferRequest struct { ID string `json:"id"` LiveMode bool `json:"live_mode"` CreatedAt time.Time `json:"created_at"` Slices []BaseSlice `json:"slices"` Passengers []OfferRequestPassenger `json:"passengers"` CabinClass CabinClass `json:"cabin_class"` Offers []Offer `json:"offers"` }
OfferRequest is the response from the OfferRequest endpoint, created using the OfferRequestInput.
type OfferRequestClient ¶
type OfferRequestClient interface { CreateOfferRequest(ctx context.Context, requestInput OfferRequestInput) (*OfferRequest, error) GetOfferRequest(ctx context.Context, id string) (*OfferRequest, error) ListOfferRequests(ctx context.Context) *Iter[OfferRequest] }
type OfferRequestInput ¶
type OfferRequestInput struct { // The passengers who want to travel. If you specify an age for a passenger, the type may differ for the same passenger in different offers due to airline's different rules. e.g. one airline may treat a 14 year old as an adult, and another as a young adult. You may only specify an age or a type – not both. Passengers []OfferRequestPassenger `json:"passengers" url:"-"` // The slices that make up this offer request. One-way journeys can be expressed using one slice, whereas return trips will need two. Slices []OfferRequestSlice `json:"slices" url:"-"` // The cabin that the passengers want to travel in CabinClass CabinClass `json:"cabin_class" url:"-"` // The maximum number of connections within any slice of the offer. For example 0 means a direct flight which will have a single segment within each slice and 1 means a maximum of two segments within each slice of the offer. MaxConnections *int `json:"max_connections,omitempty" url:"-"` // When set to true, the offer request resource returned will include all the offers returned by the airlines ReturnOffers bool `json:"-" url:"return_offers"` // The maximum amount of time in milliseconds to wait for each airline to respond SupplierTimeout int `json:"-" url:"supplier_timeout,omitempty"` }
type OfferRequestPassenger ¶
type OfferRequestPassenger struct { ID string `json:"id,omitempty"` FamilyName string `json:"family_name,omitempty"` GivenName string `json:"given_name,omitempty"` Age int `json:"age,omitempty"` LoyaltyProgrammeAccounts []LoyaltyProgrammeAccount `json:"loyalty_programme_accounts,omitempty"` // deprecated Type PassengerType `json:"type,omitempty"` }
type OfferRequestSlice ¶
type Offers ¶
type Offers []Offer
Offers is slice of offers that implement the sort.Sort interface By default, offers are sorted cheapest first.
type Option ¶
type Option func(*Options)
func WithAPIVersion ¶
WithVersion allows you to specify "Duffel-Version" header for the API version that you are targeting.
func WithDebug ¶ added in v0.2.2
func WithDebug() Option
WithDebug enables debug logging of requests and responses. DO NOT USE IN PRODUCTION.
func WithDefaultAPI ¶
func WithDefaultAPI() Option
WithAPIToken sets the API host to the default Duffel production host.
func WithHTTPClient ¶
WithHTTPClient allows you to specify a custom http.Client to use for making requests. This is useful if you want to use a custom transport or proxy.
func WithUserAgent ¶
WithUserAgent allows you to specify a custom user agent string to use for making requests.
type Order ¶
type Order struct { ID string `json:"id"` LiveMode bool `json:"live_mode"` Metadata Metadata `json:"metadata"` RawBaseAmount *string `json:"base_amount,omitempty"` RawBaseCurrency *string `json:"base_currency,omitempty"` BookingReference string `json:"booking_reference"` CancelledAt *time.Time `json:"cancelled_at,omitempty"` CreatedAt time.Time `json:"created_at"` Conditions Conditions `json:"conditions,omitempty"` Documents []Document `json:"documents,omitempty"` Owner Airline `json:"owner"` Passengers []OrderPassenger `json:"passengers,omitempty"` PaymentStatus PaymentStatus `json:"payment_status"` Services []Service `json:"services,omitempty"` Slices []Slice `json:"slices,omitempty"` SyncedAt time.Time `json:"synced_at"` RawTaxAmount *string `json:"tax_amount,omitempty"` RawTaxCurrency *string `json:"tax_currency,omitempty"` RawTotalAmount string `json:"total_amount"` RawTotalCurrency string `json:"total_currency"` }
func (*Order) BaseAmount ¶
func (*Order) TotalAmount ¶
type OrderCancellation ¶ added in v0.2.0
type OrderCancellation struct { ID string `json:"id"` OrderID string `json:"order_id"` RefundTo PaymentMethod `json:"refund_to"` RawRefundCurrency string `json:"refund_currency"` RawRefundAmount string `json:"refund_amount"` ExpiresAt string `json:"expires_at"` CreatedAt string `json:"created_at"` ConfirmedAt string `json:"confirmed_at"` LiveMode bool `json:"live_mode"` }
OrderCancellationRequest is response from the OrderCancellation API.
Once you've created a pending order cancellation, you'll know the `refund_amount` you're due to get back.
To actually cancel the order, you'll need to confirm the cancellation. The booking with the airline will be cancelled, and the `refund_amount` will be returned to the original payment method (i.e. your Duffel balance). You'll then need to refund your customer (e.g. back to their credit/debit card).
func (*OrderCancellation) RefundAmount ¶ added in v0.2.0
func (o *OrderCancellation) RefundAmount() currency.Amount
type OrderCancellationClient ¶ added in v0.2.0
type OrderCancellationClient interface { CreateOrderCancellation(ctx context.Context, orderID string) (*OrderCancellation, error) ConfirmOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error) GetOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error) }
OrderCancellationClient
type OrderCancellationRequest ¶ added in v0.2.0
type OrderCancellationRequest struct {
OrderID string `json:"order_id"`
}
type OrderChange ¶ added in v0.2.0
type OrderChange struct { ID string `json:"id"` OrderID string `json:"order_id"` Slices SliceChangeset `json:"slices"` RefundTo PaymentMethod `json:"refund_to"` RawPenaltyTotalCurrency string `json:"penalty_total_currency"` RawPenaltyTotalAmount string `json:"penalty_total_amount"` RawNewTotalCurrency string `json:"new_total_currency"` RawNewTotalAmount string `json:"new_total_amount"` RawChangeTotalCurrency string `json:"change_total_currency"` RawChangeTotalAmount string `json:"change_total_amount"` ExpiresAt string `json:"expires_at"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` LiveMode bool `json:"live_mode"` }
type OrderChangeClient ¶ added in v0.2.0
type OrderChangeClient interface { CreateOrderChangeRequest(ctx context.Context, params OrderChangeRequestParams) (*OrderChangeRequest, error) GetOrderChangeRequest(ctx context.Context, id string) (*OrderChangeRequest, error) CreatePendingOrderChange(ctx context.Context, orderChangeRequestID string) (*OrderChange, error) ConfirmOrderChange(ctx context.Context, id string, payment PaymentCreateInput) (*OrderChange, error) }
type OrderChangeOffer ¶ added in v0.2.0
type OrderChangeOffer struct { ID string `json:"id"` // OrderChangeID is the ID for an order change if one has already been created from this order change offer OrderChangeID string `json:"order_change_id"` Slices SliceChangeset `json:"slices"` RefundTo PaymentMethod `json:"refund_to"` RawPenaltyTotalCurrency string `json:"penalty_total_currency"` RawPenaltyTotalAmount string `json:"penalty_total_amount"` RawNewTotalCurrency string `json:"new_total_currency"` RawNewTotalAmount string `json:"new_total_amount"` RawChangeTotalCurrency string `json:"change_total_currency"` RawChangeTotalAmount string `json:"change_total_amount"` ExpiresAt time.Time `json:"expires_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` LiveMode bool `json:"live_mode"` }
func (*OrderChangeOffer) ChangeTotalAmount ¶ added in v0.2.0
func (o *OrderChangeOffer) ChangeTotalAmount() currency.Amount
func (*OrderChangeOffer) NewTotalAmount ¶ added in v0.2.0
func (o *OrderChangeOffer) NewTotalAmount() currency.Amount
func (*OrderChangeOffer) PenaltyTotalAmount ¶ added in v0.2.0
func (o *OrderChangeOffer) PenaltyTotalAmount() currency.Amount
PenaltyTotalAmount returns the penalty imposed by the airline for making this change.
type OrderChangeRequest ¶ added in v0.2.0
type OrderChangeRequest struct { ID string `json:"id"` OrderID string `json:"order_id"` Slices SliceChange `json:"slices"` OrderChangeOffers []OrderChangeOffer `json:"order_change_offers"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` LiveMode bool `json:"live_mode"` }
OrderChangeRequest is the input to the OrderChange API. To change an order, you'll need to create an order change request. An order change request describes the slices of an existing paid order that you want to remove and search criteria for new slices you want to add.
type OrderChangeRequestParams ¶ added in v0.2.0
type OrderChangeRequestParams struct { OrderID string `json:"order_id"` Slices SliceChange `json:"slices,omitempty"` }
type OrderClient ¶
type OrderClient interface { // Get a single order by ID. GetOrder(ctx context.Context, id string) (*Order, error) // Update a single order by ID. UpdateOrder(ctx context.Context, id string, params OrderUpdateParams) (*Order, error) // List orders. ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order] // Create an order. CreateOrder(ctx context.Context, input CreateOrderInput) (*Order, error) }
type OrderPassenger ¶
type OrderPassenger struct { // ID is id of the passenger, returned when the offer request was created ID string `json:"id"` // Title is passengers' title. Possible values: "mr", "ms", "mrs", or "miss" Title PassengerTitle `json:"title"` // FamilyName is the family name of the passenger. FamilyName string `json:"family_name"` // GivenName is the passenger's given name. GivenName string `json:"given_name"` // BornOn is the passengers DoB according to their travel documents. BornOn Date `json:"born_on"` // Email is the passengers email address. Email string `json:"email"` // Gender is the passengers gender. Gender Gender `json:"gender"` // The passenger's identity documents. You may only provide one identity document per passenger. IdentityDocuments []IdentityDocument `json:"identity_documents,omitempty"` // The `id` of the infant associated with this passenger InfantPassengerID string `json:"infant_passenger_id,omitempty"` // The Loyalty Programme Accounts for this passenger LoyaltyProgrammeAccounts []LoyaltyProgrammeAccount `json:"loyalty_programme_accounts,omitempty"` // (Required) The passenger's phone number in E.164 (international) format PhoneNumber string `json:"phone_number"` // Type is the type of passenger. This field is deprecated. // @Deprecated // Possible values: "adult", "child", or "infant_without_seat" Type PassengerType `json:"type"` }
type OrderPaymentClient ¶ added in v0.2.2
type OrderPaymentClient interface {
CreatePayment(ctx context.Context, req CreatePaymentRequest) (*Payment, error)
}
type OrderUpdateParams ¶
OrderUpdateParams is used as the input to UpdateOrder. Only certain order fields are updateable. Each field that can be updated is detailed in the `OrderUpdateParams` object.
type ParamEncoder ¶ added in v0.2.0
type PassengerTitle ¶
type PassengerTitle string
func (PassengerTitle) String ¶ added in v0.2.0
func (p PassengerTitle) String() string
type PassengerType ¶
type PassengerType string
func (PassengerType) String ¶
func (p PassengerType) String() string
type PassengerUpdateInput ¶
type PassengerUpdateInput struct { FamilyName string `json:"family_name"` GivenName string `json:"given_name"` LoyaltyProgrammeAccounts []LoyaltyProgrammeAccount `json:"loyalty_programme_accounts,omitempty"` }
type PaymentCreateInput ¶
type PaymentCreateInput struct { // The amount of the payment. This should be the same as the total_amount of the offer specified in selected_offers, plus the total_amount of all the services specified in services. Amount string `json:"amount"` // The currency of the amount, as an ISO 4217 currency code. This should be the same as the total_currency of the offer specified in selected_offers. Currency string `json:"currency"` // Possible values: "arc_bsp_cash" or "balance" Type PaymentMethod `json:"type"` }
The payment details to use to pay for the order. This key should be omitted when the order’s type is hold.
type PaymentMethod ¶ added in v0.2.0
type PaymentMethod string
func (PaymentMethod) String ¶ added in v0.2.0
func (p PaymentMethod) String() string
type PaymentStatus ¶
type PaymentStatus struct { AwaitingPayment bool `json:"awaiting_payment"` PaymentRequiredBy *time.Time `json:"payment_required_by,omitempty"` PriceGuaranteeExpiresAt *time.Time `json:"price_guarantee_expires_at,omitempty"` }
The payment status for an order.
type PaymentType ¶ added in v0.2.2
type PaymentType string
type Place ¶ added in v0.3.1
type Place struct { ID string `json:"id"` Airports []*Airport `json:"airports"` City *City `json:"city"` CityName string `json:"city_name"` CountryName string `json:"country_name"` IATACityCode string `json:"iata_city_code"` IATACode string `json:"iata_code"` IATACountryCode string `json:"iata_country_code"` ICAOCode string `json:"icao_code"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` Name string `json:"name"` TimeZone string `json:"time_zone"` Type PlaceType `json:"type"` }
type PlacesClient ¶ added in v0.3.1
type RequestBuilder ¶ added in v0.2.0
func (*RequestBuilder[Req, Resp]) Body ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) Body(body *Req) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) Get ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) Get(path string, opts ...RequestOption) *RequestBuilder[Req, Resp]
Get sets the request method to GET and the request path to the given path. Global request options are applied.
func (*RequestBuilder[Req, Resp]) Getf ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) Getf(path string, a ...any) *RequestBuilder[Req, Resp]
Getf is like Get but accepts a format string and args.
func (*RequestBuilder[Req, Resp]) Iter ¶ added in v0.3.1
func (r *RequestBuilder[Req, Resp]) Iter(ctx context.Context) *Iter[Resp]
Iter finalizes the request and returns an iterator over the response.
func (*RequestBuilder[Req, Resp]) Patch ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) Patch(path string, body *Req, opts ...RequestOption) *RequestBuilder[Req, Resp]
Patch sets the request method to PATCH, the request path to the given path, and the request payload to body. Global request options are applied.
func (*RequestBuilder[Req, Resp]) Post ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) Post(path string, body *Req, opts ...RequestOption) *RequestBuilder[Req, Resp]
Post sets the request method to POST, the request path to the given path, and the request payload to body. Global request options are applied.
func (*RequestBuilder[Req, Resp]) Postf ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) Postf(path string, a ...any) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) Single ¶ added in v0.3.1
func (r *RequestBuilder[Req, Resp]) Single(ctx context.Context) (*Resp, error)
Single finalizes the request and returns a single item response.
func (*RequestBuilder[Req, Resp]) Slice ¶ added in v0.3.1
func (r *RequestBuilder[Req, Resp]) Slice(ctx context.Context) ([]*Resp, error)
Slice finalizes the request and returns the first page of items as a slice along with the error. This is only needed for endpoints without pagination, such as place suggestions.
func (*RequestBuilder[Req, Resp]) WithOptions ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) WithOptions(opts ...RequestOption) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) WithParam ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) WithParam(key, value string) *RequestBuilder[Req, Resp]
WithParam adds a single query param to the URL. These operations will be applied in defined order after the request is initialized.
func (*RequestBuilder[Req, Resp]) WithParams ¶ added in v0.2.0
func (r *RequestBuilder[Req, Resp]) WithParams(obj ...ParamEncoder[Req]) *RequestBuilder[Req, Resp]
WithParams sets the URL query params for the request. These operations will be applied in defined order after the request is initialized.
type RequestMiddleware ¶ added in v0.2.0
type RequestOption ¶
func WithEncodableParams ¶ added in v0.2.0
func WithEncodableParams[T any](params ...ParamEncoder[T]) RequestOption
func WithRequestPagination ¶
func WithRequestPagination(meta *ListMeta) RequestOption
func WithURLParam ¶
func WithURLParam(key, value string) RequestOption
func WithURLParams ¶
func WithURLParams[T any](params ...T) RequestOption
type ResponseMiddleware ¶ added in v0.2.0
type ResponsePayload ¶
type Row ¶
type Row struct { // A list of sections. Each row is divided into sections by one or more aisles. Sections []SeatSection `json:"sections"` }
Row represents a row in a cabin.
type SeatSection ¶
type SeatSection struct { // The elements that make up this section. Elements []SectionElement `json:"elements"` }
SeatSection represents a section of a row.
type SeatmapClient ¶
type SectionElement ¶
type SectionElement struct { // The element type, e.g. seat, exit_row, stairs, etc. Type ElementType `json:"type"` // Seats are considered a special kind of service. // There will be at most one service per seat per passenger. // A seat can only be booked for one passenger. If a seat has no available services (which will be represented as an empty list : []) then it's unavailable. AvailableServices []SectionService `json:"available_services"` // The designator used to uniquely identify the seat, usually made up of a row number and a column letter Designator string `json:"designator"` // Each disclosure is text, in English, provided by the airline that describes the terms and conditions of this seat. We recommend showing this in your user interface to make sure that customers understand any restrictions and limitations. Disclosures []string `json:"disclosures"` // A name which describes the type of seat, which you can display in your user interface to help customers to understand its features. // Example: "Exit row seat" Name string `json:"name"` }
SectionElement represents an element in a section.
type SectionService ¶
type SectionService struct { ID string `json:"id"` PassengerID string `json:"passenger_id"` RawTotalAmount string `json:"total_amount"` RawTotalCurrency string `json:"total_currency"` }
func (*SectionService) TotalAmount ¶
func (s *SectionService) TotalAmount() currency.Amount
type SegmentPassenger ¶
type Service ¶
type Service struct { // Duffel's unique identifier for the booked service ID string `json:"id"` // The metadata varies by the type of service. // It includes further data about the service. For example, for // baggages, it may have data about size and weight restrictions. Metadata Metadata `json:"metadata"` // List of passenger ids the service applies to. // The service applies to all the passengers in this list. PassengerIDs []string `json:"passenger_ids"` // The quantity of the service that was booked Quantity int `json:"quantity"` // List of segment ids the service applies to. The service applies to all the segments in this list. SegmentIDs []string `json:"segment_ids"` // The total price of the service for all passengers and segments it applies to, accounting for quantity and including taxes RawTotalAmount string `json:"total_amount,omitempty"` RawTotalCurrency string `json:"total_currency,omitempty"` // Possible values: "baggage" or "seat" Type string `json:"type"` }
func (*Service) TotalAmount ¶
type ServiceCreateInput ¶
type ServiceCreateInput struct { // The id of the service from the offer's available_services that you want to book ID string `json:"id"` // The quantity of the service to book. This will always be 1 for seat services. Quantity int `json:"quantity"` }
The services you want to book along with the first selected offer. This key should be omitted when the order’s type is hold, as we do not support services for hold orders yet.
type Slice ¶
type Slice struct { *BaseSlice ID string `json:"id"` // Whether this slice can be changed. This can only be true for paid orders. Changeable bool `json:"changeable,omitempty"` // The conditions associated with this slice, describing the kinds of modifications you can make and any penalties that will apply to those modifications. Conditions SliceConditions `json:"conditions,omitempty"` Duration Duration `json:"duration,omitempty"` Segments []Flight `json:"segments,omitempty"` FareBrandName string `json:"fare_brand_name,omitempty"` }
TODO: We probably need an OfferRequestSlice and an OrderSlice since not all fields apply to both.
type SliceAdd ¶ added in v0.2.0
type SliceAdd struct { DepartureDate Date `json:"departure_date"` Destination string `json:"destination"` Origin string `json:"origin"` CabinClass CabinClass `json:"cabin_class"` }
type SliceChange ¶ added in v0.2.0
type SliceChange struct { Add []SliceAdd `json:"add,omitempty"` Remove []SliceRemove `json:"remove,omitempty"` }
type SliceChangeset ¶ added in v0.2.0
type SliceConditions ¶ added in v0.4.5
type SliceConditions struct {
ChangeBeforeDeparture *ChangeCondition `json:"change_before_departure,omitempty"`
}
type SliceRemove ¶ added in v0.2.0
type SliceRemove struct {
SliceID string `json:"slice_id"`
}
type TimeFilter ¶
type Wing ¶
type Wing struct { // The index of the first row which is overwing, starting from the front of the aircraft. FirstRowIndex int `json:"first_row_index"` // The index of the last row which is overwing, starting from the front of the aircraft. LastRowIndex int `json:"last_row_index"` }
Wing represents a wing of the aircraft in relation to rows in the cabin.