common

package
v0.0.0-...-d6eac5e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextFormatPlainText = "PlainText"
	TextFormatHTML      = "HTML"
)

Variables

View Source
var (
	ErrMissingHotelCode                    = newMissingAttributeError("HotelCode")
	ErrDeltasNotSupported                  = newError("deltas not supported")
	ErrMissingInvTypeCode                  = newMissingAttributeError("InvTypeCode")
	ErrMissingInvCode                      = newMissingAttributeError("InvCode")
	ErrOutOfOrderNotSupported              = newError("out of order not supported")
	ErrOutOfMarketNotSupported             = newError("out of market not supported")
	ErrClosingSeasonsNotSupported          = newError("closing seasons not supported")
	ErrUnexpectedInvCounts                 = newUnexpectedElementError("InvCounts")
	ErrAvailabilitiesOverlapClosingSeasons = newError("availabilities overlap closing seasons")
	ErrMissingCode                         = newMissingAttributeError("Code")
	ErrChildOccupancyNotSupported          = newError("child occupancy not supported")
	ErrMaxChildOccGreaterThanMaxOcc        = newError("child occupancy must be ≤ max occupancy")
	ErrStdOccLowerThanMinOcc               = newError("standard occupancy must be ≥ min occupancy")
	ErrMaxOccLowerThanStdOcc               = newError("max occupancy must be ≥ standard occupancy")
	ErrMissingMultimediaDescriptions       = newMissingElementError("MultimediaDescriptions")
	ErrMissingLongName                     = newMissingElementError("MultimediaDescription with attribute InfoCode = 25 (Long name)")
	ErrDuplicateLanguage                   = newError("duplicate language found for element Description")
	ErrRoomsNotSupported                   = newError("rooms not supported")
	ErrMissingRoomID                       = newMissingAttributeError("RoomID")
	ErrMissingID                           = newMissingAttributeError("UniqueID.ID")
	ErrMissingRoomStay                     = newMissingElementError("RoomStay")
	ErrDuplicateAlternativeRoomStay        = newError("at most one alternative room stay is allowed")
	ErrUnexpectedAlternativeRoomStay       = newError("alternative room stay is not allowed")
	ErrMissingRoomType                     = newMissingElementError("RoomType")
	ErrUnexpectedRoomType                  = newUnexpectedElementError("RoomType")
	ErrMissingRoomTypeCode                 = newMissingAttributeError("RoomTypeCode")
	ErrMissingRatePlan                     = newMissingElementError("RatePlan")
	ErrUnexpectedRatePlan                  = newUnexpectedElementError("RatePlan")
	ErrMissingRatePlanCode                 = newMissingAttributeError("RatePlanCode")
	ErrInvalidPercent                      = newError("percent must be ≤ 100")
	ErrMissingMealsIncluded                = newMissingElementError("MealsIncluded")
	ErrMissingGuestCount                   = newMissingElementError("GuestCount")
	ErrUnexpectedGuestCounts               = newUnexpectedElementError("GuestCounts")
	ErrDuplicateAdultGuestCount            = newError("duplicate element GuestCount for adults")
	ErrMissingStart                        = newMissingAttributeError("Start")
	ErrMissingEnd                          = newMissingAttributeError("End")
	ErrMissingTotal                        = newMissingElementError("Total")
	ErrUnexpectedTotal                     = newUnexpectedElementError("Total")
	ErrStartAfterEnd                       = newError("start must be ≤ end")
	ErrMissingDuration                     = newMissingAttributeError("Duration")
	ErrUnexpectedStartDateWindow           = newUnexpectedElementError("StartDateWindow")
	ErrUnexpectedDuration                  = newUnexpectedAttributeError("Duration")
	ErrMissingTimeSpan                     = newMissingElementError("TimeSpan")
	ErrMissingStartDateWindow              = newMissingElementError("StartDateWindow")
	ErrEarliestDateAfterLatestDate         = newError("earliest date must be ≤ latest date")
	ErrDurationOutOfRange                  = newError("duration exceeds the allowed date range")
	ErrInvalidNamePrefix                   = newError("invalid value for attribute NamePrefix")
	ErrMissingGivenName                    = newMissingAttributeError("GivenName")
	ErrMissingSurname                      = newMissingAttributeError("Surname")
	ErrInvalidNameTitle                    = newError("invalid value for attribute NameTitle")
	ErrInvalidAddressLine                  = newError("invalid value for attribute AddressLine")
	ErrInvalidCityName                     = newError("invalid value for attribute CityName")
	ErrInvalidPostalCode                   = newError("invalid value for attribute PostalCode")
	ErrInvalidCountryNameCode              = newError("invalid value for attribute CountryName.Code")
	ErrInvalidListItem                     = newError("invalid value for element ListItem")
	ErrInvalidCommentText                  = newError("invalid value for element Comment.Text")
	ErrInvalidPenaltyDescriptionText       = newError("invalid value for attribute element PenaltyDescription.Text")
	ErrInvalidResIDValue                   = newError("invalid value for attribute ResIDValue")
	ErrInvalidResIDSource                  = newError("invalid value for attribute ResIDSource")
	ErrInvalidResIDSourceContext           = newError("invalid value for attribute ResIDSourceContext")
	ErrInvalidCompanyNameCode              = newError("invalid value for attribute CompanyName.Code")
	ErrInvalidCompanyNameValue             = newError("invalid value for element CompanyName")
	ErrInvalidEmail                        = newError("invalid value for element Email")
	ErrMissingCurrencyCode                 = newMissingAttributeError("CurrencyCode")
	ErrRatePlanJoinNotSupported            = newError("rate plan join not supported")
	ErrMissingOfferRule                    = newMissingElementError("OfferRule")
	ErrOfferRuleBookingOffsetNotSupported  = newError("offer rule booking offset not supported")
	ErrOfferRuleDOWLOSNotSupported         = newError("offer rule days of week and lengths of stay not supported")
	ErrStayThroughNotAllowedInOfferRule    = newError("invalid value for attribute MinMaxMessageType inside element OfferRule")
	ErrMissingAdultOccupancy               = newMissingElementError("Occupancy with attribute AgeQualifyingCode = 10")
	ErrInvalidMinOccupancy                 = newError("min occupancy must be ≤ 99")
	ErrInvalidMaxOccupancy                 = newError("max occupancy must be ≤ 99")
	ErrDuplicateChildOccupancy             = newError("duplicate element Occupancy with attribute AgeQualifyingCode = 8")
	ErrDuplicateFreeNightOffer             = newError("duplicate free night offer")
	ErrDuplicateFamilyOffer                = newError("duplicate family offer")
	ErrFreeNightOfferNotSupported          = newError("free night offer not supported")
	ErrMissingNightsRequired               = newMissingAttributeError("NightsRequired")
	ErrMissingNightsDiscounted             = newMissingAttributeError("NightsDiscounted")
	ErrInvalidDiscountPattern              = newError("invalid value for attribute DiscountPattern")
	ErrFamilyOfferNotSupported             = newError("free night offer not supported")
	ErrInvalidGuestAgeQualifyngCode        = newError("invalid value for attribute Guest.AgeQualifyingCode")
	ErrRoomTypeBookingRulesNotSupported    = newError("room type booking rules not supported")
	ErrArrivalDOWNotSupported              = newError("arrival days of week not supported")
	ErrDepartureDOWNotSupported            = newError("departure days of week not supported")
	ErrMissingStaticRate                   = newMissingElementError("static Rate")
	ErrInvalidRateTimeUnit                 = newError("invalid value for attribute RateTimeUnit")
	ErrMissingBaseByGuestAmt               = newMissingElementError("BaseByGuestAmt")
	ErrMissingNumberOfGuests               = newMissingAttributeError("NumberOfGuests")
	ErrMissingAgeQualifyingCode            = newMissingAttributeError("AgeQualifyingCode")
	ErrMissingAmountAfterTax               = newMissingAttributeError("AmountAfterTax")
	ErrMissingAmount                       = newMissingAttributeError("Amount")
	ErrDuplicateAdditionalGuestAmountAdult = newError("duplicate element AdditionalGuestAmount with attribute AgeQualifyingCode = 10")
	ErrChildrenNotAllowed                  = newError("children not allowed")
	ErrMissingMinAge                       = newMissingAttributeError("MinAge")
	ErrMinAgeGreaterThanOrEqualsThanMaxAge = newError("attribute MinAge must be < attribute MaxAge")
	ErrSupplementsNotSupported             = newError("supplements not supported")
	ErrMissingAddToBasicRateIndicator      = newMissingAttributeError("AddToBasicRateIndicator")
	ErrMissingMandatoryIndicator           = newMissingAttributeError("MandatoryIndicator")
	ErrMissingChargeTypeCode               = newMissingAttributeError("ChargeTypeCode")
	ErrInvalidDOWString                    = newError("invalid value for attribute InvCode with attribute InvType = ALPINEBITSDOW")
	ErrUnexpectedOffers                    = newUnexpectedElementError("Offers")
	ErrUnexpectedDescription               = newUnexpectedElementError("Description")
	ErrUnexpectedBookingRules              = newUnexpectedElementError("BookingRules")
	ErrUnexpectedRates                     = newUnexpectedElementError("Rates")
	ErrUnexpectedSupplements               = newUnexpectedElementError("Supplements")
	ErrUnexpectedGuest                     = newUnexpectedElementError("Guest")
	ErrUnexpectedNightsRequired            = newUnexpectedAttributeError("NightsRequired")
	ErrUnexpectedNightsDiscounted          = newUnexpectedAttributeError("NightsDiscounted")
	ErrUnexpectedDiscountPattern           = newUnexpectedAttributeError("DiscountPattern")
	ErrUnexpectedInvTypeCode               = newUnexpectedAttributeError("InvTypeCode")
	ErrUnexpectedStart                     = newUnexpectedAttributeError("Start")
	ErrUnexpectedEnd                       = newUnexpectedAttributeError("End")
	ErrUnexpectedNumberOfGuests            = newUnexpectedAttributeError("NumberOfGuests")
	ErrUnexpectedAgeQualifyingCode         = newUnexpectedAttributeError("AgeQualifyingCode")
	ErrUnexpectedAmountAfterTax            = newUnexpectedAttributeError("AmountAfterTax")
	ErrUnexpectedBaseByGuestAmt            = newError("static rates can contain only one element BaseByGuestAmt")
	ErrUnexpectedAdditionalGuestAmounts    = newUnexpectedElementError("AdditionalGuestAmounts")
	ErrUnexpectedRateTimeUnit              = newUnexpectedAttributeError("RateTimeUnit")
	ErrUnexpectedUnitMultiplier            = newUnexpectedAttributeError("UnitMultiplier")
	ErrUnexpectedMealsIncluded             = newUnexpectedElementError("MealsIncluded")
	ErrUnexpectedType                      = newUnexpectedAttributeError("Type")
	ErrUnexpectedAmount                    = newUnexpectedAttributeError("Amount")
	ErrUnexpectedAddToBasicRateIndicator   = newUnexpectedAttributeError("AddToBasicRateIndicator")
	ErrUnexpectedMandatoryIndicator        = newUnexpectedAttributeError("MandatoryIndicator")
	ErrUnexpectedChargeTypeCode            = newUnexpectedAttributeError("ChargeTypeCode")
)

Functions

func ValidateHotelCode

func ValidateHotelCode(hotelCode string) error

func ValidateLanguageUniqueness

func ValidateLanguageUniqueness(descs []Description) error

func ValidateNonNilString

func ValidateNonNilString(s *string) error

func ValidateOverlaps

func ValidateOverlaps[T version.DateRangeProvider](ranges []T) error

func ValidateString

func ValidateString(s string) error

Types

type Description

type Description struct {
	TextFormat TextFormat `xml:"TextFormat,attr"`
	Language   string     `xml:"Language,attr"`
	Value      string     `xml:",innerxml"`
}

type Error

type Error struct {
	Type   ErrorWarningType `xml:"Type,attr"`
	Code   int              `xml:"Code,attr,omitempty"`
	Status Status           `xml:"Status,attr,omitempty"`
	Value  string           `xml:",innerxml"`
}

func ErrAgeRangeOverlaps

func ErrAgeRangeOverlaps(min1, max1, min2, max2 int) *Error

func ErrDateRangeOverlaps

func ErrDateRangeOverlaps(range1, range2 timex.DateRange) *Error

func ErrDuplicateBaseByGuestAmt

func ErrDuplicateBaseByGuestAmt(numberOfGuests int) *Error

func ErrFamilyOfferMaxAgeTooLow

func ErrFamilyOfferMaxAgeTooLow(offerMaxAge, childMinAge int) *Error

func ErrInvCodeNotFound

func ErrInvCodeNotFound(invCode string) *Error

func ErrInvTypeCodeNotFound

func ErrInvTypeCodeNotFound(invTypeCode string) *Error

func ErrInvalidCount

func ErrInvalidCount(n int) *Error

func ErrInvalidInvCounts

func ErrInvalidInvCounts(n int) *Error

func ErrInvalidInvType

func ErrInvalidInvType(invType string) *Error

func ErrInvalidPictureCategoryCode

func ErrInvalidPictureCategoryCode(code int) *Error

func ErrInvalidRoomAmenityType

func ErrInvalidRoomAmenityType(code int) *Error

func ErrInvalidRoomClassificationCode

func ErrInvalidRoomClassificationCode(roomClassificationCode int) *Error

func ErrInvalidRoomType

func ErrInvalidRoomType(roomType int) *Error

func ErrInvalidUniqueID

func ErrInvalidUniqueID(status string, uidType int) *Error

func ErrMaxAgeOutOfRange

func ErrMaxAgeOutOfRange(childMaxAge, ratePlanAdultMinAge int) *Error

func ErrMinAgeOutOfRange

func ErrMinAgeOutOfRange(childMinAge, ratePlanChildMinAge int) *Error

func ErrMinStayArrivalGratherThanMaxStayArrival

func ErrMinStayArrivalGratherThanMaxStayArrival(min, max int) *Error

func ErrMinStayGratherThanMaxStay

func ErrMinStayGratherThanMaxStay(min, max int) *Error

func ErrMissingBaseByGuestAmtWithStdOccupancy

func ErrMissingBaseByGuestAmtWithStdOccupancy(std int) *Error

func ErrRatePlanNotFound

func ErrRatePlanNotFound(code string) *Error

func (Error) Error

func (err Error) Error() string

type ErrorWarningType

type ErrorWarningType int
const (
	ErrorWarningTypeAdvisory         ErrorWarningType = 11
	ErrorWarningTypeApplicationError ErrorWarningType = 13
)

type Response

type Response struct {
	Success  *Success   `xml:"Success"`
	Warnings *[]Warning `xml:"Warnings>Warning"`
	Errors   *[]Error   `xml:"Errors>Error"`
}

func (*Response) AppendError

func (r *Response) AppendError(e Error)

func (*Response) AppendWarning

func (r *Response) AppendWarning(w Warning)

func (*Response) SetSuccess

func (r *Response) SetSuccess()

type Status

type Status string
const (
	StatusSendInventory Status = "ALPINEBITS_SEND_INVENTORY"
	StatusSendFreeRooms Status = "ALPINEBITS_SEND_FREEROOMS"
	StatusSendRatePlans Status = "ALPINEBITS_SEND_RATEPLANS"
)

type Success

type Success struct{}

type TextFormat

type TextFormat string

type URL

type URL struct {
	Value string `xml:",innerxml"`
}

type Validatable

type Validatable[T any] interface {
	Validate(v T) error
}

type Warning

type Warning struct {
	Type   ErrorWarningType `xml:"Type,attr"`
	Code   int              `xml:"Code,attr,omitempty"`
	Status Status           `xml:"Status,attr,omitempty"`
	Value  string           `xml:",innerxml"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL