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) AcceptAirlineInitiatedChange(ctx context.Context, id string) (*Order, error)
- func (a *API) AddOrderService(ctx context.Context, id string, input AddOrderServiceInput) (*Order, error)
- 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) CreatePartialOfferRequest(ctx context.Context, requestInput OfferRequestInput) (*OfferRequest, error)
- func (a *API) CreatePayment(ctx context.Context, req CreatePaymentRequest) (*Payment, error)
- func (a *API) CreatePaymentCardRecord(ctx context.Context, payload *CreatePaymentCardRecordRequest) (*PaymentCard, error)
- func (a *API) CreatePendingOrderChange(ctx context.Context, offerID string) (*OrderChange, error)
- func (a *API) CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord(ctx context.Context, ...) (*PaymentCard, error)
- func (a *API) DeleteSavedPaymentCardRecord(ctx context.Context, id string) 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) GetFullPartialOfferRequest(ctx context.Context, requestInput PartialOfferRequestInput) (*OfferRequest, error)
- func (a *API) GetLoyaltyProgramme(ctx context.Context, id string) (*LoyaltyProgramme, 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) GetOrderChange(ctx context.Context, id string) (*OrderChange, error)
- func (a *API) GetOrderChangeOffer(ctx context.Context, id string) (*OrderChangeOffer, error)
- func (a *API) GetOrderChangeRequest(ctx context.Context, orderChangeRequestID string) (*OrderChangeRequest, error)
- func (a *API) GetPartialOfferRequests(ctx context.Context, requestInput PartialOfferRequestInput) (*OfferRequest, 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) ListAirlineInitiatedChanges(ctx context.Context, params ...ListAirlineInitiatedChangesParams) ([]*AirlineInitiatedChanges, error)
- func (a *API) ListAirlines(ctx context.Context) *Iter[Airline]
- func (a *API) ListAirports(ctx context.Context, params ...ListAirportsParams) *Iter[Airport]
- func (a *API) ListLoyaltyProgramme(ctx context.Context) *Iter[LoyaltyProgramme]
- 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) ListOrderCancellations(ctx context.Context, params ...ListOrderCancellationParams) *Iter[OrderCancellation]
- func (a *API) ListOrderChangeOffers(ctx context.Context, params ...ListOrderChangeOffersParams) *Iter[OrderChangeOffer]
- func (a *API) ListOrderServices(ctx context.Context, id string) ([]*AvailableService, error)
- 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) UpdateAirlineInitiatedChange(ctx context.Context, id string, input UpdateAirlineInitiatedChangeInput) (*Order, 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 ActionTakenType
- type AddOrderServiceInput
- type Aircraft
- type AircraftClient
- type Airline
- type AirlineCredit
- type AirlineInitiatedChanges
- type AirlinesClient
- type Airport
- type AirportsClient
- type AvailableActionType
- type AvailableService
- type AvailableServiceMetadata
- type Baggage
- type BaseSlice
- type Cabin
- type CabinClass
- type ChangeCondition
- type City
- type Conditions
- type CreateOrderInput
- type CreatePayment
- type CreatePaymentCardRecordRequest
- type CreatePaymentRequest
- type CreateTemporaryPaymentCardRecordFromSavedPaymentCardRequest
- type Date
- type DateTime
- type Distance
- type Duffel
- type DuffelError
- type Duration
- type ElementType
- type EmptyPayload
- type Error
- type ErrorCode
- type ErrorMeta
- type ErrorSource
- type ErrorType
- type FareType
- type Flight
- type Gender
- type GetOfferParams
- type IdentityDocument
- type IssuedDocument
- type IssuedDocumentType
- type Iter
- type List
- type ListAirlineInitiatedChangesParams
- type ListAirportsParams
- type ListContainer
- type ListMeta
- type ListOffersParams
- type ListOffersSortParam
- type ListOrderCancellationParams
- type ListOrderChangeOffersParams
- type ListOrderChangeOffersSortParam
- type ListOrdersParams
- type ListOrdersSort
- type Location
- type LocationType
- type LoyaltyProgramme
- type LoyaltyProgrammeAccount
- type LoyaltyProgrammeClient
- type MealType
- type Metadata
- type Offer
- type OfferClient
- type OfferPaymentRequirement
- type OfferPrivateFare
- 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 OrderContent
- type OrderPassenger
- type OrderPaymentClient
- type OrderType
- type OrderUpdateParams
- type PageFn
- type ParamEncoder
- type PartialOfferRequestInput
- type PassengerInitiatedChanges
- type PassengerTitle
- type PassengerType
- type PassengerUpdateInput
- type Payload
- type Payment
- type PaymentCard
- type PaymentCardBrand
- type PaymentCardClient
- type PaymentCreateInput
- type PaymentMethod
- type PaymentStatus
- type PaymentType
- type Place
- type PlaceType
- type PlacesClient
- type PrivateFare
- type PrivateFareType
- type RateLimit
- type RefundPaymentMethod
- type RequestBuilder
- func (r *RequestBuilder[Req, Resp]) Body(body *Req) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Delete(path string, opts ...RequestOption) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Deletef(path string, a ...any) *RequestBuilder[Req, Resp]
- func (r *RequestBuilder[Req, Resp]) Empty(ctx context.Context) error
- 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]) SingleWithResponse(ctx context.Context) (*Resp, int, 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 ServiceType
- type Slice
- type SliceAdd
- type SliceChange
- type SliceChangeset
- type SliceConditions
- type SliceRemove
- type Stop
- type TimeFilter
- type UpdateAirlineInitiatedChangeInput
- type Wing
Constants ¶
const ( PassengerTypeAdult PassengerType = "adult" PassengerTypeChild PassengerType = "child" PassengerTypeInfantWithoutSeat PassengerType = "infant_without_seat" AccompanyingAdult FareType = "accompanying_adult" ContractBulk FareType = "contract_bulk" ContractBulkChild FareType = "contract_bulk_child" ContractBulkInfantWithSeat FareType = "contract_bulk_infant_with_seat" ContractBulkInfantWithoutSeat FareType = "contract_bulk_infant_without_seat" FrequentFlyer FareType = "frequent_flyer" GroupInclusiveTour FareType = "group_inclusive_tour" GroupInclusiveTourChild FareType = "group_inclusive_tour_child" Humanitarian FareType = "humanitarian" IndividualInclusiveTourChild FareType = "individual_inclusive_tour_child" Marine FareType = "marine" SeatOnly FareType = "seat_only" Student FareType = "student" Teacher FareType = "teacher" TourOperatorInclusive FareType = "tour_operator_inclusive" TourOperatorInclusiveInfant FareType = "tour_operator_inclusive_infant" UnaccompaniedChild FareType = "unaccompanied_child" VisitingFriendsAndFamily FareType = "visiting_friends_and_family" 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" PaymentMethodARCBSPCash PaymentMethod = "arc_bsp_cash" PaymentMethodCard PaymentMethod = "card" PaymentMethodVoucher PaymentMethod = "voucher" PaymentMethodAwaitingPayment PaymentMethod = "awaiting_payment" PaymentMethodOriginalFormOfPayment PaymentMethod = "original_form_of_payment" PaymentMethodAirlineCredits PaymentMethod = "airline_credits" RefundPaymentMethodVoucher RefundPaymentMethod = "voucher" RefundPaymentMethodOriginalFormOfPayment RefundPaymentMethod = "original_form_of_payment" LocationTypeAirport LocationType = "airport" LocationTypeCity LocationType = "city" )
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" // The price of the offer has changed since it was last retrieved PriceChanged ErrorCode = "price_changed" // The payment was declined by the payment provider PaymentDeclined ErrorCode = "payment_declined" // The selected offer has already expired OfferExpired ErrorCode = "offer_expired" // The order is invalid InvalidOrder ErrorCode = "invalid_order" // The order has been modified by an external system ModifiedExternally ErrorCode = "modified_externally" // The request to create an order was not successful OrderNotCreated ErrorCode = "order_not_created" // The provided order cannot be cancelled OrderNotCancellable ErrorCode = "order_not_cancellable" // The order cannot be changed through the API OrderNotChangeable ErrorCode = "order_not_changeable" // Changes to this order are not permitted at this time OrderNotChangeableYet ErrorCode = "order_not_changeable_yet" // The order change has already been actioned OrderChangeAlreadyActioned ErrorCode = "order_change_already_actioned" // An offer from this offer request has already been booked OfferRequestAlreadyBooked ErrorCode = "offer_request_already_booked" // Order creation has already been attempted for an offer from this request OrderCreationAlreadyAttempted ErrorCode = "order_creation_already_attempted" // The passenger name format is not valid InvalidPassengerName ErrorCode = "invalid_passenger_name" // The title of one of the passengers is not valid InvalidPassengerTitle ErrorCode = "invalid_passenger_title" // The phone number is not valid InvalidPhoneNumber ErrorCode = "invalid_phone_number" // The airline does not support the format of the email address provided InvalidEmailAddress ErrorCode = "invalid_email_address" // The card has an invalid expiration date InvalidCardExpirationDate ErrorCode = "invalid_card_expiration_date" // The intended card attached to the offer is invalid InvalidIntendedCard ErrorCode = "invalid_intended_card" // The 3D Secure session was not found ThreeDSecureSessionNotFound ErrorCode = "three_d_secure_session_not_found" // The 3D Secure session is not ready for payment ThreeDSecureSessionNotReadyForPayment ErrorCode = "three_d_secure_session_not_ready_for_payment" // The 3D Secure session has expired ThreeDSecureSessionExpired ErrorCode = "three_d_secure_session_expired" // The payment amount does not match the order total amount PaymentAmountDoesNotMatchOrderAmount ErrorCode = "payment_amount_does_not_match_order_amount" // The payment currency does not match the order total currency PaymentCurrencyDoesNotMatchOrderCurrency ErrorCode = "payment_currency_does_not_match_order_currency" // The passengers on the order are not compatible with the offer OrderPassengersIncompatibleWithOffer ErrorCode = "order_passengers_incompatible_with_offer" UnavailableInVersion ErrorCode = "unavailable_in_version" // A required field is missing ValidationRequired ErrorCode = "validation_required" // The airline credit is ineligible for this operation IneligibleAirlineCredit ErrorCode = "ineligible_airline_credit" // The order contains passengers with duplicate names DuplicatePassengerNames ErrorCode = "duplicate_passenger_names" )
const ( ListOffersSortTotalAmount ListOffersSortParam = "total_amount" ListOffersSortTotalDuration ListOffersSortParam = "total_duration" ServiceTypeBaggage = ServiceType("baggage") ServiceTypeSeat = ServiceType("seat") ServiceTypeMeal = ServiceType("meal") ServiceTypeCancel = ServiceType("cancel_for_any_reason") PrivateFareTypeCorporate PrivateFareType = "corporate" PrivateFareTypeLeisure PrivateFareType = "leisure" PrivateFareTypeNegotiated PrivateFareType = "negotiated" MealTypeBabyMeal MealType = "baby_meal" MealTypeBlandMeal MealType = "bland_meal" MealTypeAsianVegetarianMeal MealType = "asian_vegetarian_meal" MealTypeDiabeticMeal MealType = "diabetic_meal" MealTypeGlutenFreeMeal MealType = "gluten_free_meal" MealTypeHinduMeal MealType = "hindu_meal" MealTypeKosherMeal MealType = "kosher_meal" MealTypeMuslimMeal MealType = "muslim_meal" MealTypeVeganMeal MealType = "vegan_meal" MealTypeVegetarianLactoOvoMeal MealType = "vegetarian_lacto_ovo_meal" MealTypeTraditionalMeal MealType = "traditional_meal" MealTypeLowFatMeal MealType = "low_fat_meal" MealTypeLowSaltMeal MealType = "low_salt_meal" MealTypeLactoseFreeMeal MealType = "lactose_free_meal" MealTypeHealthyMeal MealType = "healthy_meal" MealTypeSwissColdMeal MealType = "swiss_cold_meal" MealTypeSwissBrunch MealType = "swiss_brunch" MealTypeJapaneseMeal MealType = "japanese_meal" MealTypeChildMeal MealType = "child_meal" MealTypeAllergenMeal MealType = "allergen_meal" MealTypeVegetarianMeal MealType = "vegetarian_meal" MealTypeMeal MealType = "meal" )
const ( ListOrdersSortPaymentRequiredByAsc ListOrdersSort = "payment_required_by" ListOrdersSortPaymentRequiredByDesc ListOrdersSort = "-payment_required_by" OrderTypeHold OrderType = "hold" OrderTypeInstant OrderType = "instant" ActionTakenTypeAccepted = ActionTakenType("accepted") ActionTakenTypeCancelled = ActionTakenType("cancelled") ActionTakenTypeChanged = ActionTakenType("changed") AvailableActionTypeAccept = AvailableActionType("accept") AvailableActionTypeCancel = AvailableActionType("cancel") AvailableActionTypeChange = AvailableActionType("change") IssuedDocumentTypeElectronicTicket = IssuedDocumentType("electronic_ticket") IssuedDocumentTypeElectronicMiscDocumentAssociated = IssuedDocumentType("electronic_miscellaneous_document_associated") IssuedDocumentTypeElectronicMiscDocumentStandalone = IssuedDocumentType("electronic_miscellaneous_document_standalone") OrderContentManaged = OrderContent("managed") OrderContentSelfManaged = OrderContent("self_managed") )
const ( PaymentTypeBalance = PaymentType("balance") PaymentTypeCash = PaymentType("arc_bsp_cash") PaymentTypeCard = PaymentType("card") )
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 ¶
ErrIsRetryable returns true if the request that generated this error is retryable.
func IsErrorCode ¶
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 ¶
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 ¶
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) AcceptAirlineInitiatedChange ¶
AcceptAirlineInitiatedChange accepts an airline-initiated change.
func (*API) AddOrderService ¶
func (a *API) AddOrderService(ctx context.Context, id string, input AddOrderServiceInput) (*Order, error)
AddOrderService adds a service to an order.
func (*API) ConfirmOrderCancellation ¶
func (a *API) ConfirmOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error)
ConfirmOrderCancellation confirms a pending order cancellation.
func (*API) ConfirmOrderChange ¶
func (a *API) ConfirmOrderChange( ctx context.Context, orderChangeRequestID string, payment PaymentCreateInput, ) (*OrderChange, error)
ConfirmOrderChange confirms a pending order change.
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 ¶
func (a *API) CreateOrderCancellation(ctx context.Context, orderID string) (*OrderCancellation, error)
CreateOrderCancellation creates a new pending order cancellation.
func (*API) CreateOrderChangeRequest ¶
func (a *API) CreateOrderChangeRequest(ctx context.Context, params OrderChangeRequestParams) ( *OrderChangeRequest, error, )
func (*API) CreatePartialOfferRequest ¶
func (a *API) CreatePartialOfferRequest(ctx context.Context, requestInput OfferRequestInput) (*OfferRequest, error)
func (*API) CreatePayment ¶
func (a *API) CreatePayment(ctx context.Context, req CreatePaymentRequest) (*Payment, error)
func (*API) CreatePaymentCardRecord ¶
func (a *API) CreatePaymentCardRecord( ctx context.Context, payload *CreatePaymentCardRecordRequest, ) (*PaymentCard, error)
func (*API) CreatePendingOrderChange ¶
func (a *API) CreatePendingOrderChange(ctx context.Context, offerID string) (*OrderChange, error)
CreatePendingOrderChange creates a new pending order change.
func (*API) CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord ¶
func (a *API) CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord( ctx context.Context, payload *CreateTemporaryPaymentCardRecordFromSavedPaymentCardRequest, ) (*PaymentCard, error)
func (*API) DeleteSavedPaymentCardRecord ¶
func (*API) GetAircraft ¶
func (*API) GetFullPartialOfferRequest ¶
func (a *API) GetFullPartialOfferRequest(ctx context.Context, requestInput PartialOfferRequestInput) ( *OfferRequest, error, )
func (*API) GetLoyaltyProgramme ¶
func (a *API) GetLoyaltyProgramme(ctx context.Context, id string) (*LoyaltyProgramme, error)
GetLoyaltyProgramme retrieves a loyalty programme by its ID.
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 ¶
func (a *API) GetOrderCancellation(ctx context.Context, orderCancellationID string) (*OrderCancellation, error)
GetOrderCancellation retrieves an order cancellation by its ID.
func (*API) GetOrderChange ¶
func (a *API) GetOrderChange(ctx context.Context, id string) (*OrderChange, error)
GetOrderChange retrieves an order change by its ID.
func (*API) GetOrderChangeOffer ¶
func (a *API) GetOrderChangeOffer(ctx context.Context, id string) (*OrderChangeOffer, error)
GetOrderChangeOffer retrieves an order change offer by its ID.
func (*API) GetOrderChangeRequest ¶
func (a *API) GetOrderChangeRequest(ctx context.Context, orderChangeRequestID string) (*OrderChangeRequest, error)
GetOrderChangeRequest retrieves an order change request by its ID.
func (*API) GetPartialOfferRequests ¶
func (a *API) GetPartialOfferRequests(ctx context.Context, requestInput PartialOfferRequestInput) ( *OfferRequest, error, )
func (*API) GetSeatmap ¶
func (*API) LastRequestID ¶
func (*API) ListAirlineInitiatedChanges ¶
func (a *API) ListAirlineInitiatedChanges( ctx context.Context, params ...ListAirlineInitiatedChangesParams, ) ([]*AirlineInitiatedChanges, error)
ListAirlineInitiatedChanges returns a list of airline-initiated changes.
func (*API) ListAirports ¶
func (a *API) ListAirports(ctx context.Context, params ...ListAirportsParams) *Iter[Airport]
func (*API) ListLoyaltyProgramme ¶
func (a *API) ListLoyaltyProgramme(ctx context.Context) *Iter[LoyaltyProgramme]
ListLoyaltyProgramme retrieves a paginated list of loyalty programmes.
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) ListOrderCancellations ¶
func (a *API) ListOrderCancellations( ctx context.Context, params ...ListOrderCancellationParams, ) *Iter[OrderCancellation]
ListOrderCancellations Retrieves a paginated list of order cancellations.
func (*API) ListOrderChangeOffers ¶
func (a *API) ListOrderChangeOffers( ctx context.Context, params ...ListOrderChangeOffersParams, ) *Iter[OrderChangeOffer]
ListOrderChangeOffers retrieves a paginated list of order change offers.
func (*API) ListOrderServices ¶
func (a *API) ListOrderServices(ctx context.Context, id string) ([]*AvailableService, error)
ListOrderServices returns a list of available services for an order.
func (*API) ListOrders ¶
func (a *API) ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order]
ListOrders returns a list of orders.
func (*API) PlaceSuggestions ¶
func (*API) SeatmapForOffer ¶
func (*API) UpdateAirlineInitiatedChange ¶
func (a *API) UpdateAirlineInitiatedChange( ctx context.Context, id string, input UpdateAirlineInitiatedChangeInput, ) (*Order, error)
UpdateAirlineInitiatedChange updates an airline-initiated change.
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 ¶
UpdateOrder updates an existing order with update-able fields (mostly metadata).
type ActionTakenType ¶
type ActionTakenType string
type AddOrderServiceInput ¶
type AddOrderServiceInput struct {
// AddServices The services you want to add to the order.
AddServices []ServiceCreateInput `json:"add_services"`
// Payment The payment details to pay for the services.
Payment PaymentCreateInput `json:"payment"`
}
type AircraftClient ¶
type AirlineCredit ¶
type AirlineInitiatedChanges ¶
type AirlineInitiatedChanges struct {
ID string `json:"id"`
ActionTaken ActionTakenType `json:"actions_taken"`
ActionTakenAt time.Time `json:"actions_taken_at"`
Added []Slice `json:"added"`
AvailableActions []AvailableActionType `json:"available_actions"`
CreatedAt time.Time `json:"created_at"`
OrderID string `json:"order_id"`
Removed []Slice `json:"removed"`
// TODO: TravelAgentTicket // preview
UpdatedAt time.Time `json:"updated_at"`
}
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 AvailableActionType ¶
type AvailableActionType string
type AvailableService ¶
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", "seat", "meal", or "cancel_for_any_reason"
Type string `json:"type"`
}
AvailableService is only returned on the "Get Single Offer" endpoint (GetOffer in this SDK)
type AvailableServiceMetadata ¶
type AvailableServiceMetadata struct {
// For a Baggage
MaximumDepthCM int `json:"maximum_depth_cm,omitempty"` // e.g. 30
MaximumHeightCM int `json:"maximum_height_cm,omitempty"` // e.g. 40
MaximumLengthCM int `json:"maximum_length_cm,omitempty"` // e.g. 55
MaximumWeightKg int `json:"maximum_weight_kg,omitempty"` // e.g. 23
// Possible values: "checked", "carry_on"
Type string `json:"type"`
// For a Seat
Designator string `json:"designator,omitempty"` // e.g. "14B"
Disclosures []string `json:"disclosures,omitempty"` // e.g. ["Do not seat children in exit row seats"]
Name string `json:"name,omitempty"` // e.g. "Exit row seat"
// For a Meal
Meal MealType `json:"meal,omitempty"` // e.g. "vegetarian_meal"
// For Cancel for Any Reason
MerchantCopy string `json:"merchant_copy,omitempty"` // e.g. "If you purchase this product we can refund up to 75% of your base fare if you cancel 24 hours before your first scheduled departure\n"
RawRefundAmount string `json:"refund_amount,omitempty"` // e.g. "100.00"
TermsAndConditionsURL string `json:"terms_and_conditions_url,omitempty"` // e.g. "https://example.com/terms-and-conditions"
}
type BaseSlice ¶
type BaseSlice struct {
OriginType LocationType `json:"origin_type"`
Origin Location `json:"origin"`
DestinationType LocationType `json:"destination_type"`
Destination Location `json:"destination"`
DepartureDate Date `json:"departure_date,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
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 ¶
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"`
// Passengers 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"`
// SelectedOffers 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 ¶
type CreatePayment struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
Type PaymentType `json:"type"`
CardID string `json:"card_id,omitempty"`
}
type CreatePaymentCardRecordRequest ¶
type CreatePaymentCardRecordRequest struct {
AddressCity string `json:"address_city"`
AddressCountryCode string `json:"address_country_code"`
AddressLine1 string `json:"address_line_1"`
AddressLine2 string `json:"address_line_2"`
AddressPostalCode string `json:"address_postal_code"`
AddressRegion string `json:"address_region"`
// Deprecated: Brand is no longer required
Brand PaymentCardBrand `json:"brand,omitempty"`
ExpiryMonth string `json:"expiry_month"`
ExpiryYear string `json:"expiry_year"`
Name string `json:"name"`
Number string `json:"number"`
SecurityCode string `json:"cvc"`
// MultiUse controls whether the card should be saved for future use. If false, the card will be saved temporarily.
MultiUse bool `json:"multi_use"`
}
type CreatePaymentRequest ¶
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
PaymentCardClient
LoyaltyProgrammeClient
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 ¶
MarshalGQL implements the graphql.Marshaler interface
func (Duration) MarshalJSON ¶
func (*Duration) UnmarshalGQL ¶
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 ErrorSource ¶ added in v2.1.0
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 is the distance in km
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"`
Stops []Stop `json:"stops"`
}
type GetOfferParams ¶
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 IssuedDocument ¶
type IssuedDocument struct {
PassengerIDs []string `json:"passenger_ids"`
Type IssuedDocumentType `json:"type"`
UniqueIdentifier string `json:"unique_identifier"`
}
type IssuedDocumentType ¶
type IssuedDocumentType string
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 ¶
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 ListAirlineInitiatedChangesParams ¶
type ListAirlineInitiatedChangesParams struct {
OrderID string `url:"order_id,omitempty"`
}
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
type ListOrderCancellationParams ¶
type ListOrderCancellationParams struct {
OrderID string `url:"order_id,omitempty"`
}
type ListOrderChangeOffersParams ¶
type ListOrderChangeOffersParams struct {
OrderChangeRequestID string `url:"order_change_request_id,omitempty"`
Sort ListOrderChangeOffersSortParam `url:"sort,omitempty"`
MaxConnections int `url:"max_connections,omitempty"`
}
type ListOrderChangeOffersSortParam ¶
type ListOrderChangeOffersSortParam string
const ( SortParamChangeTotalAmount ListOrderChangeOffersSortParam = "change_total_amount" SortParamTotalDuration ListOrderChangeOffersSortParam = "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 LocationType ¶
type LocationType string
type LoyaltyProgramme ¶
type LoyaltyProgrammeAccount ¶
type LoyaltyProgrammeClient ¶
type LoyaltyProgrammeClient interface {
ListLoyaltyProgramme(ctx context.Context) *Iter[LoyaltyProgramme]
GetLoyaltyProgramme(ctx context.Context, id string) (*LoyaltyProgramme, error)
}
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 interface{} `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"`
SupportedPassengerIdentityDocumentTypes []string `json:"supported_passenger_identity_document_types"` // e.g. ["passport"]
PaymentRequirements OfferPaymentRequirement `json:"payment_requirements"`
AvailableServices []AvailableService `json:"available_services"`
Conditions Conditions `json:"conditions"`
PrivateFares []OfferPrivateFare `json:"private_fares"`
SupportedLoyaltyProgrammes []string `json:"supported_loyalty_programmes"` // Airline IATA codes (e.g. ["BA", "U2"])
}
func (*Offer) BaseAmount ¶
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 ¶
type OfferPrivateFare ¶
type OfferPrivateFare struct {
CorporateCode string `json:"corporate_code,omitempty"`
TrackingReference string `json:"tracking_reference,omitempty"`
TourCode string `json:"tour_code,omitempty"`
Type PrivateFareType `json:"type,omitempty"`
}
type OfferRequest ¶
type OfferRequest struct {
ID string `json:"id"`
ClientKey string `json:"client_key"` // For use with https://duffel.com/docs/guides/ancillaries-component
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)
CreatePartialOfferRequest(ctx context.Context, requestInput OfferRequestInput) (*OfferRequest, error)
GetFullPartialOfferRequest(ctx context.Context, requestInput PartialOfferRequestInput) (*OfferRequest, error)
GetPartialOfferRequests(ctx context.Context, requestInput PartialOfferRequestInput) (*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,omitempty" 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
// The private fares codes of airline. The key is the airline's IATA code that provided the private fare code.
PrivateFares map[string][]PrivateFare `json:"private_fares,omitempty" url:"-"`
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"`
FareType FareType `json:"fare_type,omitempty"`
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 ¶
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 WithTimeout ¶ added in v2.1.0
WithTimeout sets the deadline timeout. The Duffel API recommends at least 130 seconds for order creation endpoints. Default is 130 seconds.
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"`
Message *string `json:"message,omitempty"`
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 []IssuedDocument `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"`
AirlineInitiatedChanges []AirlineInitiatedChanges `json:"airline_initiated_changes"`
Cancellation *OrderCancellation `json:"cancellation,omitempty"`
Changes []PassengerInitiatedChanges `json:"changes"`
Content OrderContent `json:"content"`
OfferID string `json:"offer_id"`
Type OrderType `json:"type"`
IsPendingConfirmation bool `json:"-"`
IsAwaitingCreation bool `json:"-"`
}
func (*Order) BaseAmount ¶
func (*Order) TotalAmount ¶
type OrderCancellation ¶
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"`
AirlineCredits []AirlineCredit `json:"airline_credits"`
}
func (*OrderCancellation) RefundAmount ¶
func (o *OrderCancellation) RefundAmount() currency.Amount
type OrderCancellationClient ¶
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)
ListOrderCancellations(ctx context.Context, params ...ListOrderCancellationParams) *Iter[OrderCancellation]
}
type OrderCancellationRequest ¶
type OrderCancellationRequest struct {
OrderID string `json:"order_id"`
}
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).
type OrderChange ¶
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 DateTime `json:"created_at"`
UpdatedAt string `json:"updated_at"`
LiveMode bool `json:"live_mode"`
ConfirmedAt DateTime `json:"confirmed_at"`
}
type OrderChangeClient ¶
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)
GetOrderChange(ctx context.Context, id string) (*OrderChange, error)
GetOrderChangeOffer(ctx context.Context, id string) (*OrderChangeOffer, error)
ListOrderChangeOffers(ctx context.Context, params ...ListOrderChangeOffersParams) *Iter[OrderChangeOffer]
}
type OrderChangeOffer ¶
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 DateTime `json:"expires_at"`
CreatedAt DateTime `json:"created_at"`
UpdatedAt DateTime `json:"updated_at"`
LiveMode bool `json:"live_mode"`
Conditions Conditions `json:"conditions"`
PrivateFares []PrivateFare `json:"private_fares"`
}
func (*OrderChangeOffer) ChangeTotalAmount ¶
func (o *OrderChangeOffer) ChangeTotalAmount() currency.Amount
func (*OrderChangeOffer) NewTotalAmount ¶
func (o *OrderChangeOffer) NewTotalAmount() currency.Amount
func (*OrderChangeOffer) PenaltyTotalAmount ¶
func (o *OrderChangeOffer) PenaltyTotalAmount() currency.Amount
PenaltyTotalAmount returns the penalty imposed by the airline for making this change.
type OrderChangeRequest ¶
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 ¶
type OrderChangeRequestParams struct {
OrderID string `json:"order_id"`
PrivateFares map[string][]PrivateFare `json:"private_fares,omitempty"`
Slices SliceChange `json:"slices,omitempty"`
}
type OrderClient ¶
type OrderClient interface {
// GetOrder Get a single order by ID.
GetOrder(ctx context.Context, id string) (*Order, error)
// UpdateOrder Update a single order by ID.
UpdateOrder(ctx context.Context, id string, params OrderUpdateParams) (*Order, error)
// ListOrders List orders.
ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order]
// CreateOrder Create an order.
CreateOrder(ctx context.Context, input CreateOrderInput) (*Order, error)
// ListOrderServices List available services for an order.
ListOrderServices(ctx context.Context, id string) ([]*AvailableService, error)
// AddOrderService Add a service to an order.
AddOrderService(ctx context.Context, id string, input AddOrderServiceInput) (*Order, error)
// UpdateAirlineInitiatedChange Update an airline-initiated change.
UpdateAirlineInitiatedChange(ctx context.Context, id string, input UpdateAirlineInitiatedChangeInput) (
*Order, error,
)
// AcceptAirlineInitiatedChange Accept an airline-initiated change.
AcceptAirlineInitiatedChange(ctx context.Context, id string) (*Order, error)
// ListAirlineInitiatedChanges List airline-initiated changes.
ListAirlineInitiatedChanges(
ctx context.Context, params ...ListAirlineInitiatedChangesParams,
) ([]*AirlineInitiatedChanges, error)
}
type OrderContent ¶
type OrderContent string
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.
// Possible values: "adult", "child", or "infant_without_seat"
Type PassengerType `json:"type"`
}
type OrderPaymentClient ¶
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 PartialOfferRequestInput ¶
type PassengerInitiatedChanges ¶
type PassengerInitiatedChanges struct {
ID string `json:"id"`
RawChangeTotalAmount string `json:"change_total_amount"`
RawChangeTotalCurrency string `json:"change_total_currency"`
ConfirmedAt time.Time `json:"confirmed_at"`
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
LiveMode bool `json:"live_mode"`
RawNewTotalAmount string `json:"new_total_amount"`
RawNewTotalCurrency string `json:"new_total_currency"`
OrderID string `json:"order_id"`
RawPenaltyAmount string `json:"penalty_total_amount"`
RawPenaltyCurrency string `json:"penalty_total_currency"`
RefundTo RefundPaymentMethod `json:"refund_to"`
Slices struct {
Add []Slice `json:"add"`
Remove []Slice `json:"remove"`
} `json:"slices"`
}
type PassengerTitle ¶
type PassengerTitle string
func (PassengerTitle) String ¶
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 PaymentCard ¶
type PaymentCard struct {
ID string `json:"id"`
LiveMode bool `json:"live_mode"`
Last4Digits string `json:"last_4_digits"`
MultiUse bool `json:"multi_use"`
Brand PaymentCardBrand `json:"brand"`
}
type PaymentCardBrand ¶
type PaymentCardBrand string
const ( CardBrandVisa PaymentCardBrand = "visa" CardBrandAirplus PaymentCardBrand = "uatp" CardBrandMastercard PaymentCardBrand = "mastercard" CardBrandAmericanExpress PaymentCardBrand = "american_express" CardBrandDinersClub PaymentCardBrand = "diners_club" CardBrandJCB PaymentCardBrand = "jcb" )
type PaymentCardClient ¶
type PaymentCardClient interface {
CreatePaymentCardRecord(
ctx context.Context, payload *CreatePaymentCardRecordRequest,
) (*PaymentCard, error)
CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord(
ctx context.Context, payload *CreateTemporaryPaymentCardRecordFromSavedPaymentCardRequest,
) (*PaymentCard, error)
DeleteSavedPaymentCardRecord(ctx context.Context, id string) error
}
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"`
// Unique identifier of a lodged card by Duffel.
CardID string `json:"card_id,omitempty"`
}
The payment details to use to pay for the order. This key should be omitted when the order’s type is hold.
type PaymentMethod ¶
type PaymentMethod string
func (PaymentMethod) String ¶
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"`
PaidAt *time.Time `json:"paid_at,omitempty"`
}
The payment status for an order.
type PaymentType ¶
type PaymentType string
type Place ¶
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 ¶
type PrivateFare ¶
type PrivateFare struct {
CorporateCode string `json:"corporate_code,omitempty"`
TrackingReference string `json:"tracking_reference,omitempty"`
TourCode string `json:"tour_code,omitempty"`
Type PrivateFareType `json:"type,omitempty"`
}
The corporate_code and tour_code are provided to you by the airline and the tracking_reference is to identify your business by the airlines.
type PrivateFareType ¶
type PrivateFareType string
type RefundPaymentMethod ¶
type RefundPaymentMethod string
type RequestBuilder ¶
func (*RequestBuilder[Req, Resp]) Body ¶
func (r *RequestBuilder[Req, Resp]) Body(body *Req) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) Delete ¶
func (r *RequestBuilder[Req, Resp]) Delete(path string, opts ...RequestOption) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) Deletef ¶
func (r *RequestBuilder[Req, Resp]) Deletef(path string, a ...any) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) Empty ¶
func (r *RequestBuilder[Req, Resp]) Empty(ctx context.Context) error
Empty finalizes the request and returns an error if the request fails. It is to be used for requests that are expected to return no data.
func (*RequestBuilder[Req, Resp]) Get ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (r *RequestBuilder[Req, Resp]) Postf(path string, a ...any) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) Single ¶
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]) SingleWithResponse ¶ added in v2.1.0
func (r *RequestBuilder[Req, Resp]) SingleWithResponse(ctx context.Context) (*Resp, int, error)
SingleWithResponse finalizes the request and returns the decoded response along with the HTTP status code.
func (*RequestBuilder[Req, Resp]) Slice ¶
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 ¶
func (r *RequestBuilder[Req, Resp]) WithOptions(opts ...RequestOption) *RequestBuilder[Req, Resp]
func (*RequestBuilder[Req, Resp]) WithParam ¶
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 ¶
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 ¶
type RequestOption ¶
func WithEncodableParams ¶
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 ¶
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"`
// Metadata 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"`
// Quantity 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"`
// RawTotalAmount 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"`
// Type Possible values: "baggage" or "seat"
Type string `json:"type"`
}
func (*Service) TotalAmount ¶
type ServiceCreateInput ¶
type ServiceCreateInput struct {
// ID The id of the service from the offer's available_services that you want to book
ID string `json:"id"`
// Quantity The quantity of the service to book. This will always be 1 for seat services.
Quantity int `json:"quantity"`
}
ServiceCreateInput 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 ServiceType ¶
type ServiceType string
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 ¶
type SliceAdd struct {
DepartureDate Date `json:"departure_date"`
Destination string `json:"destination"`
Origin string `json:"origin"`
CabinClass CabinClass `json:"cabin_class"`
}
type SliceChange ¶
type SliceChange struct {
Add []SliceAdd `json:"add,omitempty"`
Remove []SliceRemove `json:"remove,omitempty"`
}
type SliceChangeset ¶
type SliceConditions ¶
type SliceConditions struct {
ChangeBeforeDeparture *ChangeCondition `json:"change_before_departure,omitempty"`
}
type SliceRemove ¶
type SliceRemove struct {
SliceID string `json:"slice_id"`
}
type TimeFilter ¶
type UpdateAirlineInitiatedChangeInput ¶
type UpdateAirlineInitiatedChangeInput struct {
ActionTaken ActionTakenType `json:"action_taken"`
}
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
airlines
command
|
|
|
airports
command
|
|
|
cities
command
|
|
|
e2e
command
|
|
|
e2e_duffel_scenarios
command
|
|
|
offer-requests
command
|
|
|
offers
command
|
|
|
places
command
|
|