stnet

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: 14 Imported by: 0

Documentation

Overview

Package stnet is a wrapper to access the STnet API.

Index

Constants

View Source
const (
	GeoExact      = "EXACT"
	GeoOnlyStreet = "ONLY_STREET"
	GeoOnlyZip    = "ONLY_ZIP"
	GeoNone       = "NONE"

	TypeHotel = "597"
	TypePara  = "1556"
)

Variables

This section is empty.

Functions

func DECtoSEX

func DECtoSEX(angle float64) float64

func WGS84toCH1903

func WGS84toCH1903(lng, lat float64) (x, y int)

Types

type Activity

type Activity struct {
	Price string     `xml:"price"`
	ID    string     `xml:"id"`
	Text  []LangText `xml:"text"`
}

type Address

type Address struct {
	Name1   string `xml:"name1"`
	Street1 string `xml:"street1"`
	Street2 string `xml:"street2"`
	Zip     string `xml:"zip"`
	Place   string `xml:"place"`
	Phone1  string `xml:"phone1"`
	Email   string `xml:"email"`
	Url     string `xml:"url"`
	Rkey    string `xml:"resort>id"`
}

type AddressClient

type AddressClient struct {
	H        *resty.Client
	Endpoint string
}

func NewAddressClient

func NewAddressClient(endpoint, username, password string) *AddressClient

func (*AddressClient) Upsert

func (c *AddressClient) Upsert(data map[string]string) (int, error)

Upsert patches an Address

type AdventureExecutionDate

type AdventureExecutionDate struct {
	From string `xml:"from"`
	To   string `xml:"to"`
}

type AdventureInfo

type AdventureInfo struct {
	Subcat                 Subcat      `xml:"subcat"`
	OfferLink              cdataString `xml:"offerLink"`
	NameEntertainer        cdataString `xml:"nameEntertainer"`
	PriceFrom              string      `xml:"priceFrom"`
	PriceNormal            string      `xml:"priceNormal"`
	ExecutionRkey          string      `xml:"executionResort>id"`
	MaxParticipants        int         `xml:"maxParticipants"`
	MinParticipants        int         `xml:"minParticipants"`
	ExecutionUnknown       bool        `xml:"executionUnknown"`
	ExecutionOnRequest     bool        `xml:"executionOnRequest"`
	ReservationEmail       bool        `xml:"reservationEmail"`
	ReservationEmailInput  cdataString `xml:"reservationEmailInput"`
	ReservationTel         bool        `xml:"reservationTel"`
	ReservationTelInput    cdataString `xml:"reservationTelInput"`
	ReservationOnline      int         `xml:"reservationOnline"`
	Admin2                 cdataString `xml:"admin2"`
	ExecutionPlaceFreetext cdataString `xml:"executionPlaceFreetext"`
}

func (*AdventureInfo) GetPrice

func (a *AdventureInfo) GetPrice() float64

type AdventureOffer

type AdventureOffer struct {
	ID                      string                   `xml:"id"`
	AdventureInfo           AdventureInfo            `xml:"adventureInfo"`
	Address                 Adventureaddress         `xml:"address"`
	InfoURL                 IDSTRLangText            `xml:"infoUrl"`
	BookingURL              IDSTRLangText            `xml:"bookingUrl"`
	AdventureExecutionDates []AdventureExecutionDate `xml:"adventureExecutionDates>adventureExecutionDate"`
	AdventureTypes          []IDSTRLangText          `xml:"adventureTypes>adventureType"`
	AdventureLanguages      []IDSTRLangText          `xml:"adventureLanguages>adventureLanguage"`
	AdventureSeasons        []IDSTRLangText          `xml:"adventureSeasons>adventureSeason"`
	AdventureSegments       []IDSTRLangText          `xml:"adventureSegments>adventureSegment"`
	AdventureTravelGroups   []IDSTRLangText          `xml:"adventureTravelGroups>adventureTravelGroup"`
	AdventureActivities     []Activity               `xml:"adventureActivities>adventureActivity"`
	Images                  []Image                  `xml:"images"`
	Title                   []Title                  `xml:"title>text"`
	Description             []Description            `xml:"description>text"`
	Leadtext                []Leadtext               `xml:"leadText>text"`
	Weather                 []Leadtext               `xml:"weather>text"`
	Duration                []Leadtext               `xml:"duration>text"`
}

func (*AdventureOffer) GetAdventureSeasons

func (a *AdventureOffer) GetAdventureSeasons() []string

func (*AdventureOffer) GetAdventureTypeIDs

func (a *AdventureOffer) GetAdventureTypeIDs() []string

type AdventureType

type AdventureType struct {
	ID   int        `xml:"id"`
	Text []LangText `xml:"text"`
}

type Adventureaddress

type Adventureaddress struct {
	ID      string      `xml:"id"`
	Rkey    string      `xml:"resort>id"`
	Zip     cdataString `xml:"zip"`
	Place   cdataString `xml:"place"`
	Name1   cdataString `xml:"name1"`
	Street1 cdataString `xml:"street1"`
	Street2 cdataString `xml:"street2"`
	Email   cdataString `xml:"email"`
	Phone1  cdataString `xml:"phone1"`
	Url     cdataString `xml:"url"`
}

type AkeyAddress

type AkeyAddress struct {
	ID           string       `xml:"id"`
	Name         cdataString  `xml:"name1"`
	Street       cdataString  `xml:"street1"`
	Zip          cdataString  `xml:"zip"`
	Place        cdataString  `xml:"place"`
	Phone        cdataString  `xml:"phone1"`
	Email        cdataString  `xml:"email"`
	Resort       Resort       `xml:"resort"`
	GeoReference Georeference `xml:"geoReference"`
}

type Bookingurl

type Bookingurl struct {
	Lang string `xml:"lang,attr"`
	Text 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) GetAddresses

func (c *Client) GetAddresses() ([]AkeyAddress, error)

func (*Client) GetAdventureOffers

func (c *Client) GetAdventureOffers() ([]AdventureOffer, error)

func (*Client) GetOffers

func (c *Client) GetOffers() ([]Offer, error)

func (*Client) GetResorts

func (c *Client) GetResorts() ([]Resort, error)

GetResorts gets a list of resorts

type Description

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

type Format

type Format struct {
	Type string `xml:"type,attr"`
	Url  string `xml:",cdata"`
}

type Georeference

type Georeference struct {
	X                int     `xml:"x"`
	Y                int     `xml:"y"`
	Lat              float64 `xml:"latitude"`
	Lng              float64 `xml:"longitude"`
	Altitude         float64 `xml:"altitude"`
	GeoReferenceType string  `xml:"geoReferenceType"`
}

type GetAddressResult

type GetAddressResult struct {
	XMLName xml.Name       `xml:"addresses"`
	Header  ResponseHeader `xml:"header"`
	Address []AkeyAddress  `xml:"address"`
}

type GetAdventureOffersResult

type GetAdventureOffersResult struct {
	XMLName xml.Name         `xml:"offers"`
	Header  ResponseHeader   `xml:"header"`
	Offer   []AdventureOffer `xml:"adventureOffer"`
}

type GetOffersResult

type GetOffersResult struct {
	XMLName xml.Name       `xml:"offers"`
	Header  ResponseHeader `xml:"header"`
	Offer   []Offer        `xml:"hotelOffer"`
}

type GetResortsResult

type GetResortsResult struct {
	XMLName xml.Name       `xml:"resorts"`
	Header  ResponseHeader `xml:"header"`
	Resort  []Resort       `xml:"resort"`
}

type IDLangText

type IDLangText struct {
	ID   int        `xml:"id"`
	Text []LangText `xml:"text"`
}

type IDSTRLangText

type IDSTRLangText struct {
	ID   string     `xml:"id"`
	Text []LangText `xml:"text"`
}

type Image

type Image struct {
	Imageformat []Imageformat `xml:"image"`
}

type Imageformat

type Imageformat struct {
	Type   string   `xml:"type,attr"`
	Format []Format `xml:"imageFormat"`
}

type LangText

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

type Leadtext

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

type Offer

type Offer struct {
	ID             string         `xml:"id"`
	Subcat         Subcat         `xml:"hotelInfo>subcat"`
	Place          Place          `xml:"hotelInfo>place"`
	ValidFrom      string         `xml:"hotelInfo>validFrom"`
	ValidTo        string         `xml:"hotelInfo>validTo"`
	PriceFrom      float64        `xml:"hotelInfo>priceFrom"`
	PriceNormal    float64        `xml:"hotelInfo>priceNormal"`
	Description    []Description  `xml:"description>text"`
	Bookingurl     []Bookingurl   `xml:"bookingUrl>text"`
	Address        Address        `xml:"address"`
	Images         []Image        `xml:"images"`
	Title          []Title        `xml:"title>text"`
	RoomcategoryID int            `xml:"hotelInfo>roomCategory>id"`
	Roomcategory   []Roomcategory `xml:"hotelInfo>roomCategory>text"`
}

func (*Offer) GetPrice

func (o *Offer) GetPrice() float64

type Place

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

type Resort

type Resort struct {
	ID           uint             `xml:"id"`
	Zip          string           `xml:"zip"`
	Region       string           `xml:"region>id"`
	Names        []TranslatedText `xml:"name>text"`
	Searchfield  string           `xml:"searchfield"`
	ResortZips   []ResortZip      `xml:"resortZips>resortZip"`
	Georeference Georeference     `xml:"geoReference"`
}

type ResortZip

type ResortZip struct {
	Zip        string `xml:"zip"`
	Name       string `xml:"name"`
	Canton     string `xml:"canton"`
	Defaultzip string `xml:"isDefaultZip"`
}

type ResponseHeader

type ResponseHeader struct {
	ResultSize    int `xml:"resultSize"`
	PageSize      int `xml:"pageSize"`
	ResultsInPage int `xml:"resultsInPage"`
	TotalPages    int `xml:"totalPages"`
	CurrentPage   int `xml:"currentPage"`
}

type Roomcategory

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

type Subcat

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

type Title

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

type TranslatedText

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

Jump to

Keyboard shortcuts

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