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)
- func VerifyWebhookSignature(secret string, body []byte, signatureHeader string) error
- type API
- func (a *API) AcceptAirlineInitiatedChange(ctx context.Context, id string, opts ...RequestOption) (*Order, error)
- func (a *API) AddOrderService(ctx context.Context, id string, input AddOrderServiceInput, ...) (*Order, error)
- func (a *API) Cities(ctx context.Context, opts ...RequestOption) *Iter[City]
- func (a *API) City(ctx context.Context, id string, opts ...RequestOption) (*City, error)
- func (a *API) ConfirmOrderCancellation(ctx context.Context, orderCancellationID string, opts ...RequestOption) (*OrderCancellation, error)
- func (a *API) ConfirmOrderChange(ctx context.Context, orderChangeID string, payment PaymentCreateInput, ...) (*OrderChange, error)
- func (a *API) CreateAirlineCredit(ctx context.Context, input CreateAirlineCreditInput, opts ...RequestOption) (*AirlineCredit, error)
- func (a *API) CreateBatchOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*BatchOfferRequest, error)
- func (a *API) CreateCard(ctx context.Context, input CreateCardInput, opts ...RequestOption) (*PaymentCard, error)
- func (a *API) CreateComponentClientKey(ctx context.Context, input ComponentClientKeyInput, opts ...RequestOption) (*ComponentClientKey, error)
- func (a *API) CreateCustomerUser(ctx context.Context, input CustomerUserInput, opts ...RequestOption) (*CustomerUser, error)
- func (a *API) CreateCustomerUserGroup(ctx context.Context, input CustomerUserGroupInput, opts ...RequestOption) (*CustomerUserGroup, error)
- func (a *API) CreateOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
- func (a *API) CreateOfferRequestItineraries(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*ItineraryOfferRequest, error)
- func (a *API) CreateOrder(ctx context.Context, input CreateOrderInput, opts ...RequestOption) (*Order, error)
- func (a *API) CreateOrderCancellation(ctx context.Context, orderID string, opts ...RequestOption) (*OrderCancellation, error)
- func (a *API) CreateOrderChangeRequest(ctx context.Context, params OrderChangeRequestParams, opts ...RequestOption) (*OrderChangeRequest, error)
- func (a *API) CreatePartialOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
- func (a *API) CreatePayment(ctx context.Context, req CreatePaymentRequest, opts ...RequestOption) (*Payment, error)
- func (a *API) CreatePaymentCardRecord(ctx context.Context, payload *CreatePaymentCardRecordRequest, ...) (*PaymentCard, error)
- func (a *API) CreatePendingOrderChange(ctx context.Context, offerID string, opts ...RequestOption) (*OrderChange, error)
- func (a *API) CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord(ctx context.Context, ...) (*PaymentCard, error)
- func (a *API) CreateThreeDSecureSession(ctx context.Context, input ThreeDSecureSessionInput, opts ...RequestOption) (*ThreeDSecureSession, error)
- func (a *API) CreateWebhook(ctx context.Context, input CreateWebhookInput, opts ...RequestOption) (*Webhook, error)
- func (a *API) DeleteCard(ctx context.Context, id string, opts ...RequestOption) error
- func (a *API) DeleteCustomerUserGroup(ctx context.Context, id string, opts ...RequestOption) error
- func (a *API) DeleteSavedPaymentCardRecord(ctx context.Context, id string, opts ...RequestOption) error
- func (a *API) DeleteWebhook(ctx context.Context, id string, opts ...RequestOption) error
- func (a *API) GetAircraft(ctx context.Context, id string, opts ...RequestOption) (*Aircraft, error)
- func (a *API) GetAirline(ctx context.Context, id string, opts ...RequestOption) (*Airline, error)
- func (a *API) GetAirlineCredit(ctx context.Context, id string, opts ...RequestOption) (*AirlineCredit, error)
- func (a *API) GetAirport(ctx context.Context, id string, opts ...RequestOption) (*Airport, error)
- func (a *API) GetBatchOfferRequest(ctx context.Context, id string, opts ...RequestOption) (*BatchOfferRequest, error)
- func (a *API) GetBatchOfferRequestItineraries(ctx context.Context, id string, opts ...RequestOption) (*ItineraryOfferRequest, error)
- func (a *API) GetCustomerUser(ctx context.Context, id string, opts ...RequestOption) (*CustomerUser, error)
- func (a *API) GetCustomerUserGroup(ctx context.Context, id string, opts ...RequestOption) (*CustomerUserGroup, error)
- func (a *API) GetFullPartialOfferRequest(ctx context.Context, requestInput PartialOfferRequestInput, ...) (*OfferRequest, error)
- func (a *API) GetLoyaltyProgramme(ctx context.Context, id string, opts ...RequestOption) (*LoyaltyProgramme, error)
- func (a *API) GetOffer(ctx context.Context, offerID string, params ...GetOfferParams) (*Offer, error)
- func (a *API) GetOfferRequest(ctx context.Context, id string, opts ...RequestOption) (*OfferRequest, error)
- func (a *API) GetOfferRequestItineraries(ctx context.Context, id string, opts ...RequestOption) (*ItineraryOfferRequest, error)
- func (a *API) GetOrder(ctx context.Context, id string, opts ...RequestOption) (*Order, error)
- func (a *API) GetOrderCancellation(ctx context.Context, orderCancellationID string, opts ...RequestOption) (*OrderCancellation, error)
- func (a *API) GetOrderChange(ctx context.Context, id string, opts ...RequestOption) (*OrderChange, error)
- func (a *API) GetOrderChangeOffer(ctx context.Context, id string, opts ...RequestOption) (*OrderChangeOffer, error)
- func (a *API) GetOrderChangeRequest(ctx context.Context, orderChangeRequestID string, opts ...RequestOption) (*OrderChangeRequest, error)
- func (a *API) GetPartialOfferRequests(ctx context.Context, requestInput PartialOfferRequestInput, ...) (*OfferRequest, error)
- func (a *API) GetPayment(ctx context.Context, id string, opts ...RequestOption) (*Payment, error)
- func (a *API) GetSeatmap(ctx context.Context, offerID string, opts ...RequestOption) ([]*Seatmap, error)
- func (a *API) GetUpsellOffers(ctx context.Context, offerID string, opts ...RequestOption) ([]*Offer, error)
- func (a *API) GetWebhookDelivery(ctx context.Context, id string, opts ...RequestOption) (*WebhookDelivery, error)
- func (a *API) GetWebhookEvent(ctx context.Context, id string, opts ...RequestOption) (*WebhookEvent, error)
- func (a *API) LastRateLimit() (*RateLimit, bool)
- func (a *API) LastRequestID() (string, bool)
- func (a *API) ListAircraft(ctx context.Context, opts ...RequestOption) *Iter[Aircraft]
- func (a *API) ListAirlineCredits(ctx context.Context, params ...ListAirlineCreditsParams) *Iter[AirlineCredit]
- func (a *API) ListAirlineInitiatedChanges(ctx context.Context, params ...ListAirlineInitiatedChangesParams) ([]*AirlineInitiatedChanges, error)
- func (a *API) ListAirlines(ctx context.Context, opts ...RequestOption) *Iter[Airline]
- func (a *API) ListAirports(ctx context.Context, params ...ListAirportsParams) *Iter[Airport]
- func (a *API) ListCustomerUserGroups(ctx context.Context, opts ...RequestOption) *Iter[CustomerUserGroup]
- func (a *API) ListCustomerUsers(ctx context.Context, params ...ListCustomerUsersParams) *Iter[CustomerUser]
- func (a *API) ListLoyaltyProgramme(ctx context.Context, opts ...RequestOption) *Iter[LoyaltyProgramme]
- func (a *API) ListOfferRequests(ctx context.Context, opts ...RequestOption) *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, opts ...RequestOption) ([]*AvailableService, error)
- func (a *API) ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order]
- func (a *API) ListPayments(ctx context.Context, orderID string, opts ...RequestOption) *Iter[Payment]
- func (a *API) ListWebhookDeliveries(ctx context.Context, params ...ListWebhookDeliveriesParams) *Iter[WebhookDelivery]
- func (a *API) ListWebhookEvents(ctx context.Context, params ...ListWebhookEventsParams) *Iter[WebhookEvent]
- func (a *API) ListWebhooks(ctx context.Context, opts ...RequestOption) *Iter[Webhook]
- func (a *API) PingWebhook(ctx context.Context, id string, opts ...RequestOption) error
- func (a *API) PlaceSuggestions(ctx context.Context, query string, opts ...RequestOption) ([]*Place, error)
- func (a *API) PriceOffer(ctx context.Context, offerID string, input PriceOfferInput, ...) (*Offer, error)
- func (a *API) PriceOrder(ctx context.Context, id string, input PriceOrderInput, opts ...RequestOption) (*Order, error)
- func (a *API) RedeliverWebhookEvent(ctx context.Context, id string, opts ...RequestOption) error
- func (a *API) SeatmapForOffer(ctx context.Context, offer Offer, opts ...RequestOption) ([]*Seatmap, error)
- func (a *API) UpdateAirlineInitiatedChange(ctx context.Context, id string, input UpdateAirlineInitiatedChangeInput, ...) (*Order, error)
- func (a *API) UpdateCustomerUser(ctx context.Context, id string, input CustomerUserInput, opts ...RequestOption) (*CustomerUser, error)
- func (a *API) UpdateCustomerUserGroup(ctx context.Context, id string, input CustomerUserGroupInput, ...) (*CustomerUserGroup, 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)
- func (a *API) UpdateWebhook(ctx context.Context, id string, input UpdateWebhookInput, ...) (*Webhook, error)
- type ActionTakenType
- type AddOrderServiceInput
- type Aircraft
- type AircraftClient
- type Airline
- type AirlineCredit
- type AirlineCreditClient
- type AirlineCreditType
- type AirlineInitiatedChanges
- type AirlinesClient
- type Airport
- type AirportsClient
- type AvailableActionType
- type AvailableService
- type AvailableServiceMetadata
- type Baggage
- type BaseSlice
- type BatchOfferRequest
- type BookingReference
- type Cabin
- type CabinAmenities
- type CabinClass
- type ChangeCondition
- type City
- type ComponentClientKey
- type ComponentClientKeyInput
- type Conditions
- type CreateAirlineCreditInput
- type CreateCardInput
- type CreateOrderInput
- type CreatePayment
- type CreatePaymentCardRecordRequest
- type CreatePaymentRequest
- type CreateTemporaryPaymentCardRecordFromSavedPaymentCardRequest
- type CreateWebhookInput
- type CustomerUser
- type CustomerUserClient
- type CustomerUserGroup
- type CustomerUserGroupInput
- type CustomerUserInput
- type Date
- type DateTime
- type DecodeError
- 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 IntendedPaymentMethod
- type IntendedPaymentMethodInput
- type IntendedPaymentMethodType
- type IssuedDocument
- type IssuedDocumentType
- type Iter
- type Itinerary
- type ItineraryBrand
- type ItineraryBrandPassenger
- type ItineraryOffer
- type ItineraryOfferRequest
- type ItineraryOfferType
- type ItineraryPassengerSegment
- type ItineraryReferences
- type ItinerarySegment
- type ItinerarySlice
- type ItineraryStop
- type List
- type ListAirlineCreditsParams
- type ListAirlineInitiatedChangesParams
- type ListAirportsParams
- type ListContainer
- type ListCustomerUsersParams
- type ListMeta
- type ListOffersParams
- type ListOffersSortParam
- type ListOrderCancellationParams
- type ListOrderChangeOffersParams
- type ListOrderChangeOffersSortParam
- type ListOrdersParams
- type ListOrdersSort
- type ListWebhookDeliveriesParams
- type ListWebhookEventsParams
- 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 PaymentStatusType
- type PaymentType
- type Place
- type PlaceType
- type PlacesClient
- type PowerAmenity
- type PriceOfferInput
- type PriceOrderInput
- 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]) Put(path string, body *Req, opts ...RequestOption) *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 SeatAmenity
- type SeatLegroom
- type SeatSection
- type SeatType
- type Seatmap
- type SeatmapClient
- type SectionElement
- type SectionService
- type SegmentCabin
- type SegmentPassenger
- type Service
- type ServiceCreateInput
- type ServiceType
- type Slice
- type SliceAdd
- type SliceChange
- type SliceChangeset
- type SliceConditions
- type SliceRemove
- type Stop
- type TaxBreakdownItem
- type ThreeDSecureSession
- type ThreeDSecureSessionInput
- type ThreeDSecureSessionStatus
- type TimeFilter
- type TimeWindow
- type TravelAgentTicket
- type UpdateAirlineInitiatedChangeInput
- type UpdateWebhookInput
- type Webhook
- type WebhookClient
- type WebhookDelivery
- type WebhookEvent
- type WebhookEventData
- type WebhookEventObject
- type WebhookEventType
- type WifiAmenity
- type WifiCost
- 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" PassengerTitleDr PassengerTitle = "dr" 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" // FraudError is opt-in while in preview. Never retry it. FraudError ErrorType = "fraud_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" // The request was assessed as high fraud risk. The rejection is final HighFraudRisk ErrorCode = "high_fraud_risk" // The order has already been paid for AlreadyPaid ErrorCode = "already_paid" // The order's payment_required_by date has elapsed PastPaymentRequiredByDate ErrorCode = "past_payment_required_by_date" // The order changed on the airline's side and cannot be paid, create a new order ScheduleChanged ErrorCode = "schedule_changed" )
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" IntendedPaymentMethodCard IntendedPaymentMethodType = "card" IntendedPaymentMethodAirlineCredit IntendedPaymentMethodType = "airline_credit" WifiCostFree WifiCost = "free" WifiCostFreeOrPaid WifiCost = "free or paid" WifiCostPaid WifiCost = "paid" WifiCostNA WifiCost = "n/a" SeatLegroomLess SeatLegroom = "less" SeatLegroomMore SeatLegroom = "more" SeatLegroomStandard SeatLegroom = "standard" SeatLegroomNA SeatLegroom = "n/a" SeatTypeStandard SeatType = "standard" SeatTypeSkycouch SeatType = "skycouch" SeatTypeRecliner SeatType = "recliner" SeatTypeAngleFlat SeatType = "angle_flat" SeatTypeFullFlat SeatType = "full_flat" SeatTypeFullFlatPod SeatType = "full_flat_pod" SeatTypePrivateSuite SeatType = "private_suite" )
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") AvailableActionTypeUpdate = AvailableActionType("update") IssuedDocumentTypeElectronicTicket = IssuedDocumentType("electronic_ticket") IssuedDocumentTypeElectronicMiscDocumentAssociated = IssuedDocumentType("electronic_miscellaneous_document_associated") IssuedDocumentTypeElectronicMiscDocumentStandalone = IssuedDocumentType("electronic_miscellaneous_document_standalone") OrderContentManaged = OrderContent("managed") OrderContentSelfManaged = OrderContent("self_managed") )
const ( CardBrandVisa PaymentCardBrand = "visa" CardBrandAirplus PaymentCardBrand = "uatp" CardBrandMastercard PaymentCardBrand = "mastercard" CardBrandAmericanExpress PaymentCardBrand = "american_express" CardBrandDinersClub PaymentCardBrand = "diners_club" CardBrandJCB PaymentCardBrand = "jcb" CardBrandDiscover PaymentCardBrand = "discover" ThreeDSecureSessionStatusChallengeRequired ThreeDSecureSessionStatus = "challenge_required" ThreeDSecureSessionStatusReadyForPayment ThreeDSecureSessionStatus = "ready_for_payment" ThreeDSecureSessionStatusFailed ThreeDSecureSessionStatus = "failed" ThreeDSecureSessionStatusExpired ThreeDSecureSessionStatus = "expired" // ThreeDSecureExceptionSecureCorporatePayment opts a corporate card out of issuer authentication. ThreeDSecureExceptionSecureCorporatePayment = "secure_corporate_payment" )
const ( PaymentTypeBalance = PaymentType("balance") PaymentTypeCash = PaymentType("arc_bsp_cash") PaymentTypeCard = PaymentType("card") PaymentTypeAirlineCredit = PaymentType("airline_credit") PaymentStatusSucceeded = PaymentStatusType("succeeded") PaymentStatusFailed = PaymentStatusType("failed") PaymentStatusPending = PaymentStatusType("pending") PaymentStatusCancelled = PaymentStatusType("cancelled") )
const DateFormat = "2006-01-02"
const PlaceTypeAirport = "airport"
const PlaceTypeCity = "city"
const RequestIDHeader = "x-request-id"
const WebhookSignatureHeader = "X-Duffel-Signature"
WebhookSignatureHeader carries t=<unix ts>,v1=<hex HMAC-SHA256> on every webhook delivery.
Variables ¶
var ErrInvalidWebhookSignature = errors.New("duffel: invalid webhook signature")
var ErrNullValue = fmt.Errorf("null value")
var ErrOrderAwaitingCreation = errors.New("duffel: order accepted, not created yet")
ErrOrderAwaitingCreation is returned by CreateOrder with a partial *Order (no ID, Message set) on HTTP 200. The booking may be paid: do not retry, recover the order later with a webhook or ListOrders.
Functions ¶
func ErrIsRetryable ¶
ErrIsRetryable returns true if the request that generated this error is retryable. It sees through wrapped errors.
func IsErrorCode ¶
IsErrorCode reports whether err, possibly wrapped, is a DuffelError with the given code.
func IsErrorType ¶
IsErrorType reports whether err, possibly wrapped, is a DuffelError with the given type.
func RequestIDFromError ¶
RequestIDFromError returns the request ID of a possibly wrapped *DuffelError or *DecodeError, for Duffel support.
func VerifyWebhookSignature ¶ added in v2.3.0
VerifyWebhookSignature checks the X-Duffel-Signature header of a delivery against the raw request body and the secret returned by CreateWebhook. It does not check the timestamp age: reject old deliveries yourself if needed.
Types ¶
type API ¶
type API struct {
APIToken string
// contains filtered or unexported fields
}
API is safe for concurrent use.
func (*API) AcceptAirlineInitiatedChange ¶
func (a *API) AcceptAirlineInitiatedChange(ctx context.Context, id string, opts ...RequestOption) (*Order, error)
AcceptAirlineInitiatedChange accepts an airline-initiated change.
func (*API) AddOrderService ¶
func (a *API) AddOrderService( ctx context.Context, id string, input AddOrderServiceInput, opts ...RequestOption, ) (*Order, error)
AddOrderService adds a service to an order.
func (*API) ConfirmOrderCancellation ¶
func (a *API) ConfirmOrderCancellation(ctx context.Context, orderCancellationID string, opts ...RequestOption) (*OrderCancellation, error)
ConfirmOrderCancellation confirms a pending order cancellation.
func (*API) ConfirmOrderChange ¶
func (a *API) ConfirmOrderChange( ctx context.Context, orderChangeID string, payment PaymentCreateInput, opts ...RequestOption, ) (*OrderChange, error)
ConfirmOrderChange confirms a pending order change (oce_ ID). A zero payment is omitted, for changes with nothing to pay. Only arc_bsp_cash, balance and card are accepted.
func (*API) CreateAirlineCredit ¶ added in v2.3.0
func (a *API) CreateAirlineCredit(ctx context.Context, input CreateAirlineCreditInput, opts ...RequestOption) (*AirlineCredit, error)
func (*API) CreateBatchOfferRequest ¶ added in v2.3.0
func (a *API) CreateBatchOfferRequest( ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption, ) (*BatchOfferRequest, error)
CreateBatchOfferRequest starts a search that returns offers in batches, see GetBatchOfferRequest. It sends SupplierTimeout but not ReturnOffers.
func (*API) CreateCard ¶ added in v2.3.0
func (a *API) CreateCard(ctx context.Context, input CreateCardInput, opts ...RequestOption) (*PaymentCard, error)
CreateCard uses /payments/cards, which replaces /vault/cards in the current spec.
func (*API) CreateComponentClientKey ¶ added in v2.3.0
func (a *API) CreateComponentClientKey( ctx context.Context, input ComponentClientKeyInput, opts ...RequestOption, ) (*ComponentClientKey, error)
CreateComponentClientKey creates a key for Duffel UI components.
func (*API) CreateCustomerUser ¶ added in v2.3.0
func (a *API) CreateCustomerUser(ctx context.Context, input CustomerUserInput, opts ...RequestOption) (*CustomerUser, error)
func (*API) CreateCustomerUserGroup ¶ added in v2.3.0
func (a *API) CreateCustomerUserGroup( ctx context.Context, input CustomerUserGroupInput, opts ...RequestOption, ) (*CustomerUserGroup, error)
func (*API) CreateOfferRequest ¶
func (a *API) CreateOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
func (*API) CreateOfferRequestItineraries ¶ added in v2.3.0
func (a *API) CreateOfferRequestItineraries( ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption, ) (*ItineraryOfferRequest, error)
CreateOfferRequestItineraries is CreateOfferRequest with view=itineraries.
func (*API) CreateOrder ¶
func (a *API) CreateOrder(ctx context.Context, input CreateOrderInput, opts ...RequestOption) (*Order, error)
CreateOrder creates a new order. Outcomes:
- 201: the order is created. err is nil.
- 202: the order exists but the airline has not confirmed it. err is nil and IsPendingConfirmation is set.
- 200: the booking is accepted but the order does not exist yet (card payment flow). The returned Order has only Message set and IsAwaitingCreation true, and err is ErrOrderAwaitingCreation. Do not retry.
- *DecodeError: Duffel answered 2xx but the body was unreadable. The order may exist and be paid. Do not retry.
func (*API) CreateOrderCancellation ¶
func (a *API) CreateOrderCancellation(ctx context.Context, orderID string, opts ...RequestOption) (*OrderCancellation, error)
CreateOrderCancellation creates a new pending order cancellation.
func (*API) CreateOrderChangeRequest ¶
func (a *API) CreateOrderChangeRequest(ctx context.Context, params OrderChangeRequestParams, opts ...RequestOption) ( *OrderChangeRequest, error, )
func (*API) CreatePartialOfferRequest ¶
func (a *API) CreatePartialOfferRequest( ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption, ) (*OfferRequest, error)
CreatePartialOfferRequest sends SupplierTimeout but not ReturnOffers, which the partial endpoint does not take.
func (*API) CreatePayment ¶
func (a *API) CreatePayment(ctx context.Context, req CreatePaymentRequest, opts ...RequestOption) (*Payment, error)
func (*API) CreatePaymentCardRecord ¶
func (a *API) CreatePaymentCardRecord( ctx context.Context, payload *CreatePaymentCardRecordRequest, opts ...RequestOption, ) (*PaymentCard, error)
func (*API) CreatePendingOrderChange ¶
func (a *API) CreatePendingOrderChange(ctx context.Context, offerID string, opts ...RequestOption) ( *OrderChange, error, )
CreatePendingOrderChange creates a new pending order change.
func (*API) CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord ¶
func (a *API) CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord( ctx context.Context, payload *CreateTemporaryPaymentCardRecordFromSavedPaymentCardRequest, opts ...RequestOption, ) (*PaymentCard, error)
func (*API) CreateThreeDSecureSession ¶ added in v2.3.0
func (a *API) CreateThreeDSecureSession( ctx context.Context, input ThreeDSecureSessionInput, opts ...RequestOption, ) (*ThreeDSecureSession, error)
CreateThreeDSecureSession authenticates a card before paying, see PaymentCreateInput.ThreeDSecureSessionID.
func (*API) CreateWebhook ¶ added in v2.3.0
func (a *API) CreateWebhook(ctx context.Context, input CreateWebhookInput, opts ...RequestOption) (*Webhook, error)
func (*API) DeleteCard ¶ added in v2.3.0
func (a *API) DeleteCard(ctx context.Context, id string, opts ...RequestOption) error
func (*API) DeleteCustomerUserGroup ¶ added in v2.3.0
func (a *API) DeleteCustomerUserGroup(ctx context.Context, id string, opts ...RequestOption) error
func (*API) DeleteSavedPaymentCardRecord ¶
func (a *API) DeleteSavedPaymentCardRecord(ctx context.Context, id string, opts ...RequestOption) error
func (*API) DeleteWebhook ¶ added in v2.3.0
func (a *API) DeleteWebhook(ctx context.Context, id string, opts ...RequestOption) error
func (*API) GetAircraft ¶
func (*API) GetAirline ¶
func (*API) GetAirlineCredit ¶ added in v2.3.0
func (a *API) GetAirlineCredit(ctx context.Context, id string, opts ...RequestOption) (*AirlineCredit, error)
func (*API) GetAirport ¶
func (*API) GetBatchOfferRequest ¶ added in v2.3.0
func (a *API) GetBatchOfferRequest(ctx context.Context, id string, opts ...RequestOption) (*BatchOfferRequest, error)
GetBatchOfferRequest returns the offers of the batches finished since the previous call.
func (*API) GetBatchOfferRequestItineraries ¶ added in v2.3.0
func (a *API) GetBatchOfferRequestItineraries(ctx context.Context, id string, opts ...RequestOption) (*ItineraryOfferRequest, error)
GetBatchOfferRequestItineraries is GetBatchOfferRequest with view=itineraries.
func (*API) GetCustomerUser ¶ added in v2.3.0
func (a *API) GetCustomerUser(ctx context.Context, id string, opts ...RequestOption) (*CustomerUser, error)
func (*API) GetCustomerUserGroup ¶ added in v2.3.0
func (a *API) GetCustomerUserGroup(ctx context.Context, id string, opts ...RequestOption) (*CustomerUserGroup, error)
func (*API) GetFullPartialOfferRequest ¶
func (a *API) GetFullPartialOfferRequest(ctx context.Context, requestInput PartialOfferRequestInput, opts ...RequestOption) ( *OfferRequest, error, )
func (*API) GetLoyaltyProgramme ¶
func (a *API) GetLoyaltyProgramme(ctx context.Context, id string, opts ...RequestOption) (*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, opts ...RequestOption) (*OfferRequest, error)
func (*API) GetOfferRequestItineraries ¶ added in v2.3.0
func (a *API) GetOfferRequestItineraries(ctx context.Context, id string, opts ...RequestOption) (*ItineraryOfferRequest, error)
GetOfferRequestItineraries is GetOfferRequest with view=itineraries.
func (*API) GetOrderCancellation ¶
func (a *API) GetOrderCancellation(ctx context.Context, orderCancellationID string, opts ...RequestOption) (*OrderCancellation, error)
GetOrderCancellation retrieves an order cancellation by its ID.
func (*API) GetOrderChange ¶
func (a *API) GetOrderChange(ctx context.Context, id string, opts ...RequestOption) (*OrderChange, error)
GetOrderChange retrieves an order change by its ID.
func (*API) GetOrderChangeOffer ¶
func (a *API) GetOrderChangeOffer(ctx context.Context, id string, opts ...RequestOption) (*OrderChangeOffer, error)
GetOrderChangeOffer retrieves an order change offer by its ID.
func (*API) GetOrderChangeRequest ¶
func (a *API) GetOrderChangeRequest( ctx context.Context, orderChangeRequestID string, opts ...RequestOption, ) (*OrderChangeRequest, error)
GetOrderChangeRequest retrieves an order change request by its ID.
func (*API) GetPartialOfferRequests ¶
func (a *API) GetPartialOfferRequests(ctx context.Context, requestInput PartialOfferRequestInput, opts ...RequestOption) ( *OfferRequest, error, )
func (*API) GetPayment ¶ added in v2.3.0
func (*API) GetSeatmap ¶
func (*API) GetUpsellOffers ¶ added in v2.3.0
func (a *API) GetUpsellOffers(ctx context.Context, offerID string, opts ...RequestOption) ([]*Offer, error)
GetUpsellOffers returns the higher fare brands available for an offer.
func (*API) GetWebhookDelivery ¶ added in v2.3.0
func (a *API) GetWebhookDelivery(ctx context.Context, id string, opts ...RequestOption) (*WebhookDelivery, error)
func (*API) GetWebhookEvent ¶ added in v2.3.0
func (a *API) GetWebhookEvent(ctx context.Context, id string, opts ...RequestOption) (*WebhookEvent, error)
func (*API) LastRateLimit ¶ added in v2.2.0
func (*API) LastRequestID ¶
func (*API) ListAircraft ¶
func (a *API) ListAircraft(ctx context.Context, opts ...RequestOption) *Iter[Aircraft]
func (*API) ListAirlineCredits ¶ added in v2.3.0
func (a *API) ListAirlineCredits(ctx context.Context, params ...ListAirlineCreditsParams) *Iter[AirlineCredit]
func (*API) ListAirlineInitiatedChanges ¶
func (a *API) ListAirlineInitiatedChanges( ctx context.Context, params ...ListAirlineInitiatedChangesParams, ) ([]*AirlineInitiatedChanges, error)
ListAirlineInitiatedChanges returns a list of airline-initiated changes.
func (*API) ListAirlines ¶
func (a *API) ListAirlines(ctx context.Context, opts ...RequestOption) *Iter[Airline]
func (*API) ListAirports ¶
func (a *API) ListAirports(ctx context.Context, params ...ListAirportsParams) *Iter[Airport]
func (*API) ListCustomerUserGroups ¶ added in v2.3.0
func (a *API) ListCustomerUserGroups(ctx context.Context, opts ...RequestOption) *Iter[CustomerUserGroup]
func (*API) ListCustomerUsers ¶ added in v2.3.0
func (a *API) ListCustomerUsers(ctx context.Context, params ...ListCustomerUsersParams) *Iter[CustomerUser]
func (*API) ListLoyaltyProgramme ¶
func (a *API) ListLoyaltyProgramme(ctx context.Context, opts ...RequestOption) *Iter[LoyaltyProgramme]
ListLoyaltyProgramme retrieves a paginated list of loyalty programmes.
func (*API) ListOfferRequests ¶
func (a *API) ListOfferRequests(ctx context.Context, opts ...RequestOption) *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, opts ...RequestOption) ([]*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) ListPayments ¶ added in v2.3.0
func (a *API) ListPayments(ctx context.Context, orderID string, opts ...RequestOption) *Iter[Payment]
ListPayments lists the payments of an order, which Duffel requires.
func (*API) ListWebhookDeliveries ¶ added in v2.3.0
func (a *API) ListWebhookDeliveries(ctx context.Context, params ...ListWebhookDeliveriesParams) *Iter[WebhookDelivery]
func (*API) ListWebhookEvents ¶ added in v2.3.0
func (a *API) ListWebhookEvents(ctx context.Context, params ...ListWebhookEventsParams) *Iter[WebhookEvent]
func (*API) ListWebhooks ¶ added in v2.3.0
func (a *API) ListWebhooks(ctx context.Context, opts ...RequestOption) *Iter[Webhook]
func (*API) PingWebhook ¶ added in v2.3.0
func (a *API) PingWebhook(ctx context.Context, id string, opts ...RequestOption) error
PingWebhook makes Duffel send a ping.triggered event to the webhook.
func (*API) PlaceSuggestions ¶
func (*API) PriceOffer ¶ added in v2.3.0
func (a *API) PriceOffer(ctx context.Context, offerID string, input PriceOfferInput, opts ...RequestOption) (*Offer, error)
PriceOffer adds card surcharges and airline credit penalties to the offer. Nil IntendedServices is sent as [].
func (*API) PriceOrder ¶ added in v2.3.0
func (a *API) PriceOrder(ctx context.Context, id string, input PriceOrderInput, opts ...RequestOption) (*Order, error)
PriceOrder prices an unpaid hold order for the payment methods you intend to use.
func (*API) RedeliverWebhookEvent ¶ added in v2.3.0
func (a *API) RedeliverWebhookEvent(ctx context.Context, id string, opts ...RequestOption) error
func (*API) SeatmapForOffer ¶
func (*API) UpdateAirlineInitiatedChange ¶
func (a *API) UpdateAirlineInitiatedChange( ctx context.Context, id string, input UpdateAirlineInitiatedChangeInput, opts ...RequestOption, ) (*Order, error)
UpdateAirlineInitiatedChange updates an airline-initiated change.
func (*API) UpdateCustomerUser ¶ added in v2.3.0
func (a *API) UpdateCustomerUser(ctx context.Context, id string, input CustomerUserInput, opts ...RequestOption) (*CustomerUser, error)
func (*API) UpdateCustomerUserGroup ¶ added in v2.3.0
func (a *API) UpdateCustomerUserGroup( ctx context.Context, id string, input CustomerUserGroupInput, opts ...RequestOption, ) (*CustomerUserGroup, error)
func (*API) UpdateOfferPassenger ¶
func (a *API) UpdateOfferPassenger( ctx context.Context, offerRequestID, passengerID string, input PassengerUpdateInput, opts ...RequestOption, ) (*OfferRequestPassenger, error)
UpdateOfferPassenger updates a single offer passenger.
func (*API) UpdateOrder ¶
func (a *API) UpdateOrder(ctx context.Context, id string, params OrderUpdateParams, opts ...RequestOption) ( *Order, error, )
UpdateOrder updates an existing order with update-able fields (mostly metadata).
func (*API) UpdateWebhook ¶ added in v2.3.0
func (a *API) UpdateWebhook(ctx context.Context, id string, input UpdateWebhookInput, opts ...RequestOption) (*Webhook, error)
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 AirlineCredit struct {
RawCreditAmount string `json:"credit_amount"`
RawCreditCurrency string `json:"credit_currency"`
CreditCode string `json:"credit_code"`
CreditName string `json:"credit_name"`
ID string `json:"id"`
IssuedOn Date `json:"issued_on"`
PassengerID string `json:"passenger_id"`
Type AirlineCreditType `json:"type,omitempty"`
RawAmount string `json:"amount,omitempty"`
RawAmountCurrency string `json:"amount_currency,omitempty"`
Code string `json:"code,omitempty"`
// The fields below are only set on issued credits.
AirlineIATACode string `json:"airline_iata_code,omitempty"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
UserID string `json:"user_id,omitempty"`
OrderID string `json:"order_id,omitempty"`
RawPenaltyAmount *string `json:"penalty_amount,omitempty"`
RawPenaltyCurrency *string `json:"penalty_currency,omitempty"`
LiveMode bool `json:"live_mode,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
SpentAt *time.Time `json:"spent_at,omitempty"`
InvalidatedAt *time.Time `json:"invalidated_at,omitempty"`
}
AirlineCredit is a credit quote on a pending cancellation, or an issued credit elsewhere. The credit_* fields are the older names of amount, amount_currency and code.
func (*AirlineCredit) Amount ¶ added in v2.3.0
func (c *AirlineCredit) Amount() currency.Amount
Amount falls back to the older credit_amount and credit_currency fields.
func (*AirlineCredit) PenaltyAmount ¶ added in v2.3.0
func (c *AirlineCredit) PenaltyAmount() *currency.Amount
type AirlineCreditClient ¶ added in v2.3.0
type AirlineCreditClient interface {
ListAirlineCredits(ctx context.Context, params ...ListAirlineCreditsParams) *Iter[AirlineCredit]
GetAirlineCredit(ctx context.Context, id string, opts ...RequestOption) (*AirlineCredit, error)
CreateAirlineCredit(ctx context.Context, input CreateAirlineCreditInput, opts ...RequestOption) (*AirlineCredit, error)
}
type AirlineCreditType ¶ added in v2.3.0
type AirlineCreditType string
const ( AirlineCreditTypeETicket AirlineCreditType = "eticket" AirlineCreditTypeMCO AirlineCreditType = "mco" AirlineCreditTypeEMD AirlineCreditType = "emd" )
type AirlineInitiatedChanges ¶
type AirlineInitiatedChanges struct {
ID string `json:"id"`
ActionTaken ActionTakenType `json:"action_taken"`
ActionTakenAt time.Time `json:"action_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"`
// TravelAgentTicket is set when the change needs manual handling by Duffel.
TravelAgentTicket *TravelAgentTicket `json:"travel_agent_ticket,omitempty"`
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" `
CityName string `json:"city_name" `
IATACode string `json:"iata_code" `
IATACountryCode string `json:"iata_country_code" `
IATACityCode string `json:"iata_city_code,omitempty"`
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
AvailableActionType is shared by orders (cancel, change, update) and airline-initiated changes (adds accept).
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
// Duffel sends decimals or null for these.
MaximumDepthCM *float64 `json:"maximum_depth_cm,omitempty"` // e.g. 30
MaximumHeightCM *float64 `json:"maximum_height_cm,omitempty"` // e.g. 40
MaximumLengthCM *float64 `json:"maximum_length_cm,omitempty"` // e.g. 55
MaximumWeightKg *float64 `json:"maximum_weight_kg,omitempty"` // e.g. 23.5
// 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"`
CreatedAt time.Time `json:"created_at"`
}
type BatchOfferRequest ¶ added in v2.3.0
type BatchOfferRequest struct {
ID string `json:"id"`
ClientKey string `json:"client_key"`
LiveMode bool `json:"live_mode"`
CreatedAt time.Time `json:"created_at"`
TotalBatches int `json:"total_batches"`
RemainingBatches int `json:"remaining_batches"`
Offers []Offer `json:"offers,omitempty"`
}
BatchOfferRequest is polled until RemainingBatches is 0, each poll returning only newly finished offers.
type BookingReference ¶ added in v2.3.0
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 CabinAmenities ¶ added in v2.3.0
type CabinAmenities struct {
Wifi *WifiAmenity `json:"wifi,omitempty"`
Seat *SeatAmenity `json:"seat,omitempty"`
Power *PowerAmenity `json:"power,omitempty"`
}
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 ComponentClientKey ¶ added in v2.3.0
type ComponentClientKey struct {
ComponentClientKey string `json:"component_client_key"`
}
type ComponentClientKeyInput ¶ added in v2.3.0
type ComponentClientKeyInput struct {
UserID string `json:"user_id,omitempty"`
OrderID string `json:"order_id,omitempty"`
BookingID string `json:"booking_id,omitempty"`
}
ComponentClientKeyInput signs UserID alone or with OrderID or BookingID. Empty gives an anonymous key.
type Conditions ¶
type Conditions struct {
RefundBeforeDeparture *ChangeCondition `json:"refund_before_departure,omitempty"`
ChangeBeforeDeparture *ChangeCondition `json:"change_before_departure,omitempty"`
}
type CreateAirlineCreditInput ¶ added in v2.3.0
type CreateAirlineCreditInput struct {
AirlineIATACode string `json:"airline_iata_code"`
Amount string `json:"amount"`
AmountCurrency string `json:"amount_currency"`
Code string `json:"code"`
Type AirlineCreditType `json:"type"`
IssuedOn Date `json:"issued_on"`
ExpiresAt time.Time `json:"expires_at"`
UserID string `json:"user_id,omitempty"`
GivenName string `json:"given_name,omitempty"`
FamilyName string `json:"family_name,omitempty"`
}
CreateAirlineCreditInput records a credit issued outside Duffel. Set UserID, or GivenName and FamilyName.
type CreateCardInput ¶ added in v2.3.0
type CreateCardInput struct {
Name string `json:"name,omitempty"`
Number string `json:"number,omitempty"`
ExpiryMonth string `json:"expiry_month,omitempty"`
ExpiryYear string `json:"expiry_year,omitempty"`
SecurityCode string `json:"cvc,omitempty"`
AddressLine1 string `json:"address_line_1,omitempty"`
AddressLine2 string `json:"address_line_2,omitempty"`
AddressCity string `json:"address_city,omitempty"`
AddressRegion string `json:"address_region,omitempty"`
AddressPostalCode string `json:"address_postal_code,omitempty"`
AddressCountryCode string `json:"address_country_code,omitempty"`
MultiUse bool `json:"multi_use,omitempty"`
CardID string `json:"card_id,omitempty"`
}
CreateCardInput creates a card on /payments/cards. To get a single-use card from a multi-use one, set CardID and SecurityCode only.
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"`
// Users are the IDs of the customer users allowed to manage the order.
Users []string `json:"users,omitempty"`
}
type CreatePayment ¶
type CreatePayment struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
Type PaymentType `json:"type"`
CardID string `json:"card_id,omitempty"`
ThreeDSecureSessionID string `json:"three_d_secure_session_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 CreateWebhookInput ¶ added in v2.3.0
type CreateWebhookInput struct {
URL string `json:"url"`
Events []WebhookEventType `json:"events"`
}
type CustomerUser ¶ added in v2.3.0
type CustomerUser struct {
ID string `json:"id"`
Email string `json:"email"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
PhoneNumber string `json:"phone_number"`
PreferredLanguage string `json:"preferred_language"`
Group *CustomerUserGroup `json:"group,omitempty"`
LiveMode bool `json:"live_mode"`
CreatedAt time.Time `json:"created_at"`
}
type CustomerUserClient ¶ added in v2.3.0
type CustomerUserClient interface {
CreateCustomerUser(ctx context.Context, input CustomerUserInput, opts ...RequestOption) (*CustomerUser, error)
GetCustomerUser(ctx context.Context, id string, opts ...RequestOption) (*CustomerUser, error)
UpdateCustomerUser(ctx context.Context, id string, input CustomerUserInput, opts ...RequestOption) (*CustomerUser, error)
ListCustomerUsers(ctx context.Context, params ...ListCustomerUsersParams) *Iter[CustomerUser]
CreateCustomerUserGroup(ctx context.Context, input CustomerUserGroupInput, opts ...RequestOption) (*CustomerUserGroup, error)
GetCustomerUserGroup(ctx context.Context, id string, opts ...RequestOption) (*CustomerUserGroup, error)
UpdateCustomerUserGroup(ctx context.Context, id string, input CustomerUserGroupInput, opts ...RequestOption) (*CustomerUserGroup, error)
ListCustomerUserGroups(ctx context.Context, opts ...RequestOption) *Iter[CustomerUserGroup]
DeleteCustomerUserGroup(ctx context.Context, id string, opts ...RequestOption) error
CreateComponentClientKey(ctx context.Context, input ComponentClientKeyInput, opts ...RequestOption) (*ComponentClientKey, error)
}
type CustomerUserGroup ¶ added in v2.3.0
type CustomerUserGroup struct {
ID string `json:"id"`
Name string `json:"name"`
UserIDs []string `json:"user_ids,omitempty"`
}
CustomerUserGroup has no UserIDs when nested in CustomerUser.
type CustomerUserGroupInput ¶ added in v2.3.0
type CustomerUserGroupInput struct {
Name string `json:"name,omitempty"`
UserIDs []string `json:"user_ids,omitempty"`
}
CustomerUserGroupInput requires Name on create. On update, unset fields are left unchanged.
type CustomerUserInput ¶ added in v2.3.0
type CustomerUserInput struct {
Email string `json:"email"`
GivenName string `json:"given_name"`
FamilyName string `json:"family_name"`
// PhoneNumber is in E.164 format.
PhoneNumber string `json:"phone_number,omitempty"`
// PreferredLanguage is an ISO 639-1 code such as "en".
PreferredLanguage string `json:"preferred_language,omitempty"`
GroupID string `json:"group_id,omitempty"`
}
CustomerUserInput is sent whole by UpdateCustomerUser, which is a PUT.
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 DecodeError ¶ added in v2.2.0
DecodeError means Duffel answered 2xx but the body was unreadable or empty. The request may have had side effects such as a paid order, so it is not a transport failure.
func (*DecodeError) Error ¶ added in v2.2.0
func (e *DecodeError) Error() string
func (*DecodeError) Unwrap ¶ added in v2.2.0
func (e *DecodeError) Unwrap() error
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
AirlineCreditClient
WebhookClient
CustomerUserClient
// LastRequestID returns the x-request-id of the latest response. Under concurrent use it may belong
// to another call: prefer RequestIDFromError or List.LastRequestID for a value tied to one call.
LastRequestID() (string, bool)
// LastRateLimit returns the latest valid Ratelimit-* headers. Under concurrent use it may belong to another call.
LastRateLimit() (*RateLimit, bool)
}
type DuffelError ¶
type DuffelError struct {
Meta ErrorMeta `json:"meta"`
Errors []Error `json:"errors"`
StatusCode int `json:"-"`
Retryable bool `json:"-"`
// RetryAfter is the wait advised by the Ratelimit-Reset header on a 429, zero otherwise.
RetryAfter time.Duration `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 ErrorSource struct {
Field string `json:"field"`
Pointer string `json:"pointer"`
Airline string `json:"-"`
}
func (*ErrorSource) UnmarshalJSON ¶ added in v2.1.1
func (s *ErrorSource) UnmarshalJSON(data []byte) error
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 IntendedPaymentMethod ¶ added in v2.3.0
type IntendedPaymentMethod struct {
Type IntendedPaymentMethodType `json:"type"`
CardID string `json:"card_id,omitempty"`
AirlineCreditID string `json:"airline_credit_id,omitempty"`
RawChargeAmount string `json:"charge_amount"`
RawChargeCurrency string `json:"charge_currency"`
RawSurchargeAmount *string `json:"surcharge_amount,omitempty"`
RawSurchargeCurrency *string `json:"surcharge_currency,omitempty"`
RawPenaltyAmount *string `json:"penalty_amount,omitempty"`
RawPenaltyCurrency *string `json:"penalty_currency,omitempty"`
}
IntendedPaymentMethod is a priced payment method: card fields for type card, airline credit fields for type airline_credit.
func (*IntendedPaymentMethod) ChargeAmount ¶ added in v2.3.0
func (m *IntendedPaymentMethod) ChargeAmount() currency.Amount
func (*IntendedPaymentMethod) PenaltyAmount ¶ added in v2.3.0
func (m *IntendedPaymentMethod) PenaltyAmount() *currency.Amount
PenaltyAmount is set for airline credits only.
func (*IntendedPaymentMethod) SurchargeAmount ¶ added in v2.3.0
func (m *IntendedPaymentMethod) SurchargeAmount() *currency.Amount
SurchargeAmount is set for cards only.
type IntendedPaymentMethodInput ¶ added in v2.3.0
type IntendedPaymentMethodInput struct {
Type IntendedPaymentMethodType `json:"type"`
CardID string `json:"card_id,omitempty"`
AirlineCreditID string `json:"airline_credit_id,omitempty"`
}
IntendedPaymentMethodInput sets CardID for type card or AirlineCreditID for type airline_credit.
type IntendedPaymentMethodType ¶ added in v2.3.0
type IntendedPaymentMethodType string
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 Itinerary ¶ added in v2.3.0
type Itinerary struct {
Segments []ItinerarySegment `json:"segments"`
Brands []ItineraryBrand `json:"brands"`
}
type ItineraryBrand ¶ added in v2.3.0
type ItineraryBrand struct {
FareBrandName string `json:"fare_brand_name"`
NGSShelf *int `json:"ngs_shelf,omitempty"`
Conditions *Conditions `json:"conditions,omitempty"`
Offers []ItineraryOffer `json:"offers"`
Passengers []ItineraryBrandPassenger `json:"passengers"`
}
type ItineraryBrandPassenger ¶ added in v2.3.0
type ItineraryBrandPassenger struct {
PassengerID string `json:"passenger_id"`
Segments []ItineraryPassengerSegment `json:"segments"`
}
type ItineraryOffer ¶ added in v2.3.0
type ItineraryOffer struct {
ID string `json:"id"`
Type ItineraryOfferType `json:"type"`
Owner string `json:"owner"`
ExpiresAt *time.Time `json:"expires_at,omitempty"`
RawTotalAmount string `json:"total_amount"`
RawTotalCurrency string `json:"total_currency"`
RawBaseAmount string `json:"base_amount"`
RawBaseCurrency string `json:"base_currency"`
RawTaxAmount string `json:"tax_amount"`
RawTaxCurrency string `json:"tax_currency"`
TotalEmissionsKg any `json:"total_emissions_kg"`
Conditions *Conditions `json:"conditions,omitempty"`
PaymentRequirements *OfferPaymentRequirement `json:"payment_requirements,omitempty"`
PassengerIdentityDocumentsRequired bool `json:"passenger_identity_documents_required"`
SupportedPassengerIdentityDocumentTypes []string `json:"supported_passenger_identity_document_types"`
AvailableAirlineCreditIDs []string `json:"available_airline_credit_ids"`
// The spec leaves these two untyped.
SupportedLoyaltyProgrammes json.RawMessage `json:"supported_loyalty_programmes,omitempty"`
PrivateFares json.RawMessage `json:"private_fares,omitempty"`
}
func (*ItineraryOffer) TotalAmount ¶ added in v2.3.0
func (o *ItineraryOffer) TotalAmount() currency.Amount
type ItineraryOfferRequest ¶ added in v2.3.0
type ItineraryOfferRequest struct {
ID string `json:"id"`
ClientKey string `json:"client_key"`
LiveMode bool `json:"live_mode"`
CreatedAt time.Time `json:"created_at"`
CabinClass CabinClass `json:"cabin_class"`
AirlineCreditIDs []string `json:"airline_credit_ids"`
Passengers []OfferRequestPassenger `json:"passengers"`
References ItineraryReferences `json:"references"`
Slices []ItinerarySlice `json:"slices"`
// Batch fields are only set on batch offer requests.
TotalBatches *int `json:"total_batches,omitempty"`
RemainingBatches *int `json:"remaining_batches,omitempty"`
}
ItineraryOfferRequest is the view=itineraries shape, with airlines, places and aircraft referenced by ID.
type ItineraryOfferType ¶ added in v2.3.0
type ItineraryOfferType string
const ( ItineraryOfferTypeSingleTicket ItineraryOfferType = "single_ticket" ItineraryOfferTypeSplitTicket ItineraryOfferType = "split_ticket" )
type ItineraryPassengerSegment ¶ added in v2.3.0
type ItineraryPassengerSegment struct {
Baggages []Baggage `json:"baggages"`
Cabin *SegmentCabin `json:"cabin,omitempty"`
CabinClass CabinClass `json:"cabin_class"`
CabinClassMarketingName string `json:"cabin_class_marketing_name"`
FareBasisCode string `json:"fare_basis_code"`
}
type ItineraryReferences ¶ added in v2.3.0
type ItinerarySegment ¶ added in v2.3.0
type ItinerarySegment struct {
Origin string `json:"origin"`
OriginTerminal string `json:"origin_terminal"`
Destination string `json:"destination"`
DestinationTerminal string `json:"destination_terminal"`
RawDepartingAt string `json:"departing_at"`
RawArrivingAt string `json:"arriving_at"`
Duration Duration `json:"duration"`
Distance Distance `json:"distance"`
Aircraft string `json:"aircraft"`
MarketingCarrier string `json:"marketing_carrier"`
MarketingCarrierFlightNumber string `json:"marketing_carrier_flight_number"`
OperatingCarrier string `json:"operating_carrier"`
OperatingCarrierFlightNumber string `json:"operating_carrier_flight_number"`
Stops []ItineraryStop `json:"stops"`
}
ItinerarySegment holds place, airline and aircraft IDs, resolved through ItineraryReferences.
type ItinerarySlice ¶ added in v2.3.0
type ItinerarySlice struct {
Origin string `json:"origin"`
Destination string `json:"destination"`
Itineraries []Itinerary `json:"itineraries"`
}
ItinerarySlice holds place IDs, resolved through ItineraryReferences.Places.
type ItineraryStop ¶ added in v2.3.0
type ListAirlineCreditsParams ¶ added in v2.3.0
type ListAirlineCreditsParams struct {
UserID string
}
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 ListCustomerUsersParams ¶ added in v2.3.0
type ListCustomerUsersParams struct {
Email string
}
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
// 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
// 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
// Filters the returned orders by owner.id. Values must be valid airline.ids.
// Check the Airline schema for details.
OwnerIDs []string
// Filters the returned orders by origin. Values must be valid origin identifiers.
// Check the Order schema for details.
OriginIDs []string
// Filters the returned orders by destination. Values must be valid destination identifiers.
// Check the Order schema for details.
DestinationIDs []string
// Filters the returned orders by departure datetime.
// Orders will be included if any of their segments matches the given criteria.
// Segment times are local: the wall clock is sent and the zone ignored.
DepartingAt *TimeFilter
// Filters the returned orders by arrival datetime.
// Orders will be included if any of their segments matches the given criteria.
// Segment times are local: the wall clock is sent and the zone ignored.
ArrivingAt *TimeFilter
// Filters the returned orders by creation datetime. Any zone works, the value is sent in UTC.
CreatedAt *TimeFilter
// 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
}
type ListOrdersSort ¶
type ListOrdersSort string
type ListWebhookDeliveriesParams ¶ added in v2.3.0
type ListWebhookDeliveriesParams struct {
Type WebhookEventType
DeliverySuccess *bool
EndpointID string
CreatedAt *TimeFilter
}
type ListWebhookEventsParams ¶ added in v2.3.0
type ListWebhookEventsParams struct {
Type WebhookEventType
DeliverySuccess *bool
CreatedAt *TimeFilter
}
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 LoyaltyProgramme struct {
Alliance string `json:"alliance"`
ID string `json:"id"`
Name string `json:"name"`
LogoURL string `json:"logo_url"`
// OwnerAirlineID is deprecated by Duffel in favour of OwnerAirline.
OwnerAirlineID string `json:"owner_airline_id"`
OwnerAirline *Airline `json:"owner_airline,omitempty"`
}
type LoyaltyProgrammeAccount ¶
type LoyaltyProgrammeClient ¶
type LoyaltyProgrammeClient interface {
ListLoyaltyProgramme(ctx context.Context, opts ...RequestOption) *Iter[LoyaltyProgramme]
GetLoyaltyProgramme(ctx context.Context, id string, opts ...RequestOption) (*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 any `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"])
AvailableAirlineCreditIDs []string `json:"available_airline_credit_ids,omitempty"`
IntendedPaymentMethods []IntendedPaymentMethod `json:"intended_payment_methods,omitempty"`
IntendedServices []ServiceCreateInput `json:"intended_services,omitempty"`
// TaxBreakdown is only returned by GetOffer.
TaxBreakdown []TaxBreakdownItem `json:"tax_breakdown,omitempty"`
}
func (*Offer) BaseAmount ¶
func (*Offer) TotalAmount ¶
type OfferClient ¶
type OfferClient interface {
UpdateOfferPassenger(
ctx context.Context, offerRequestID, passengerID string, input PassengerUpdateInput,
opts ...RequestOption,
) (*OfferRequestPassenger, error)
ListOffers(ctx context.Context, reqId string, options ...ListOffersParams) *Iter[Offer]
GetOffer(ctx context.Context, id string, params ...GetOfferParams) (*Offer, error)
PriceOffer(ctx context.Context, offerID string, input PriceOfferInput, opts ...RequestOption) (*Offer, error)
GetUpsellOffers(ctx context.Context, offerID string, opts ...RequestOption) ([]*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"`
AirlineCreditIDs []string `json:"airline_credit_ids,omitempty"`
}
OfferRequest is the response from the OfferRequest endpoint, created using the OfferRequestInput.
type OfferRequestClient ¶
type OfferRequestClient interface {
CreateOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
GetOfferRequest(ctx context.Context, id string, opts ...RequestOption) (*OfferRequest, error)
CreateOfferRequestItineraries(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*ItineraryOfferRequest, error)
GetOfferRequestItineraries(ctx context.Context, id string, opts ...RequestOption) (*ItineraryOfferRequest, error)
CreateBatchOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*BatchOfferRequest, error)
GetBatchOfferRequest(ctx context.Context, id string, opts ...RequestOption) (*BatchOfferRequest, error)
GetBatchOfferRequestItineraries(ctx context.Context, id string, opts ...RequestOption) (*ItineraryOfferRequest, error)
CreatePartialOfferRequest(ctx context.Context, requestInput OfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
GetFullPartialOfferRequest(ctx context.Context, requestInput PartialOfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
GetPartialOfferRequests(ctx context.Context, requestInput PartialOfferRequestInput, opts ...RequestOption) (*OfferRequest, error)
ListOfferRequests(ctx context.Context, opts ...RequestOption) *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:"-"`
// AirlineCreditIDs are checked against the returned offers, see Offer.AvailableAirlineCreditIDs.
AirlineCreditIDs []string `json:"airline_credit_ids,omitempty" url:"-"`
// IncludeSplitTicket adds one-way searches per slice to find split-ticket combinations.
IncludeSplitTicket bool `json:"include_split_ticket,omitempty" url:"-"`
ReturnOffers bool `json:"-" url:"return_offers"`
// The maximum amount of time in milliseconds to wait for each airline to respond, 2000 to 60000, default 20000.
// Keep it below the client Timeout to get partial results instead of a client timeout. Zero leaves it unset.
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"`
UserID string `json:"user_id,omitempty"`
}
type OfferRequestSlice ¶
type OfferRequestSlice struct {
DepartureDate Date `json:"departure_date"`
Destination string `json:"destination"`
Origin string `json:"origin"`
DepartureTime *TimeWindow `json:"departure_time,omitempty"`
ArrivalTime *TimeWindow `json:"arrival_time,omitempty"`
}
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"`
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"`
// AvailableActions lists what can be done on the order: cancel, change or update.
AvailableActions []AvailableActionType `json:"available_actions,omitempty"`
IsPendingConfirmation bool `json:"-"`
IsAwaitingCreation bool `json:"-"`
// BookingReferences lists every carrier PNR on the order, including BookingReference.
BookingReferences []BookingReference `json:"booking_references,omitempty"`
// IntendedPaymentMethods is only set on unpaid hold orders.
IntendedPaymentMethods []IntendedPaymentMethod `json:"intended_payment_methods,omitempty"`
TaxBreakdown []TaxBreakdownItem `json:"tax_breakdown,omitempty"`
// Users are the IDs of the customer users allowed to manage the order.
Users []string `json:"users,omitempty"`
// VoidWindowEndsAt is set while a paid order can still be voided.
VoidWindowEndsAt *time.Time `json:"void_window_ends_at,omitempty"`
}
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"`
}
OrderCancellation times are RFC 3339 strings, parsed by the *AtTime accessors.
func (*OrderCancellation) ConfirmedAtTime ¶ added in v2.2.0
func (o *OrderCancellation) ConfirmedAtTime() (time.Time, bool)
ConfirmedAtTime returns false while the cancellation is pending (confirmed_at is null).
func (*OrderCancellation) CreatedAtTime ¶ added in v2.2.0
func (o *OrderCancellation) CreatedAtTime() (time.Time, bool)
func (*OrderCancellation) ExpiresAtTime ¶ added in v2.2.0
func (o *OrderCancellation) ExpiresAtTime() (time.Time, bool)
func (*OrderCancellation) RefundAmount ¶
func (o *OrderCancellation) RefundAmount() currency.Amount
type OrderCancellationClient ¶
type OrderCancellationClient interface {
CreateOrderCancellation(ctx context.Context, orderID string, opts ...RequestOption) (*OrderCancellation, error)
ConfirmOrderCancellation(ctx context.Context, orderCancellationID string, opts ...RequestOption) (*OrderCancellation, error)
GetOrderCancellation(ctx context.Context, orderCancellationID string, opts ...RequestOption) (*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, opts ...RequestOption,
) (*OrderChangeRequest, error)
GetOrderChangeRequest(ctx context.Context, id string, opts ...RequestOption) (*OrderChangeRequest, error)
CreatePendingOrderChange(ctx context.Context, orderChangeRequestID string, opts ...RequestOption) (
*OrderChange, error,
)
ConfirmOrderChange(
ctx context.Context, id string, payment PaymentCreateInput, opts ...RequestOption,
) (*OrderChange, error)
GetOrderChange(ctx context.Context, id string, opts ...RequestOption) (*OrderChange, error)
GetOrderChangeOffer(ctx context.Context, id string, opts ...RequestOption) (*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"`
}
type OrderClient ¶
type OrderClient interface {
// GetOrder Get a single order by ID.
GetOrder(ctx context.Context, id string, opts ...RequestOption) (*Order, error)
// UpdateOrder Update a single order by ID.
UpdateOrder(ctx context.Context, id string, params OrderUpdateParams, opts ...RequestOption) (*Order, error)
// ListOrders List orders.
ListOrders(ctx context.Context, params ...ListOrdersParams) *Iter[Order]
// CreateOrder Create an order.
CreateOrder(ctx context.Context, input CreateOrderInput, opts ...RequestOption) (*Order, error)
// ListOrderServices List available services for an order.
ListOrderServices(ctx context.Context, id string, opts ...RequestOption) ([]*AvailableService, error)
// AddOrderService Add a service to an order.
AddOrderService(ctx context.Context, id string, input AddOrderServiceInput, opts ...RequestOption) (
*Order, error,
)
// UpdateAirlineInitiatedChange Update an airline-initiated change.
UpdateAirlineInitiatedChange(
ctx context.Context, id string, input UpdateAirlineInitiatedChangeInput, opts ...RequestOption,
) (
*Order, error,
)
// AcceptAirlineInitiatedChange Accept an airline-initiated change.
AcceptAirlineInitiatedChange(ctx context.Context, id string, opts ...RequestOption) (*Order, error)
// PriceOrder Price a hold order with the payment methods you intend to use.
PriceOrder(ctx context.Context, id string, input PriceOrderInput, opts ...RequestOption) (*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"`
// UserID links the passenger to a customer user, on CreateOrder only.
UserID string `json:"user_id,omitempty"`
// 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, opts ...RequestOption) (*Payment, error)
GetPayment(ctx context.Context, id string, opts ...RequestOption) (*Payment, error)
ListPayments(ctx context.Context, orderID string, opts ...RequestOption) *Iter[Payment]
}
type OrderUpdateParams ¶
type OrderUpdateParams struct {
// Metadata replaces the order metadata. An empty non-nil map clears it, a nil map is sent as null.
Metadata map[string]any `json:"metadata"`
// Users replaces the customer users allowed to manage the order. Nil leaves them unchanged.
Users []string `json:"users,omitempty"`
}
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 Payment ¶
type Payment struct {
Amount string `json:"amount"`
CreatedAt DateTime `json:"created_at"`
Currency string `json:"currency"`
ID string `json:"id"`
LiveMode bool `json:"live_mode"`
Type PaymentType `json:"type"`
OrderID string `json:"order_id,omitempty"`
// Status moves from pending to failed or succeeded.
Status PaymentStatusType `json:"status,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
AirlineCreditID string `json:"airline_credit_id,omitempty"`
}
type PaymentCard ¶
type PaymentCardBrand ¶
type PaymentCardBrand string
type PaymentCardClient ¶
type PaymentCardClient interface {
CreatePaymentCardRecord(
ctx context.Context, payload *CreatePaymentCardRecordRequest,
opts ...RequestOption,
) (*PaymentCard, error)
CreateTemporaryPaymentCardRecordFromSavedPaymentCardRecord(
ctx context.Context, payload *CreateTemporaryPaymentCardRecordFromSavedPaymentCardRequest,
opts ...RequestOption,
) (*PaymentCard, error)
DeleteSavedPaymentCardRecord(ctx context.Context, id string, opts ...RequestOption) error
CreateCard(ctx context.Context, input CreateCardInput, opts ...RequestOption) (*PaymentCard, error)
DeleteCard(ctx context.Context, id string, opts ...RequestOption) error
CreateThreeDSecureSession(ctx context.Context, input ThreeDSecureSessionInput, opts ...RequestOption) (*ThreeDSecureSession, 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"`
ThreeDSecureSessionID string `json:"three_d_secure_session_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 PaymentStatusType ¶ added in v2.3.0
type PaymentStatusType string
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 PowerAmenity ¶ added in v2.3.0
type PowerAmenity struct {
Available bool `json:"available"`
}
type PriceOfferInput ¶ added in v2.3.0
type PriceOfferInput struct {
IntendedPaymentMethods []IntendedPaymentMethodInput `json:"intended_payment_methods"`
IntendedServices []ServiceCreateInput `json:"intended_services"`
}
type PriceOrderInput ¶ added in v2.3.0
type PriceOrderInput struct {
IntendedPaymentMethods []IntendedPaymentMethodInput `json:"intended_payment_methods"`
}
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]) Put ¶ added in v2.3.0
func (r *RequestBuilder[Req, Resp]) Put(path string, body *Req, opts ...RequestOption) *RequestBuilder[Req, Resp]
Put sets the request method to PUT, the request path to the given path, and the request payload to body.
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 WithHeader ¶ added in v2.2.0
func WithHeader(key, value string) RequestOption
WithHeader sets a header on a single request, for example x-duffel-device-ip on CreateOrder.
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 SeatAmenity ¶ added in v2.3.0
type SeatAmenity struct {
Legroom SeatLegroom `json:"legroom"`
Pitch string `json:"pitch"`
Type SeatType `json:"type,omitempty"`
}
type SeatLegroom ¶ added in v2.3.0
type SeatLegroom string
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 SegmentCabin ¶ added in v2.3.0
type SegmentCabin struct {
Name CabinClass `json:"name"`
MarketingName string `json:"marketing_name"`
Amenities *CabinAmenities `json:"amenities,omitempty"`
}
type SegmentPassenger ¶
type SegmentPassenger struct {
ID string `json:"passenger_id"`
FareBasisCode string `json:"fare_basis_code"`
CabinClassMarketingName string `json:"cabin_class_marketing_name"`
CabinClass CabinClass `json:"cabin_class"`
Baggages []Baggage `json:"baggages"`
Seat Seat `json:"seat"`
// Cabin is only returned on offers.
Cabin *SegmentCabin `json:"cabin,omitempty"`
}
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"`
Duration Duration `json:"duration,omitempty"`
Segments []Flight `json:"segments,omitempty"`
FareBrandName string `json:"fare_brand_name,omitempty"`
// ComparisonKey is shared by identical slices across offers, for grouping.
ComparisonKey string `json:"comparison_key,omitempty"`
// NGSShelf is the NGS shelf from 1 (basic) to 5 (premium), nil when unknown.
NGSShelf *int `json:"ngs_shelf,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"`
// The fields below are only returned on offers. Nil means unknown.
AdvanceSeatSelection *bool `json:"advance_seat_selection,omitempty"`
PriorityBoarding *bool `json:"priority_boarding,omitempty"`
PriorityCheckIn *bool `json:"priority_check_in,omitempty"`
}
type SliceRemove ¶
type SliceRemove struct {
SliceID string `json:"slice_id"`
}
type TaxBreakdownItem ¶ added in v2.3.0
type TaxBreakdownItem struct {
// RawAmount is negative for a refundable tax.
RawAmount string `json:"amount"`
RawCurrency string `json:"currency"`
Code string `json:"code"`
CarrierImposed *bool `json:"carrier_imposed"`
Description *string `json:"description"`
Name *string `json:"name"`
}
func (*TaxBreakdownItem) Amount ¶ added in v2.3.0
func (t *TaxBreakdownItem) Amount() currency.Amount
type ThreeDSecureSession ¶ added in v2.3.0
type ThreeDSecureSession struct {
ID string `json:"id"`
CardID string `json:"card_id"`
ResourceID string `json:"resource_id"`
Status ThreeDSecureSessionStatus `json:"status"`
// ClientID initialises the 3DS UI component when Status is challenge_required.
ClientID string `json:"client_id"`
LiveMode bool `json:"live_mode"`
}
type ThreeDSecureSessionInput ¶ added in v2.3.0
type ThreeDSecureSessionInput struct {
CardID string `json:"card_id"`
// ResourceID is the offer, order or booking ID that will be paid.
ResourceID string `json:"resource_id"`
Services []ServiceCreateInput `json:"services,omitempty"`
Exception string `json:"exception,omitempty"`
}
type ThreeDSecureSessionStatus ¶ added in v2.3.0
type ThreeDSecureSessionStatus string
type TimeWindow ¶ added in v2.2.0
TimeWindow is a local hh:mm range. Duffel rejects From == To with a 422.
type TravelAgentTicket ¶ added in v2.3.0
type UpdateAirlineInitiatedChangeInput ¶
type UpdateAirlineInitiatedChangeInput struct {
ActionTaken ActionTakenType `json:"action_taken"`
}
type UpdateWebhookInput ¶ added in v2.3.0
type UpdateWebhookInput struct {
URL string `json:"url,omitempty"`
Events []WebhookEventType `json:"events,omitempty"`
Active *bool `json:"active,omitempty"`
}
UpdateWebhookInput sends only the fields that are set.
type Webhook ¶ added in v2.3.0
type Webhook struct {
ID string `json:"id"`
URL string `json:"url"`
Events []WebhookEventType `json:"events"`
Active bool `json:"active"`
LiveMode bool `json:"live_mode"`
CreatedAt DateTime `json:"created_at"`
UpdatedAt DateTime `json:"updated_at"`
// Secret signs deliveries. Duffel returns it only from CreateWebhook.
Secret string `json:"secret,omitempty"`
}
type WebhookClient ¶ added in v2.3.0
type WebhookClient interface {
CreateWebhook(ctx context.Context, input CreateWebhookInput, opts ...RequestOption) (*Webhook, error)
ListWebhooks(ctx context.Context, opts ...RequestOption) *Iter[Webhook]
UpdateWebhook(ctx context.Context, id string, input UpdateWebhookInput, opts ...RequestOption) (*Webhook, error)
DeleteWebhook(ctx context.Context, id string, opts ...RequestOption) error
PingWebhook(ctx context.Context, id string, opts ...RequestOption) error
ListWebhookEvents(ctx context.Context, params ...ListWebhookEventsParams) *Iter[WebhookEvent]
GetWebhookEvent(ctx context.Context, id string, opts ...RequestOption) (*WebhookEvent, error)
RedeliverWebhookEvent(ctx context.Context, id string, opts ...RequestOption) error
ListWebhookDeliveries(ctx context.Context, params ...ListWebhookDeliveriesParams) *Iter[WebhookDelivery]
GetWebhookDelivery(ctx context.Context, id string, opts ...RequestOption) (*WebhookDelivery, error)
}
type WebhookDelivery ¶ added in v2.3.0
type WebhookDelivery struct {
ID string `json:"id"`
EndpointID string `json:"endpoint_id"`
EventID string `json:"event_id"`
Type WebhookEventType `json:"type"`
URL string `json:"url"`
ResponseStatusCode int `json:"response_status_code"`
ResponseBody string `json:"response_body"`
LiveMode bool `json:"live_mode"`
CreatedAt DateTime `json:"created_at"`
}
type WebhookEvent ¶ added in v2.3.0
type WebhookEvent struct {
ID string `json:"id"`
Type WebhookEventType `json:"type"`
APIVersion string `json:"api_version"`
Data *WebhookEventData `json:"data"`
LiveMode bool `json:"live_mode"`
// IdempotencyKey is the ID of the related object, for deduplication.
IdempotencyKey string `json:"idempotency_key"`
CreatedAt DateTime `json:"created_at"`
// IdentityOrganisationID is documented on deliveries only, not in the events schema.
IdentityOrganisationID string `json:"identity_organisation_id,omitempty"`
}
WebhookEvent is both the body Duffel posts to a webhook and the resource of the events endpoints.
type WebhookEventData ¶ added in v2.3.0
type WebhookEventData struct {
Object WebhookEventObject `json:"object"`
}
type WebhookEventObject ¶ added in v2.3.0
type WebhookEventObject struct {
ID string `json:"id,omitempty"`
OfferID string `json:"offer_id,omitempty"`
OrderID string `json:"order_id,omitempty"`
PaymentID string `json:"payment_id,omitempty"`
AirlineInitiatedChangeID string `json:"aic_id,omitempty"`
OrderCreationAttemptedAt *DateTime `json:"order_creation_attempted_at,omitempty"`
}
WebhookEventObject merges the object shapes of all flight events. Which fields are set depends on the event type.
type WebhookEventType ¶ added in v2.3.0
type WebhookEventType string
const ( WebhookEventAirlineCreditCreated WebhookEventType = "air.airline_credit.created" WebhookEventAirlineCreditSpent WebhookEventType = "air.airline_credit.spent" WebhookEventAirlineCreditInvalidated WebhookEventType = "air.airline_credit.invalidated" WebhookEventPaymentFailed WebhookEventType = "air.payment.failed" WebhookEventPaymentSucceeded WebhookEventType = "air.payment.succeeded" WebhookEventPaymentCancelled WebhookEventType = "air.payment.cancelled" WebhookEventPaymentPending WebhookEventType = "air.payment.pending" WebhookEventOrderAirlineInitiatedChangeDetected WebhookEventType = "order.airline_initiated_change_detected" WebhookEventOrderCreated WebhookEventType = "order.created" WebhookEventOrderCreationFailed WebhookEventType = "order.creation_failed" WebhookEventOrderChanged WebhookEventType = "air.order.changed" WebhookEventOrderCancellationCreated WebhookEventType = "order_cancellation.created" WebhookEventOrderCancellationConfirmed WebhookEventType = "order_cancellation.confirmed" WebhookEventCarsBookingCreated WebhookEventType = "cars.booking.created" WebhookEventCarsBookingCancelled WebhookEventType = "cars.booking.cancelled" WebhookEventStaysBookingCreationFailed WebhookEventType = "stays.booking_creation_failed" WebhookEventStaysBookingCreated WebhookEventType = "stays.booking.created" WebhookEventStaysBookingCancelled WebhookEventType = "stays.booking.cancelled" WebhookEventAssistantConversationUpdated WebhookEventType = "assistant.conversation.updated" WebhookEventPingTriggered WebhookEventType = "ping.triggered" )
type WifiAmenity ¶ added in v2.3.0
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
¶
- aircraft.go
- airlinecredits.go
- airlines.go
- airports.go
- client.go
- duffel.go
- encoding.go
- errors.go
- flight.go
- identity.go
- iter.go
- list.go
- loyaltyprogrammes.go
- offerrequests.go
- offers.go
- options.go
- ordercancellations.go
- orderchanges.go
- orders.go
- paymentcard.go
- payments.go
- places.go
- ratelimit.go
- requestbuilder.go
- seatmaps.go
- webhooks.go
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
airlines
command
|
|
|
airports
command
|
|
|
cities
command
|
|
|
e2e
command
|
|
|
e2e_duffel_scenarios
command
|
|
|
offer-requests
command
|
|
|
offers
command
|
|
|
places
command
|
|