stnet2

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	German      = 1
	SwissGerman = 2
	French      = 3
	Italian     = 4
	English     = 5
	Spanish     = 6
	Romansh     = 7
	Nederlands  = 8
	Portuguese  = 9
	Chinese     = 10
	Russian     = 11
	Japanese    = 12
	Turkish     = 13
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Activity

type Activity struct {
	IDTextElement
	Price Price `xml:"price"`
}

type AdventureLanguage

type AdventureLanguage IDTextElement

func (AdventureLanguage) ToISO639_2B

func (lang AdventureLanguage) ToISO639_2B() (string, bool)

TODO Use https://pkg.go.dev/github.com/barbashov/iso639-3 ?

type AdventureOffer

type AdventureOffer struct {
	ID           string              `xml:"id"`
	Title        Texts               `xml:"title>text"`
	Description  Texts               `xml:"description>text"`
	BookingURL   Texts               `xml:"bookingUrl"`
	InfoURL      Texts               `xml:"infoUrl>text"`
	Weather      IDTextElement       `xml:"weather"`
	Duration     IDTextElement       `xml:"duration"`
	Languages    []AdventureLanguage `xml:"adventureLanguages>adventureLanguage"`
	Seasons      []IDTextElement     `xml:"adventureSeasons>adventureSeason"`
	Segments     []IDTextElement     `xml:"adventureSegments>adventureSegment"`
	TravelGroups []IDTextElement     `xml:"adventureTravelGroups>adventureTravelGroup"`
	Types        []IDTextElement     `xml:"adventureTypes>adventureType"`
	Activities   []Activity          `xml:"adventureActivities>adventureActivity"`
	Info         adventureInfo       `xml:"adventureInfo"`
	Address      address             `xml:"address"`
	Images       []Image             `xml:"images>image"`
}

type AdventuresXml

type AdventuresXml struct {
	XMLName         xml.Name         `xml:"offers"`
	Header          offersXmlHeader  `xml:"header"`
	AdventureOffers []AdventureOffer `xml:"adventureOffer"`
}

type CData

type CData struct {
	CData string `xml:",cdata"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(username string, apiKey string, url string) Client

NewClient creates a new Client (Session) to the STnet API with the given credentials

func (*Client) GetAdventures

func (c *Client) GetAdventures(page int) (*AdventuresXml, error)

func (*Client) GetHotels

func (c *Client) GetHotels(page int) (*HotelsXml, error)

type CustomDateTime

type CustomDateTime struct {
	time.Time
}

CustomDateTime is a struct that allows to parse an empty string which so happens to be in the XML

func (*CustomDateTime) UnmarshalXML

func (c *CustomDateTime) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type HotelOffer

type HotelOffer struct {
	ID          string    `xml:"id"`
	Title       Texts     `xml:"title>text"`
	Description Texts     `xml:"description>text"`
	BookingURL  Texts     `xml:"bookingUrl>text"`
	HotelInfo   hotelInfo `xml:"hotelInfo"`
	Images      []Image   `xml:"images>image"`
	Address     address   `xml:"address"`
}

type HotelsXml

type HotelsXml struct {
	XMLName     xml.Name        `xml:"offers"`
	Header      offersXmlHeader `xml:"header"`
	HotelOffers []HotelOffer    `xml:"hotelOffer"`
}

type IDTextElement

type IDTextElement struct {
	ID   int   `xml:"id"`
	Text Texts `xml:"text"`
}

type Image

type Image struct {
	Type    int            `xml:"type,attr"`
	Formats ImageFormats   `xml:"imageFormat"`
	Created CustomDateTime `xml:"created"`
	Updated CustomDateTime `xml:"updated"`
}

type ImageFormat

type ImageFormat struct {
	Type   string `xml:"type,attr"`
	URL    string `xml:",innerxml"`
	Height int    `xml:"height,attr"`
}

type ImageFormats

type ImageFormats []ImageFormat

func (ImageFormats) Original

func (f ImageFormats) Original() (*ImageFormat, bool)

type Price

type Price struct {
	Unit    string `xml:"unit,attr"` // Currency
	Content string `xml:",cdata"`
}

func (Price) IsValid

func (p Price) IsValid() bool

type Quantity

type Quantity struct {
	Unit    string `xml:"unit,attr"` // Currency
	Content string `xml:",cdata"`
}

func (Quantity) ToInt

func (q Quantity) ToInt() int

type Text

type Text struct {
	Lang    string `xml:"lang,attr"`
	Content string `xml:",cdata"`
}

type Texts

type Texts []Text

func (Texts) Languages

func (texts Texts) Languages() []string

func (Texts) ToTextMap

func (texts Texts) ToTextMap() obtypes.TextMap

func (Texts) ToTextMapWithFallback

func (texts Texts) ToTextMapWithFallback(defaultLang string) obtypes.TextMap

Jump to

Keyboard shortcuts

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