Documentation ¶
Index ¶
- func GetCredential[T any](creds Credentials, key string) (T, bool)
- func GetCredentialOrDefault[T any](creds Credentials, key string, defaultValue T) T
- func GetHook[T any](acco Accommodation, name string) (*T, bool)
- func NewDate(year int, month time.Month, day int) time.Time
- type Accommodation
- type AccommodationReference
- type ApartmentFacts
- type Booking
- type BookingMapper
- type BookingReader
- type CampingFacts
- type CitiFact
- type CodedText
- type CodedTextMap
- type CodedTextMaps
- type Contact
- type ContentLanguage
- type Credentials
- type CurrencyValue
- type CurrencyValues
- type DateRange
- type DateRanges
- type DesklineAvailability
- type DesklineOccupancies
- type EngineJob
- type EngineResponseRecord
- type Feature
- type Filter
- type FullExternal
- type GeoCoordinates
- type GracFacts
- type Group
- type GroupVisibility
- type HookEntry
- type HookTrigger
- type HotelFacts
- type IOfferMapper
- type Image
- type Images
- type ImportStat
- type ImportTypes
- type JSONDate
- type JobProvider
- type JobRoom
- type JobRooms
- type Media
- type Meta
- type MinimalReference
- type NameValuePair
- type OccupyReader
- type Offer
- type OfferAccommodation
- type OfferAddress
- type OfferFacts
- type OfferImage
- type OfferImages
- type OfferPlace
- type Place
- type PostableOccupancies
- type PostableOccupanciesExternal
- type Price
- type Provider
- type Providers
- type Query
- type Rank
- type RawResult
- type ReferenceCalendar
- type ReferencePost
- type ResultDeliveredRecord
- type Room
- type Settings
- type SpokenLanguage
- type SpokenLanguages
- type TextMap
- func (p TextMap) Collect() string
- func (p TextMap) Empty(lang string) bool
- func (p TextMap) Lang(lang string) string
- func (p TextMap) LangOr(lang, fallback string) string
- func (p TextMap) LangOrFirst(lang string) (string, string, bool)
- func (p TextMap) Only(lang string, defaultLang string) TextMap
- func (p *TextMap) Scan(src interface{}) error
- func (p TextMap) SetDefault(str string, langs []string)
- func (p TextMap) Value() (driver.Value, error)
- func (p TextMap) WithLangs(langs []string) TextMap
- type TypeFacts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCredential ¶
func GetCredential[T any](creds Credentials, key string) (T, bool)
func GetCredentialOrDefault ¶
func GetCredentialOrDefault[T any](creds Credentials, key string, defaultValue T) T
Types ¶
type Accommodation ¶
type Accommodation struct { AccommodationReference Externals []NameValuePair `json:"externals,omitempty"` Features []Feature `json:"features"` References []AccommodationReference `json:"references,omitempty"` CreatedAt string `json:"createdAt,omitempty"` UpdatedAt string `json:"updatedAt,omitempty"` ID string `json:"id,omitempty"` Visible bool `json:"visible"` HookData map[string]HookEntry `json:"hookData"` Type string `json:"type"` Place string `json:"place"` }
Accommodation models a OpenBooking Accommodation
func (*Accommodation) GetExternal ¶
func (a *Accommodation) GetExternal(key string) interface{}
GetExternal fetches a value with name "key" from Accommodation Externals. If it doesn't exist, returns empty string
func (*Accommodation) HasFeature ¶
func (a *Accommodation) HasFeature(name string) bool
HasFeature returns true if a feature is present otherwise false
type AccommodationReference ¶
type AccommodationReference struct { ID string `json:"id,omitempty"` ReferenceID int `json:"reference_id,omitempty"` Type string `json:"type"` IsMaster bool `json:"is_master,omitempty"` ExternalID string `json:"external_id"` Provider string `json:"provider"` ProviderName string `json:"provider_name,omitempty"` Name TextMap `json:"name"` NameAdd TextMap `json:"name_add"` NameCode TextMap `json:"name_code"` Street string `json:"street"` Plz string `json:"plz"` City string `json:"city"` Country string `json:"country"` Phone string `json:"phone"` Email string `json:"email"` URL string `json:"url"` Description TextMap `json:"description"` DescriptionArrival TextMap `json:"description_arrival"` DescriptionConditions TextMap `json:"description_conditions"` BookingUrl TextMap `json:"bookingUrl,omitempty"` Images []Image `json:"images"` ImagesServices []Image `json:"imagesServices"` Ranks []Rank `json:"ranks"` Media []Media `json:"media"` Position GeoCoordinates `json:"position"` Quality *string `json:"quality"` Superior bool `json:"superior"` Facts *TypeFacts `json:"facts,omitempty"` OnDemand bool `json:"onDemand"` FeaturesUnmapped [][]string `json:"raw_features"` ResolverExternal map[string]string `json:"resolver_external"` Externals []FullExternal `json:"externals,omitempty"` XHookdata map[string]any `json:"x_hookdata,omitempty"` Rooms []Room `json:"rooms" hash:"-"` Tags []string `json:"tags,omitempty"` Calendar *ReferenceCalendar `json:"calendar,omitempty"` Source []byte `json:"source,omitempty"` }
AccommodationReference represents an Accommodation object that can be POSTed to the API It contains fewer fields which are not allowed to be POSTed but is the foundation for the full Accommodation type
func (*AccommodationReference) GetName ¶
func (r *AccommodationReference) GetName() string
type ApartmentFacts ¶
type ApartmentFacts struct { Beds int `json:"beds,omitempty"` Bedrooms int `json:"bedrooms,omitempty"` Sqm float64 `json:"sqm,omitempty"` MaxAdults int `json:"maxAdults,omitempty"` MinAdults int `json:"minAdults,omitempty"` MaxChildren int `json:"maxChildren,omitempty"` Type string `json:"type,omitempty"` }
type Booking ¶
type Booking struct { ExternalID string `json:"external_id"` // Reservation ID Group string `json:"group"` Provider string `json:"provider"` Checkin string `json:"checkin"` Checkout string `json:"checkout"` Booked string `json:"booked"` Currency string `json:"currency"` Adults int `json:"adults"` Children int `json:"children"` Price float64 `json:"price"` Status string `json:"status"` Type string `json:"type"` // of Reference ReferenceName string `json:"reference_name"` ReferenceExternalID string `json:"reference_external_id"` }
Booking type represents a Booking object (read from Providers)
func (*Booking) FormatedPrice ¶
type BookingMapper ¶
type BookingReader ¶
type CampingFacts ¶
type CampingFacts struct { }
type CodedTextMap ¶
type CodedTextMaps ¶
type CodedTextMaps []CodedTextMap
func (*CodedTextMaps) Scan ¶
func (m *CodedTextMaps) Scan(src interface{}) error
type ContentLanguage ¶
type ContentLanguage string
type Credentials ¶
type Credentials map[string]interface{}
type CurrencyValue ¶
type CurrencyValue struct { Currency string `json:"currency"` Value string `json:"value"` Converted bool `json:"converted"` Description TextMap `json:"description"` }
func (*CurrencyValue) Scan ¶
func (m *CurrencyValue) Scan(src interface{}) error
type CurrencyValues ¶
type CurrencyValues []CurrencyValue
func (*CurrencyValues) Scan ¶
func (m *CurrencyValues) Scan(src interface{}) error
type DateRange ¶
func (DateRange) Includes ¶ added in v1.4.2
Includes returns true when `other` is included in the DateRange
func (DateRange) OverlapsWith ¶ added in v1.4.2
OverlapsWith returns true when `other` is overlaps the DateRange
type DateRanges ¶
type DateRanges []DateRange
func (DateRanges) Compress ¶
func (m DateRanges) Compress() (DateRanges, error)
Compress consolidates multiple consecutive date ranges into single Ranges
func (*DateRanges) Scan ¶
func (m *DateRanges) Scan(src interface{}) error
type DesklineAvailability ¶
type DesklineOccupancies ¶
type DesklineOccupancies struct { XMLName xml.Name `xml:"FeratelDsiRS"` Availabilities []DesklineAvailability `xml:"Result>AvailabilityCalendar"` }
<Result Index=\"1\">\n <AvailabilityCalendar ProductId=\"0a380a62-a9c9-481d-898a-1944fe641b8c\">\n <AV>2016-09-30,2,1,999,1,1,1</AV>
type EngineJob ¶
type EngineJob struct { JobId int64 `json:"job_id"` Query *Query `json:"query"` Filter Filter `json:"filter"` Provider JobProvider `json:"provider"` ExternalIDs []string `json:"external_ids"` }
type EngineResponseRecord ¶
type EngineResponseRecord struct { Engine string `gorethink:"engine" db:"engine"` Group string `gorethink:"group" db:"group"` Name string `gorethink:"name" db:"name"` Retrieved int `gorethink:"retrieved" db:"retrieved"` Value float64 `gorethink:"value" db:"value"` OrigTime float64 `gorethink:"orig_time" db:"orig_time"` Time time.Time `gorethink:"time" db:"time"` }
type FullExternal ¶
type FullExternal struct { NameValuePair Source string `json:"source"` TS time.Time `json:"ts"` }
type GeoCoordinates ¶
GeoCoordinates in Accommodation
func (*GeoCoordinates) Scan ¶
func (p *GeoCoordinates) Scan(src interface{}) error
type GracFacts ¶
type GracFacts struct { Catering []string `json:"catering"` Bedrooms int `json:"bedrooms,omitempty"` Beds int `json:"beds"` AccessibleBeds int `json:"accessiblebeds"` Bathrooms int `json:"bathrooms"` Showers int `json:"showers"` Toilets int `json:"toilets"` SittingLounges int `json:"sittinglounges"` DiningLounges int `json:"dininglounges"` ConferenceRooms int `json:"conferenceRooms"` }
type GroupVisibility ¶
type HookEntry ¶
type HookEntry struct { StatusCode int `json:"statusCode"` Executed string `json:"executed"` Data json.RawMessage `json:"data"` }
type HookTrigger ¶
type HotelFacts ¶
type IOfferMapper ¶
type IOfferMapper interface { Activities() []string Accommodation() *OfferAccommodation Description() TextMap DescriptionHTML() TextMap Duration() TextMap EventAddress() OfferAddress EventDates() DateRanges EventLocation() GeoCoordinates Images() []OfferImage ImportantInfo() TextMap ImportantInfoHTML() TextMap InfoURL() TextMap MaxCapacity() int MeetingPoint() TextMap MeetingPointHTML() TextMap Meta() map[string]string PriceAdvertised() string PricesFrom() []CurrencyValue PromoCode() string ProviderName() TextMap Segments() []CodedTextMap ServicesIncluded() TextMap ServicesIncludedHTML() TextMap Setting() string Source() ([]byte, error) SpokenLanguages() []SpokenLanguage Tags() []string TicketInfo() TextMap Title() TextMap Transport() []string Validity() DateRanges Weekdays() []string WidgetData() any }
IOfferMapper defines the fields of an Offer that needs to be mappable by an Offer Engine
type Image ¶
type Image struct { URL string `json:"url" db:"url"` Season string `json:"season" db:"season"` Favourite bool `json:"favourite" db:"favourite"` Title TextMap `json:"title" db:"title"` Description TextMap `json:"description" db:"description"` SortOrder int `json:"sortOrder" db:"sortorder"` }
Image is an Accommodation Image
type ImportStat ¶
type ImportStat struct { Provider string User string Filterfetch int Successful int Apierrors int Xmlerrors []string Region string Place string Country string }
ImportStat define a statistic object for an import
type ImportTypes ¶
type JSONDate ¶
func NewJSONDateFromTime ¶
type JobProvider ¶
type JobProvider struct { Id string `json:"id"` Visible bool `json:"visible"` Preferred bool `json:"preferred"` Name string `json:"name"` Engine string `json:"engine"` Credentials Credentials `json:"credentials"` DeeplinkTemplate *string `json:"deeplink_template"` CreatedAt *time.Time `json:"createdAt"` UpdatedAt *time.Time `json:"updatedAt"` Group string `json:"group"` ResolverUrl string `json:"resolver_url"` CacheMinutes int `json:"cache_minutes"` SoftTimeout int `json:"max_wait_secs"` }
type Media ¶
type Media struct { Description string `json:"description"` Favourite bool `json:"favourite"` Type string `json:"type"` URL string `json:"url"` URLParameter string `json:"urlParameter"` }
Media is used to attach media URLs other than images to the Object Used by Zermatt for Youtube and Google Maps (see Tomas Importer)
type MinimalReference ¶
type NameValuePair ¶
type OccupyReader ¶
type OccupyReader interface { ReadOccupancies(acco *MinimalReference) (*PostableOccupancies, error) Whoami() string PrepareData() error }
type Offer ¶
type Offer struct { Title TextMap Description TextMap DescriptionHTML TextMap InfoURL TextMap PricesFrom []CurrencyValue Images []OfferImage SpokenLanguages []SpokenLanguage Setting []CodedTextMap Duration TextMap MaxCapacity int Place string `json:"-"` Activities []string Segments []CodedTextMap Tags []string EventAddress OfferAddress EventLocation GeoCoordinates EventDates []DateRange // Where to get a ticket TicketInfo TextMap // Widget-specific data object WidgetData any Meta map[string]string }
type OfferAccommodation ¶
type OfferAccommodation struct { Nights int `json:"nights"` RoomCategoryID int `json:"room_category_id"` RoomCategory TextMap `json:"room_category"` AccommodationID string `json:"accommodation_id"` }
func (*OfferAccommodation) Scan ¶
func (m *OfferAccommodation) Scan(src interface{}) error
type OfferAddress ¶
type OfferAddress struct { ID string `json:"id"` // Place RKEY here? Name string `json:"name"` Street string `json:"street"` City string `json:"city"` ZIP string `json:"zip"` Country string `json:"country"` }
func (OfferAddress) IsEmpty ¶
func (m OfferAddress) IsEmpty() bool
func (*OfferAddress) Scan ¶
func (m *OfferAddress) Scan(src interface{}) error
type OfferFacts ¶
type OfferImage ¶
type OfferImages ¶
type OfferImages []OfferImage
func (*OfferImages) Scan ¶
func (m *OfferImages) Scan(src interface{}) error
type OfferPlace ¶
type PostableOccupancies ¶
type Provider ¶
type Provider struct { ID string `json:"id"` Name string `json:"name"` Engine string `json:"engine"` Group string `json:"group"` Importkey string `json:"import_key"` ImportUrl string `json:"import_url"` Credentials Credentials `json:"credentials"` Visible bool `json:"visible"` }
Provider models a Provider object
func (*Provider) GetImportTypes ¶
func (p *Provider) GetImportTypes() ImportTypes
type Providers ¶
type Providers []Provider
Providers is a slice of Provider type
func (Providers) SelectEngine ¶
SelectEngine returns only the Providers with the given engine ID
type Query ¶
type Query struct { Group string `json:"group"` Checkin time.Time `json:"checkin"` Checkout time.Time `json:"checkout"` Rooms []JobRoom `json:"rooms"` Currency string `json:"currency"` Language string `json:"language"` }
func (*Query) GetChildren ¶
GetChildren returns the number of children over all rooms.
func (*Query) GetChildrenFromAge ¶
GetChildrenFromAge returns all children with at least AGE
func (*Query) GetChildrenFromToAge ¶
GetChildrenFromToAge returns all children between minAge and maxAge inclusive
func (*Query) GetGuests ¶
GetGuests returns the total number of occupants for all rooms incl. children.
func (*Query) GetGuestsFromAge ¶
func (*Query) GetTravelDays ¶
type Rank ¶
type Rank struct { Provider string `json:"provider"` ExternalID string `json:"external_id"` Data map[string]interface{} `json:"data"` }
Rank is part of Accommodation and contains a Rating data source
type RawResult ¶
type RawResult struct { Rooms JobRooms `json:"rooms" db:"rooms"` RoomExternalId *string `json:"room_external_id" db:"room_external_id"` ExternalId string `json:"external_id" db:"external_id"` ReferenceExternalId string `json:"reference" db:"reference"` Price Price `json:"price" db:"price"` Includes []string `json:"includes" db:"includes"` Title string `json:"title" db:"title"` Board string `json:"board" db:"board"` Url string `json:"url" db:"url"` Description string `json:"description" db:"description"` DescriptionRateCode string `json:"description_rate_code" db:"description_rate_code"` RateCode string `json:"ratecode" db:"ratecode"` Checkin JSONDate `json:"checkin" db:"checkin"` Checkout JSONDate `json:"checkout" db:"checkout"` Language string `json:"language" db:"language"` Terms string `json:"terms" db:"terms"` }
type ReferenceCalendar ¶
type ReferencePost ¶
type ReferencePost struct { Group string Data AccommodationReference }
type ResultDeliveredRecord ¶
type ResultDeliveredRecord struct { ID string `gorethink:"id" db:"-"` Count int `gorethink:"count" db:"count"` Group string `gorethink:"group" db:"group"` Reference string `gorethink:"reference" db:"reference"` Type string `gorethink:"type" db:"type"` OrigTime float64 `gorethink:"orig_time" db:"orig_time"` Time time.Time `gorethink:"time" db:"time"` }
type SpokenLanguage ¶
func SpokenLanguageFromAny ¶
func SpokenLanguageFromAny(code string) (*SpokenLanguage, bool)
Searches either for 2-letter or 3-letter code
func SpokenLanguageFromISO839_1 ¶
func SpokenLanguageFromISO839_1(code string) (*SpokenLanguage, bool)
func SpokenLanguageFromISO839_2 ¶
func SpokenLanguageFromISO839_2(code string) (*SpokenLanguage, bool)
func SpokenLanguageFromISO839_3 ¶
func SpokenLanguageFromISO839_3(code string) (*SpokenLanguage, bool)
type SpokenLanguages ¶
type SpokenLanguages []SpokenLanguage
func (*SpokenLanguages) Scan ¶
func (m *SpokenLanguages) Scan(src interface{}) error
type TextMap ¶
TextMap is a multilanguage string map key=lang, value=text
func NewDefaultTextMap ¶
NewDefaultTextMap returns a new TextMap with the defValue set for all langs
func (TextMap) Collect ¶
Collect throws the values of every key into a single string useful for searching etc.
func (TextMap) LangOrFirst ¶
First returns the first entry with len > 0
func (TextMap) Only ¶
Only returns a copy of the TextMap with the selected language only. If that lang doesn't exist, it falls back to the defaultLang.
func (TextMap) SetDefault ¶
type TypeFacts ¶
type TypeFacts struct { Apartment *ApartmentFacts `json:"apartment,omitempty"` Hotel *HotelFacts `json:"hotel,omitempty"` Offer *OfferFacts `json:"offer,omitempty"` Camping *CampingFacts `json:"camping,omitempty"` Crac *GracFacts `json:"grac,omitempty"` }