hotelbeds

package module
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2024 License: MIT Imports: 15 Imported by: 0

README

HotelBeds client written in Go

Go client written for HotelBeds. It's unofficial client, currently supported only by my 0x9ef. I will tack version changes and changelogs as soon as possible.

Installation

NOTE: Requires at least Go 1.18 since we use generics

To get latest version use:

go get github.com/0x9ef/hotelbeds-go@latest

To specify version use:

go get github.com/0x9ef/clientx@1.24.4 # version

Usage Examples

See examples/ folder or _test.go files.

Getting Started

The client is built on ClientX library, so if there is no way to implement some functionality through because of ClientX, please submit issue or create pull request in ClientX repository.

Initialization

The client automatically builds authorization headers and calculates X-Signature from current timestamp, so you don't need to do it manually.

api := hotelbeds.New(os.Getenv("HOTELBEDS_API_KEY"), os.Getenv("HOTELBEDS_API_SECRET"))

Useful information

Useful articles to stay tuned:

Get Availability

func main() {
	api := hotelbeds.New(os.Getenv("HOTELBEDS_API_KEY"), os.Getenv("HOTELBEDS_API_SECRET"))

	ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
	defer cancel()

	resp, err := api.ListAvailableHotels(ctx, &hotelbeds.ListAvailableHotelsInput{
		Stay: hotelbeds.Stay{
			CheckIn:  "2024-04-02",
			CheckOut: "2024-04-03",
		},
		Occupancies: []hotelbeds.Occupancy{
			{
				Rooms:  1,
				Adults: 1,
			},
		},
		Hotels: hotelbeds.FilterHotel{
			HotelCodes: []int{6619, 6613},
		},
	})
	if err != nil {
		panic(err)
	}

	... // do something with resp
}

Implementation status

Internal:

  • API Client
  • Rate Limiting
  • Retry Mechanism
  • Error Handling

Hotel APIs:

  • Availability
  • Check rates
  • Booking Confirmation
  • Booking List
  • Booking Detail
  • Booking Change
  • Booking Cancellation
  • Booking Reconfirmation

Content APIs:

  • Hotels List
  • Hotel Details
  • Countries
  • Destinations
  • Acommodations
  • Boards
  • BoardGroups
  • Categories
  • Chains
  • Classifications
  • Currencies
  • Facilities
  • Facility Groups
  • Facility Typologies
  • Image Types
  • Issues
  • Languages
  • Promotions
  • Rate Comments
  • Rate Comment Details
  • Rooms
  • Segments

License

This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.

Documentation

Overview

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Copyright (c) 2024 0x9ef. All rights reserved. Use of this source code is governed by an MIT license that can be found in the LICENSE file.

Index

Constants

This section is empty.

Variables

View Source
var (
	// General error.
	ErrNoHealthyUpstream = errors.New("no healthy upstead")
	ErrExternal          = errors.New("external error")
	ErrRateLimitExceeded = errors.New("rate limits exceeded")
	ErrQuotaExceeded     = errors.New("quota exceeded")
	ErrConfiguration     = errors.New("configuration error")
	ErrSystem            = errors.New("system error")
	ErrInvalidRequest    = errors.New("invalid request")
	ErrInvalidData       = errors.New("invalid data")

	// Product errors.
	ErrAllotmentExceeded                                = errors.New("allotment exceeded")
	ErrInsufficientAllotment                            = errors.New("insufficient allotment")
	ErrPriceHasIncreased                                = errors.New("price has increased")
	ErrPriceHasChanged                                  = errors.New("price has changed")
	ErrStopSales                                        = errors.New("stop sales")
	ErrBookingDoesNotExist                              = errors.New("booking does not exist")
	ErrBookingCannotBeCanceledAfterCheckIn              = errors.New("cannot cancel a booking after the check-in")
	ErrBookingCannotBeCanceledOrModifiedWhenCheckInPast = errors.New("cannot cancel/modify a booking which has a check-in date in the past")
	ErrBookingCannotBeAmended                           = errors.New("this booking cannot be amended")
	ErrBookingConfirmationError                         = errors.New("booking confirmation error")
	ErrMinimumStayViolated                              = errors.New("minimum stay violated")
	ErrCodeIsInvalid                                    = errors.New("code is invalid")
	ErrPleaseDoNotTryAgain                              = errors.New("please do not retry again")
	ErrHotelDoesNotAllowCancellation                    = errors.New("hotel does not allow cancellations")
	ErrReservationUnreachable                           = errors.New("reservation does not exist or the agency does not access")
	ErrUndefined                                        = errors.New("undefined error")
)

Functions

func IsErrorCode

func IsErrorCode(err error, code ErrorCode) bool

IsErrorCode checks if error contains specified code.

func IsErrorRetryable

func IsErrorRetryable(err error) bool

IsErrorRetryable checks if error is retryable.

func ParseE163

func ParseE163(raw string) string

ParseE164 validates HotelBeds-styled phone number and converts into international E164 phone number.

Types

type API

type API struct {
	*clientx.API
	// contains filtered or unexported fields
}

type Accommodation added in v0.2.0

type Accommodation struct {
	Code            string `json:"code"`
	TypeDescription string `json:"typeDescription"`
}

type Address

type Address struct {
	Content string `json:"content"`
	Street  string `json:"street"`
	Number  string `json:"number,omitempty"`
}

type Amount

type Amount decimal.Decimal

Amount is an arbitrary-precision decimal.

func (Amount) MarshalJSON

func (a Amount) MarshalJSON() ([]byte, error)

func (*Amount) UnmarshalJSON

func (a *Amount) UnmarshalJSON(data []byte) error

type AuditData

type AuditData struct {
	ProcessTime  ProcessTime  `json:"processTime"`
	Timestamp    Timestamp    `json:"timestamp"`
	RequestHosts Hosts        `json:"requestHost"`
	Environments Environments `json:"environment"`
	ServerID     string       `json:"serverId"`
	Release      string       `json:"release,omitempty"`
	Token        string       `json:"token"`
	Internal     string       `json:"internal"`
}

AuditData represents useful debug information about timestamp when request happened, time to process, server ID, etc...

type AvailableHotel

type AvailableHotel struct {
	Code            int                  `json:"code"`
	Name            string               `json:"name"`
	CategoryCode    string               `json:"categoryCode"`
	CategoryName    string               `json:"categoryName"`
	DestinationCode string               `json:"destinationCode"`
	DestinationName string               `json:"destinationName"`
	ZoneCode        int                  `json:"zoneCode"`
	ZoneName        string               `json:"zoneName"`
	Latitude        Coordinate           `json:"latitude"`
	Longitude       Coordinate           `json:"longitude"`
	Rooms           []AvailableHotelRoom `json:"rooms"`
	MinRate         FloatRate            `json:"minRate"`
	MaxRate         FloatRate            `json:"maxRate"`
	Currency        string               `json:"currency"`
}

type AvailableHotelRoom

type AvailableHotelRoom struct {
	Code  string `json:"code"`
	Name  string `json:"name"`
	Rates []Rate `json:"rates"`
}

type BillingAddress added in v0.2.0

type BillingAddress struct {
	Address1    string `json:"address1"`
	Address2    string `json:"address2"`
	City        string `json:"city"`
	State       string `json:"state"`
	PostalCode  string `json:"postalCode"`
	CountryCode string `json:"countryCode"`
}

type Board added in v0.2.0

type Board struct {
	Code             string  `json:"code"`
	Description      Content `json:"description"`
	MultiLingualCode string  `json:"multiLingualCode"`
}

type BoardGroup added in v0.2.0

type BoardGroup struct {
	Code             string  `json:"code"`
	Description      Content `json:"description"`
	MultiLingualCode string  `json:"multiLingualCode"`
}

type Booking added in v0.2.0

type Booking struct {
	Reference             string             `json:"reference"`
	CancellationReference string             `json:"cancellationReference"`
	ClientReference       string             `json:"clientReference"`
	CreationDate          Datetime           `json:"creationDate"`
	CreationUser          string             `json:"creationUser"`
	Status                BookingStatus      `json:"status"`
	ModificationPolicy    ModificationPolicy `json:"modificationPolicies"`
	AgComission           string             `json:"agComission"`
	VATComission          string             `json:"comissionVAT"`
	Holder                Holder             `json:"holder"`
	Remark                string             `json:"remark"`
	InvoiceCompany        InvoiceCompany     `json:"invoiceCompany"`
	TotalSellingRate      Amount             `json:"totalSellingRate"`
	TotalNet              Amount             `json:"totalNet"`
	PendingAmount         Amount             `json:"pendingAmount"`
	Currency              string             `json:"currency"`
	Hotel                 BookingHotel       `json:"hotel"`
}

type BookingClient

type BookingClient interface {
	ListAvailableHotels(ctx context.Context, inp *ListAvailableHotelsInput) (*ListAvailableHotelsResponse, error)
	ListCheckRates(ctx context.Context, inp *ListCheckRatesInput) (*ListCheckRatesResponse, error)
	GetBooking(ctx context.Context, id string) (*GetBookingResponse, error)
	ListBookings(ctx context.Context, inp *CancelBookingInput) (*CancelBookingResponse, error)
	ConfirmBooking(ctx context.Context, inp *ConfirmBookingInput) (*ConfirmBookingResponse, error)
	ChangeBooking(ctx context.Context, id string, inp *ChangeBookingInput) (*ChangeBookingResponse, error)
	CancelBooking(ctx context.Context, id string, inp *CancelBookingInput) (*CancelBookingResponse, error)
}

type BookingHotel added in v0.2.0

type BookingHotel struct {
	AvailableHotel
	CheckIn            string          `json:"checkIn"`
	CheckOut           string          `json:"checkOut"`
	TotalSellingRate   Amount          `json:"totalSellingRate"`
	TotalNet           Amount          `json:"totalNet"`
	PendingAmount      Amount          `json:"pendingAmount"`
	Currency           string          `json:"currency"`
	Supplier           *Supplier       `json:"supplier"`
	ClientComments     string          `json:"clientComments"`
	CancellationAmount Amount          `json:"cancellationAmount"`
	Upselling          []UpsellingRate `json:"upselling,omitempty"`
	Keywords           []Keyword       `json:"keywords,omitempty"`
	Reviews            []Review        `json:"reviews,omitempty"`
	Rooms              []BookingRoom   `json:"rooms"`
}

type BookingRoom added in v0.2.0

type BookingRoom struct {
	Code              string        `json:"code"`
	Name              string        `json:"name"`
	Status            BookingStatus `json:"status"`
	ID                int           `json:"id"`
	SupplierReference string        `json:"supplierReference,omitempty"`
	Paxes             []Pax         `json:"paxes"`
	Rates             []Rate        `json:"rates"`
}

type BookingStatus added in v0.2.0

type BookingStatus string
const (
	BookingStatusConfirmed BookingStatus = "CONFIRMED"
	BookingStatusCancelled BookingStatus = "CANCELLED"
)

func (BookingStatus) String added in v0.2.0

func (s BookingStatus) String() string

type BreakDown

type BreakDown struct {
	Discounts []Discount `json:"rateDiscounts"`
}

type CancelBookingInput added in v0.2.0

type CancelBookingInput struct {
	// Enum: "CANCELLATION" "SIMULATION"
	// Defines if the operation will be a simulation or an actual cancellation.
	Mode     Mode   `url:"cancellationFlag"`
	Language string `url:"language"`
}

type CancelBookingResponse added in v0.2.0

type CancelBookingResponse struct {
	Audit   *AuditData `json:"auditData"`
	Booking *Booking   `json:"booking"`
}

type CancellationPolicy

type CancellationPolicy struct {
	Amount Amount      `json:"amount"`
	From   TimestampTZ `json:"from"`
}

type Category added in v0.2.0

type Category struct {
	Code        string     `json:"code"`
	SimpleCode  SimpleCode `json:"simpleCode"`
	Group       string     `json:"group"`
	Description Content    `json:"description"`
}

type Chain added in v0.2.0

type Chain struct {
	Code        string  `json:"code"`
	Description Content `json:"description"`
}

type ChangeBookingInput added in v0.2.0

type ChangeBookingInput struct {
	// Enum: "SIMULATION" "UPDATE"
	// Defines if the operation will be a simulation or an actual modification.
	Mode     Mode         `json:"mode"`
	Payment  *PaymentData `json:"paymentData"`
	Language string       `json:"language"`
	Booking  *Booking     `json:"booking"`
}

type ChangeBookingResponse added in v0.2.0

type ChangeBookingResponse struct {
	Audit   *AuditData `json:"auditData"`
	Booking *Booking   `json:"booking"`
}

type CheckRate

type CheckRate struct {
	Rate
	RateComments string `json:"rateComments"`
	Taxes        *struct {
		Taxes []Tax `json:"taxes"`
	} `json:"taxes,omitempty"`
	BreakDown *BreakDown `json:"breakDown,omitempty"`
}

type CheckRateHotel

type CheckRateHotel struct {
	Code                 int                `json:"code"`
	Name                 string             `json:"name"`
	CategoryCode         string             `json:"categoryCode"`
	CategoryName         string             `json:"categoryName"`
	DestinationCode      string             `json:"destinationCode"`
	DestinationName      string             `json:"destinationName"`
	ZoneCode             int                `json:"zoneCode"`
	ZoneName             string             `json:"zoneName"`
	Latitude             Coordinate         `json:"latitude"`
	Longitude            Coordinate         `json:"longitude"`
	Rooms                []CheckRateRoom    `json:"rooms"`
	MinRate              *FloatRate         `json:"minRate"`
	MaxRate              *FloatRate         `json:"maxRate"`
	Currency             string             `json:"currency"`
	CheckIn              string             `json:"checkIn"`
	CheckOut             string             `json:"checkOut"`
	TotalNet             Amount             `json:"totalNet"`
	PaymentDataRequired  bool               `json:"paymentDataRequired"`
	ModificationPolicies ModificationPolicy `json:"modificationPolicies"`
}

type CheckRateRoom

type CheckRateRoom struct {
	Code  string      `json:"code"`
	Name  string      `json:"name"`
	Rates []CheckRate `json:"rates"`
}

type Classification added in v0.2.0

type Classification struct {
	Code        string  `json:"code"`
	Description Content `json:"description"`
}

type Client

type Client interface {
	ContentClient
	BookingClient
}

func New

func New(apiKey, apiSecret string, opts ...Option) Client

New returns new API with provided apiKey, apiSecret, applies all options.

type CommaSliceInt added in v0.2.0

type CommaSliceInt []int

func (*CommaSliceInt) UnmarshalJSON added in v0.2.0

func (s *CommaSliceInt) UnmarshalJSON(data []byte) error

type CommaSliceString added in v0.2.0

type CommaSliceString []string

func (*CommaSliceString) UnmarshalJSON added in v0.2.0

func (s *CommaSliceString) UnmarshalJSON(data []byte) error

type ConfirmBookingInput added in v0.2.0

type ConfirmBookingInput struct {
	Holder  Holder       `json:"holder"`
	Payment *PaymentData `json:"paymentData,omitempty"`
	// Internal booking reference.
	ClientReference string `json:"clientReference"`
	// Identifies the agent name of the booking.
	// If empty, by default it will be the same than the apikey performing the booking .
	CreationUser string `json:"creationUser,omitempty"`
	// Free text sent to the hotelier. It can be used to request or inform of special requests to hotelier like:
	// “Non-smoking room preferred”, “Twin bed please”, “Upper floor preferred”, “Late arrival”….
	Remark  string   `json:"remark,omitempty"`
	Voucher *Voucher `json:"voucher,omitempty"`
	// Margin of price difference (as percentage) accepted when a price difference occurs between
	// Availability/CheckRate and Booking operations. Do not use more than two decimal characters when
	// defining tolerance.
	// Example: to input a tolerance of 5%, you should input 5.00.
	// NOTE: Authorisation for the use of this tag is subject to prior written agreement with your sales manager
	Tolerance Amount `json:"tolerance,omitempty"`
	// Language code that defines the language of the response.
	// English will be used by default if this field is not informed.
	Language string               `json:"language,omitempty"`
	Rooms    []ConfirmBookingRoom `json:"rooms"`
}

Reservations.

type ConfirmBookingResponse added in v0.2.0

type ConfirmBookingResponse struct {
	Audit   *AuditData `json:"auditData"`
	Booking *Booking   `json:"booking"`
}

type ConfirmBookingRoom added in v0.2.0

type ConfirmBookingRoom struct {
	RateKey string `json:"rateKey"`
	Paxes   []Pax  `json:"paxes"`
}

type ContactData added in v0.2.0

type ContactData struct {
	Email       string `json:"email"`
	PhoneNumber string `json:"phoneNumber"`
}

type Content

type Content struct {
	Content      string `json:"content"`
	LanguageCode string `json:"languageCode"`
}

type ContentClient

type ContentClient interface {
	ListHotels(ctx context.Context, inp *ListHotelsInput) (*ListHotelsResponse, error)
	GetHotelDetails(ctx context.Context, codes []int, inp *GetHotelDetailsInput) (*GetHotelDetailsResponse, error)
	ListAccommodations(ctx context.Context, inp *ListAccommodationsInput) (*ListAccommodationsResponse, error)
	ListCountries(ctx context.Context, inp *ListCountriesInput) (*ListCountriesResp, error)
	ListDestinations(ctx context.Context, inp *ListDestinationsInput) (*ListDestinationsResponse, error)
	ListBoards(ctx context.Context, inp *ListBoardsInput) (*ListBoardsResponse, error)
	ListBoardGroups(ctx context.Context, inp *ListBoardGroupsInput) (*ListBoardGroupsResponse, error)
	ListCategories(ctx context.Context, inp *ListCategoriesInput) (*ListCategoriesResponse, error)
	ListChains(ctx context.Context, inp *ListChainsInput) (*ListChainsResponse, error)
	ListClassifications(ctx context.Context, inp *ListClassificationsInput) (*ListClassificationsResponse, error)
	ListCurrencies(ctx context.Context, inp *ListCurrenciesInput) (*ListCurrenciesResponse, error)
	ListFacilities(ctx context.Context, inp *ListFacilitiesInput) (*ListFacilitiesResponse, error)
	ListFacilityGroups(ctx context.Context, inp *ListFacilityGroupsInput) (*ListFacilityGroupsResponse, error)
	ListFacilityTypologies(ctx context.Context, inp *ListFacilityTypologiesInput) (*ListFacilityTypologiesResponse, error)
	ListImageTypes(ctx context.Context, inp *ListImageTypesInput) (*ListImageTypesResponse, error)
	ListIssues(ctx context.Context, inp *ListIssuesInput) (*ListIssuesResponse, error)
	ListLanguages(ctx context.Context, inp *ListLanguagesInput) (*ListLanguagesResponse, error)
	ListPromotions(ctx context.Context, inp *ListPromotionsInput) (*ListPromotionsResponse, error)
	ListRooms(ctx context.Context, inp *ListRoomsInput) (*ListRoomsResponse, error)
	ListRateComments(ctx context.Context, inp *ListRateCommentsInput) (*ListRateCommentsResponse, error)
	ListSegments(ctx context.Context, inp *ListSegmentsInput) (*ListSegmentsResponse, error)
	ListTerminals(ctx context.Context, inp *ListTerminalsInput) (*ListTerminalsResponse, error)
}

type Coordinate

type Coordinate float64

func (*Coordinate) UnmarshalJSON

func (c *Coordinate) UnmarshalJSON(data []byte) error

type Coordinates

type Coordinates struct {
	Long float64 `json:"longitude"`
	Lat  float64 `json:"latitude"`
}

type Country

type Country struct {
	Code    string  `json:"code"`
	IsoCode string  `json:"isoCode"`
	States  []State `json:"states"`
}

type Currency added in v0.2.0

type Currency struct {
	Code        string  `json:"code"`
	Type        string  `json:"currencyType"`
	Description Content `json:"description"`
}

type DailyRate added in v0.2.0

type DailyRate struct {
	// Day number of the stay for which the breakdown is made.
	Offset  int    `json:"offset"`
	Net     Amount `json:"net"`
	Selling Amount `json:"selling"`
}

type Datetime

type Datetime time.Time

Datetime is time with "2006-01-02" layout.

func (Datetime) IsZero

func (d Datetime) IsZero() bool

func (Datetime) MarshalJSON

func (t Datetime) MarshalJSON() ([]byte, error)

func (Datetime) String

func (d Datetime) String() string

func (*Datetime) UnmarshalJSON

func (t *Datetime) UnmarshalJSON(data []byte) error

type Destination

type Destination struct {
	Code        string      `json:"code"`
	CountryCode string      `json:"countryCode"`
	Zones       []Zone      `json:"zones"`
	GroupZones  []GroupZone `json:"groupZones"`
}

type Device added in v0.2.0

type Device struct {
	ID        string `json:"id"`
	IP        string `json:"ip"`
	UserAgent string `json:"userAgent"`
}

type Discount

type Discount struct {
	Code   string `json:"code"`
	Name   string `json:"name"`
	Amount Amount `json:"amount"`
}

type Distance

type Distance float64

func (*Distance) UnmarshalJSON

func (d *Distance) UnmarshalJSON(data []byte) error

type Email added in v0.2.0

type Email struct {
	To    string `json:"to"`
	From  string `json:"from"`
	Title string `json:"title"`
	Body  string `json:"body"`
}

type Environments

type Environments []string

func (*Environments) UnmarshalJSON

func (rh *Environments) UnmarshalJSON(data []byte) error

type Error

type Error struct {
	Audit   *AuditData `json:"auditData"`
	Code    ErrorCode  `json:"code"`
	Message string     `json:"message"`
	// Our internal variables.
	StatusCode  int  `json:"-"`
	IsRetryable bool `json:"-"`
}

func (*Error) Error

func (e *Error) Error() string

type ErrorCode

type ErrorCode string

ErrorCode represents code of HotelBeds error.

const (
	ErrorCodeConfiguration  ErrorCode = "CONFIGURATION_ERROR"
	ErrorCodeSystem         ErrorCode = "SYSTEM_ERROR"
	ErrorCodeInvalidRequest ErrorCode = "INVALID_REQUEST"
	ErrorCodeInvalidData    ErrorCode = "INVALID_DATA"
	ErrorCodeProduct        ErrorCode = "PRODUCT_ERROR"
)

type Facility

type Facility struct {
	Code         int     `json:"code"`
	GroupCode    int     `json:"facilityGroupCode"`
	TopologyCode int     `json:"topologyCode"`
	Description  Content `json:"description"`
}

type FacilityGroup added in v0.2.0

type FacilityGroup struct {
	Code        int     `json:"code"`
	Description Content `json:"description"`
}

type FacilityTypology added in v0.2.0

type FacilityTypology struct {
	Code                int  `json:"code"`
	HasNumber           bool `json:"numberFlag"`
	HasLogic            bool `json:"logicFlag"`
	HasDistance         bool `json:"distanceFlag"`
	HasAgeFrom          bool `json:"ageFromFlag"`
	HasAgeTo            bool `json:"ageToFlag"`
	HasTimeFrom         bool `json:"timeFromFlag"`
	HasTimeTo           bool `json:"timeToFlag"`
	HasIndicatesYesOrNo bool `json:"indYesOrNoFlag"`
	HasAmount           bool `json:"amountFlag"`
	HasCurrency         bool `json:"currencyFlag"`
	HasApplicationType  bool `json:"appTypeFlag"`
	HasText             bool `json:"textFlag"`
}

type Filter

type Filter struct {
	MaxHotels       int       `json:"maxHotels,omitempty"`
	MaxRooms        int       `json:"maxRooms,omitempty"`
	MinRate         FloatRate `json:"minRate,omitempty"`
	MaxRate         FloatRate `json:"maxRate,omitempty"`
	MaxRatesPerRoom int       `json:"maxRatesPerRoom"`
	MinCategory     int       `json:"minCategory,omitempty"`
	MaxCategory     int       `json:"maxCategory,omitempty"`
}

func (*Filter) Validate

func (filter *Filter) Validate() error

type FilterBoards

type FilterBoards struct {
	Boards   []string `json:"boards"`
	Included bool     `json:"included"`
}

type FilterHotel

type FilterHotel struct {
	HotelCodes []int `json:"hotel"`
}

func (*FilterHotel) Validate

func (f *FilterHotel) Validate() error

type FilterRooms

type FilterRooms struct {
	Codes    []string `json:"room"`
	Included bool     `json:"included"`
}

type FloatRate

type FloatRate float64

func (FloatRate) Float

func (r FloatRate) Float() float64

func (FloatRate) MarshalJSON

func (r FloatRate) MarshalJSON() ([]byte, error)

func (*FloatRate) UnmarshalJSON

func (r *FloatRate) UnmarshalJSON(data []byte) error

type Geolocation

type Geolocation struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
	Radius    Radius  `json:"radius"`
	Unit      Unit    `json:"unit"`
}

func (*Geolocation) Validate

func (geo *Geolocation) Validate() error

type GetBookingResponse added in v0.2.0

type GetBookingResponse struct {
	Audit   *AuditData `json:"auditData"`
	Booking *Booking   `json:"booking"`
}

type GetHotelDetailsInput

type GetHotelDetailsInput struct {
	Language             string `url:"language"`
	UseSecondaryLanguage *bool  `url:"useSecondaryLanguage"`
}

func (GetHotelDetailsInput) Encode

func (inp GetHotelDetailsInput) Encode(v url.Values) error

type GetHotelDetailsResponse

type GetHotelDetailsResponse struct {
	Audit  *AuditData `json:"auditData"`
	Hotels []Hotel    `json:"hotels"`
}

type GroupZone

type GroupZone struct {
	Code string  `json:"groupZoneCode"`
	Name Content `json:"content"`
}

type Holder added in v0.2.0

type Holder struct {
	Name    string `json:"name"`
	Surname string `json:"surname"`
}

type Hosts

type Hosts []string

func (*Hosts) UnmarshalJSON

func (rh *Hosts) UnmarshalJSON(data []byte) error

type Hotel

type Hotel struct {
	Code                 int                  `json:"code"`
	Name                 Content              `json:"name"`
	CountryCode          string               `json:"countryCode"`
	StateCode            string               `json:"stateCode"`
	DestinationCode      string               `json:"destinationCode"`
	ZoneCode             int                  `json:"zoneCode"`
	Coordinates          Coordinates          `json:"coordinates"`
	CategoryCode         string               `json:"categoryCode"`
	CategoryGroupCode    string               `json:"categoryGroupCode"`
	ChainCode            string               `json:"chainCode"`
	AccommodationType    *HotelAccomodation   `json:"accommodationType"`
	AccomodationTypeCode string               `json:"accomodationTypeCode,omitempty"`
	BoardCodes           []string             `json:"boardCodes"`
	SegmentCodes         []int                `json:"segmentCodes"`
	Address              Address              `json:"address"`
	PostalCode           string               `json:"postalCode"`
	City                 Content              `json:"city"`
	Email                string               `json:"email"`
	License              string               `json:"license,omitempty"`
	URL                  string               `json:"web"`
	LastUpdate           Datetime             `json:"lastUpdate"`
	S2C                  string               `json:"S2C"`
	Ranking              int                  `json:"ranking"`
	Phones               []Phone              `json:"phones"`
	Rooms                []HotelRoom          `json:"rooms"`
	Facilities           []HotelFacility      `json:"facilities"`
	Issues               []HotelIssue         `json:"issues"`
	Wildcards            []HotelWildCard      `json:"wildCards"`
	Terminals            []HotelTerminal      `json:"terminals"`
	InterestPoints       []HotelInterestPoint `json:"interestPoints"`
	Images               []HotelImage         `json:"images,omitempty"`
}

type HotelAccomodation

type HotelAccomodation struct {
	Code        string `json:"code"`
	Description string `json:"typeDescription"`
}

type HotelFacility added in v0.2.0

type HotelFacility struct {
	Code          int      `json:"facilityCode"`
	GroupCode     int      `json:"facilityGroupCode"`
	Order         Order    `json:"order"`
	IndicateLogic bool     `json:"indLogic"`
	IndicateFee   bool     `json:"indFee"`
	Number        int      `json:"number"`
	Voucher       bool     `json:"voucher"`
	Distance      Distance `json:"distance"`
}

type HotelImage added in v0.2.0

type HotelImage struct {
	TypeCode           string `json:"imageTypeCode"`
	Path               string `json:"path"`
	Order              Order  `json:"order"`
	VisualOrder        int    `json:"visualOrder"`
	RoomCode           string `json:"roomCode"`
	RoomType           string `json:"roomType"`
	CharacteristicCode string `json:"characteristicCode"`
}

type HotelInterestPoint added in v0.2.0

type HotelInterestPoint struct {
	FacilityCode      int      `json:"facilityCode"`
	FacilityGroupCode int      `json:"facilityGroupCode"`
	Order             Order    `json:"order"`
	Name              string   `json:"poiName"`
	Distance          Distance `json:"distance"`
}

type HotelIssue added in v0.2.0

type HotelIssue struct {
	Code          string    `json:"issueCode"`
	Type          string    `json:"issueType"`
	From          time.Time `json:"dateFrom"`
	To            time.Time `json:"dateTo"`
	Order         Order     `json:"order"`
	IsAlternative bool      `json:"alternative"`
}

type HotelRoom

type HotelRoom struct {
	Code               string              `json:"roomCode"`
	IsParentRoom       bool                `json:"isParentRoom"`
	MinPax             int                 `json:"minPax"`
	MaxPax             int                 `json:"maxPax"`
	MinAdults          int                 `json:"minAdults"`
	MaxAdults          int                 `json:"maxAdults"`
	MinChildren        int                 `json:"minChildren"`
	MaxChildren        int                 `json:"maxChildren"`
	Type               string              `json:"roomType"`
	CharacteristicCode string              `json:"characteristicCode"`
	Facilities         []HotelRoomFacility `json:"roomFacilities"`
}

type HotelRoomFacility

type HotelRoomFacility struct {
	Code          int  `json:"facilityCode"`
	GroupCode     int  `json:"facilityGroupCode"`
	IndicateLogic bool `json:"indLogic"`
	Number        int  `json:"number"`
	Voucher       bool `json:"voucher"`
}

type HotelRoomStay

type HotelRoomStay struct {
	Type        string              `json:"stayType"`
	Order       Order               `json:"order"`
	Description string              `json:"description"`
	Facilities  []HotelRoomFacility `json:"roomStayFacilities"`
}

type HotelTerminal added in v0.2.0

type HotelTerminal struct {
	Code     string   `json:"terminalCode"`
	Distance Distance `json:"distance"`
}

type HotelWildCard added in v0.2.0

type HotelWildCard struct {
	RoomType           string  `json:"roomType"`
	RoomCode           string  `json:"roomCode"`
	CharacteristicCode string  `json:"characteristicCode"`
	Description        Content `json:"hotelRoomDescription"`
}

type ImageType added in v0.2.0

type ImageType struct {
	Code        string  `json:"code"`
	Description Content `json:"description"`
}

type IncludeHotels

type IncludeHotels string
const (
	IncludeHotelsWebOnly   IncludeHotels = "webOnly"
	IncludeHotelsNotOnSale IncludeHotels = "notOnSale"
)

func (IncludeHotels) String

func (ih IncludeHotels) String() string

type InvoiceCompany added in v0.2.0

type InvoiceCompany struct {
	RegistrationNumber string `json:"registrationNumber"`
	Code               string `json:"code"`
	Name               string `json:"name"`
}

type Issue

type Issue struct {
	Code          string  `json:"code"`
	Type          string  `json:"type"`
	Description   Content `json:"description"`
	Name          Content `json:"name"`
	IsAlternative bool    `json:"alternative"`
}

type Keyword

type Keyword struct {
	Keywords    []int `json:"keywords,omitempty"`
	AllIncluded bool  `json:"allIncluded"`
}

type Language added in v0.2.0

type Language struct {
	Code        string  `json:"code"`
	Name        string  `json:"name"`
	Description Content `json:"description"`
}

type ListAccommodationsInput added in v0.2.0

type ListAccommodationsInput struct {
	ListInput
}

type ListAccommodationsResponse added in v0.2.0

type ListAccommodationsResponse struct {
	Audit          *AuditData `json:"auditData"`
	Accommodations []Accommodation
}

type ListAvailableHotelsInput

type ListAvailableHotelsInput struct {
	Stay        Stay          `json:"stay"`
	Occupancies []Occupancy   `json:"occupancies"`
	Keywords    []Keyword     `json:"keywords,omitempty"`
	Geolocation *Geolocation  `json:"geolocation,omitempty"`
	Filter      *Filter       `json:"filter,omitempty"`
	Boards      *FilterBoards `json:"boards,omitempty"`
	Rooms       *FilterRooms  `json:"rooms,omitempty"`
	Hotels      FilterHotel   `json:"hotels"`
	// Displays price breakdown per each day of the hotel stay.
	WithDailyRate bool `json:"dailyRate"`
	// Hotelbeds Group client source market.
	SourceMarket string `json:"sourceMarket,omitempty"`
	// Defines the platform for multiclient developer platforms.
	Platform int `json:"platform,omitempty"`
	// Language code that defines the language of the response.
	// English will be used by default if this field is not informed.
	Language string `json:"language,omitempty"`
	// Filter for accomodation type.
	Accomodations []string `json:"accomodations,omitempty"`
}

func (*ListAvailableHotelsInput) Validate

func (inp *ListAvailableHotelsInput) Validate() error

type ListAvailableHotelsResponse

type ListAvailableHotelsResponse struct {
	Audit  *AuditData `json:"auditData"`
	Hotels struct {
		CheckIn  Datetime         `json:"checkIn"`
		CheckOut Datetime         `json:"checkOut"`
		Total    int              `json:"total"`
		Hotels   []AvailableHotel `json:"hotels"`
	} `json:"hotels"`
}

type ListBoardGroupsInput added in v0.2.0

type ListBoardGroupsInput struct {
	Codes []string `json:"codes"`
	ListInput
}

type ListBoardGroupsResponse added in v0.2.0

type ListBoardGroupsResponse struct {
	Audit  *AuditData   `json:"auditData"`
	Groups []BoardGroup `json:"boards"`
}

type ListBoardsInput added in v0.2.0

type ListBoardsInput struct {
	ListInput
}

type ListBoardsResponse added in v0.2.0

type ListBoardsResponse struct {
	Audit  *AuditData `json:"auditData"`
	Boards []Board    ` json:"boards"`
}

type ListBookingsInput added in v0.2.0

type ListBookingsInput struct {
	ListInput
	FilterType            string `json:"filterType"`
	FilterClientReference string `json:"clientReference"`
	FilterCreationUser    string `json:"creationUser"`
	// Parameter to filter the results by the country code of the hotel. Can include multiple values separated by commas.
	FilterCountires    CommaSliceString `json:"country"`
	FilterDestinations CommaSliceString `json:"destination"`
	FilterHotels       CommaSliceInt    `json:"hotel"`
	// Defines the starting date of the range of bookings to be returned.
	FilterStart Datetime `json:"start"`
	// Defines the ending date of the range of bookings to be returned. value.
	FilterEnd Datetime `json:"end"`
}

type ListBookingsResponse added in v0.2.0

type ListBookingsResponse struct {
	Audit    *AuditData `json:"auditData"`
	Bookings []Booking  `json:"bookings"`
}

type ListCategoriesInput added in v0.2.0

type ListCategoriesInput struct {
	ListInput
}

type ListCategoriesResponse added in v0.2.0

type ListCategoriesResponse struct {
	Audit      *AuditData `json:"audit"`
	Categories []Category `json:"categories"`
}

type ListChainsInput added in v0.2.0

type ListChainsInput struct {
	ListInput
}

type ListChainsResponse added in v0.2.0

type ListChainsResponse struct {
	Audit  *AuditData `json:"auditData"`
	Chains []Chain    `json:"chains"`
}

type ListCheckRatesInput

type ListCheckRatesInput struct {
	// Parameter to add or remove the upSelling options node to the response.
	Upselling bool `json:"upselling"`
	// When true, it will add either the percent or the numberOfnights to the cancellation policies.
	ExpandCXL bool `json:"expandCXL"`
	// Language code that defines the language of the response.
	// English will be used by default if this field is not informed.
	Language string `json:"language"`
	// List of rooms to be checked/valuated.
	Rooms []ListCheckRatesRoom `json:"rooms"`
}

CheckRates.

type ListCheckRatesResponse

type ListCheckRatesResponse struct {
	Audit *AuditData      `json:"auditData"`
	Hotel *CheckRateHotel `json:"hotel"`
}

type ListCheckRatesRoom

type ListCheckRatesRoom struct {
	// Internal key that represents a combination of room type, category, board and occupancy.
	// Is returned in Availability and used to valuate a rate and confirm a booking.
	RateKey string `json:"rateKey"`
	// Data of the passengers assigned to this room.
	Paxes []Pax `json:"paxes"`
}

type ListClassificationsInput added in v0.2.0

type ListClassificationsInput struct {
	ListInput
}

type ListClassificationsResponse added in v0.2.0

type ListClassificationsResponse struct {
	Audit           *AuditData       `json:"auditData"`
	Classifications []Classification `json:"classifications"`
}

type ListCountriesInput

type ListCountriesInput struct {
	ListInput
}

type ListCountriesResp

type ListCountriesResp struct {
	Audit     *AuditData `json:"auditData"`
	Countries []Country  `json:"countries"`
}

type ListCurrenciesInput added in v0.2.0

type ListCurrenciesInput struct {
	ListInput
}

type ListCurrenciesResponse added in v0.2.0

type ListCurrenciesResponse struct {
	Audit      *AuditData `json:"auditData"`
	Currencies []Currency `json:"currencies"`
}

type ListDestinationsInput

type ListDestinationsInput struct {
	ListInput
}

type ListDestinationsResponse

type ListDestinationsResponse struct {
	Audit        *AuditData    `json:"auditData"`
	Destinations []Destination `json:"destinations"`
}

type ListFacilitiesInput added in v0.2.0

type ListFacilitiesInput struct {
	ListInput
}

type ListFacilitiesResponse added in v0.2.0

type ListFacilitiesResponse struct {
	Audit      *AuditData `json:"auditData"`
	Facilities []Facility `json:"facilities"`
}

type ListFacilityGroupsInput added in v0.2.0

type ListFacilityGroupsInput struct {
	ListInput
}

type ListFacilityGroupsResponse added in v0.2.0

type ListFacilityGroupsResponse struct {
	Audit  *AuditData      `json:"auditData"`
	Groups []FacilityGroup `json:"facilityGroups"`
}

type ListFacilityTypologiesInput added in v0.2.0

type ListFacilityTypologiesInput struct {
	ListInput
}

type ListFacilityTypologiesResponse added in v0.2.0

type ListFacilityTypologiesResponse struct {
	Audit      *AuditData         `json:"auditData"`
	Typologies []FacilityTypology `json:"facilityTypologies"`
}

type ListHotelsInput

type ListHotelsInput struct {
	// Filter for a specific hotel or list of hotels.
	Codes []int `url:"hotelCode"`
	// Filter to limit the results for an specific country.
	CountryCode string `url:"countryCode"`
	// Filter to limit the results for an specific destination.
	DestinationCode string `url:"destinationCode"`
	// Use "webOnly" to include in the response hotels sellable only to websites.
	// Use "notOnSale" to include in the response hotels without rates on sale.
	// By default non of them is included in the response.
	IncludeHotels IncludeHotels `url:"includeHotels"`
	// The list of fields to be received in the response. To retrieve all the fields use ‘all’.
	// If nothing is specified, all fields are returned. See the complete list of available fields in the response.
	Fields []string `url:"fields"`
	// The language code for the language in which you want the descriptions to be returned.
	// If language is not specified, English will be used as default language.
	Language string `url:"language"`
	// The number of the initial record to receive. If nothing is specified, 1 is the default value.
	From int `url:"from"`
	// The number of the final record to receive. If nothing is indicated, 100 is the default value.
	To int `url:"to"`
	// Defines if you want to receive the descriptions in English if the description
	// is not available in the language requested.
	UseSecondaryLanguage *bool `url:"useSecondaryLanguage"`
	// Specifying this parameter limits the results to those modified or added
	// after the date specified. The required format is YYYY-MM-DD.
	LastUpdateTime Datetime `url:"lastUpdateTime"`
	// Sending this parameter as true in the /hotels operations will only return
	// the hotels which possess at least one PMSRoomCode (useful when mapping against the original property codes).
	OnlyPMSRoomCode *bool `url:"PMSRoomCode"`
}

func (ListHotelsInput) Encode

func (inp ListHotelsInput) Encode(v url.Values) error

func (*ListHotelsInput) Validate

func (inp *ListHotelsInput) Validate() error

type ListHotelsResponse

type ListHotelsResponse struct {
	From   int        `json:"from"`
	To     int        `json:"to"`
	Total  int        `json:"total"`
	Audit  *AuditData `json:"auditData"`
	Hotels []Hotel    `json:"hotels"`
}

type ListImageTypesInput added in v0.2.0

type ListImageTypesInput struct {
	ListInput
}

type ListImageTypesResponse added in v0.2.0

type ListImageTypesResponse struct {
	Audit *AuditData  `json:"auditData"`
	Types []ImageType `json:"imageTypes"`
}

type ListInput added in v0.2.0

type ListInput struct {
	Fields               []string  `url:"fields,omitempty"`
	Codes                []string  `url:"codes,omitempty"`
	Language             string    `url:"language,omitempty"`
	From                 int       `url:"from"`
	To                   int       `url:"to"`
	UseSecondaryLanguage bool      `url:"useSecondaryLanguage"`
	LastUpdateTime       *Datetime `url:"lastUpdateTime,omitempty"`
}

type ListIssuesInput added in v0.2.0

type ListIssuesInput struct {
	ListInput
}

type ListIssuesResponse added in v0.2.0

type ListIssuesResponse struct {
	Audit  *AuditData `json:"auditData"`
	Issues []Issue    `json:"issues"`
}

type ListLanguagesInput added in v0.2.0

type ListLanguagesInput struct {
	ListInput
}

type ListLanguagesResponse added in v0.2.0

type ListLanguagesResponse struct {
	Audit     *AuditData `json:"auditData"`
	Languages []Language `json:"languages"`
}

type ListPromotionsInput added in v0.2.0

type ListPromotionsInput struct {
	ListInput
}

type ListPromotionsResponse added in v0.2.0

type ListPromotionsResponse struct {
	Audit      *AuditData  `json:"auditData"`
	Promotions []Promotion `json:"promotions"`
}

type ListRateCommentsInput added in v0.2.0

type ListRateCommentsInput struct {
	ListInput
}

type ListRateCommentsResponse added in v0.2.0

type ListRateCommentsResponse struct {
	Audit        *AuditData    `json:"auditData"`
	RateComments []RateComment `json:"rateComments"`
}

type ListRoomsInput added in v0.2.0

type ListRoomsInput struct {
	Codes []string `json:"codes"`
	ListInput
}

type ListRoomsResponse added in v0.2.0

type ListRoomsResponse struct {
	Audit *AuditData `json:"auditData"`
	Rooms []Room     `json:"rooms"`
}

type ListSegmentsInput added in v0.2.0

type ListSegmentsInput struct {
	ListInput
}

type ListSegmentsResponse added in v0.2.0

type ListSegmentsResponse struct {
	Audit    *AuditData `json:"auditData"`
	Segments []Segment  `json:"segments"`
}

type ListTerminalsInput added in v0.2.0

type ListTerminalsInput struct {
	ListInput
}

type ListTerminalsResponse added in v0.2.0

type ListTerminalsResponse struct {
	Audit     *AuditData `json:"auditData"`
	Terminals []Terminal `json:"terminals"`
}

type Mode added in v0.2.0

type Mode string
const (
	ModeUpdate       Mode = "UPDATE"
	ModeCancellation Mode = "CANCELLATION"
	ModeSimulation   Mode = "SIMULATION"
)

func (Mode) String added in v0.2.0

func (m Mode) String() string

type ModificationPolicy

type ModificationPolicy struct {
	IsCancellationAllowed bool `json:"cancellation"`
	IsModificationAllowed bool `json:"modification"`
}

type Occupancy

type Occupancy struct {
	Rooms    int `json:"rooms"`
	Adults   int `json:"adults"`
	Children int `json:"children"`
	// Use Paxes only when has children.
	Paxes []Pax `json:"paxes,omitempty"`
}

type Offer

type Offer struct {
	Code   string `json:"code"`
	Name   string `json:"name"`
	Amount Amount `json:"amount"`
}

type Option

type Option func(*Options)

func WithHeaders

func WithHeaders(set http.Header) Option

func WithRateLimit

func WithRateLimit(limit int, burst int, per time.Duration) Option

func WithRetry

func WithRetry(maxAttempts int, minWaitTime, maxWaitTime time.Duration, f clientx.RetryFunc, conditions ...clientx.RetryCond) Option

type Options

type Options struct {
	DefaultHeaders http.Header
	Limit          *clientx.OptionRateLimit
	Retry          *clientx.OptionRetry
}

type Order

type Order int

func (*Order) UnmarshalJSON

func (o *Order) UnmarshalJSON(data []byte) error

type Pax

type Pax struct {
	Type    PaxType `json:"type"`
	Age     int     `json:"age"`
	Name    string  `json:"name,omitempty"`
	Surname string  `json:"surname,omitempty"`
	RoomID  int     `json:"roomId,omitempty"`
}

type PaxType

type PaxType string
const (
	PaxTypeAdult    PaxType = "AD"
	PaxTypeChildren PaxType = "CH"
)

func (PaxType) String added in v0.2.0

func (p PaxType) String() string

type PaymentCard added in v0.2.0

type PaymentCard struct {
	Type   string `json:"cardType"`
	Number string `json:"cardNumber"`
	Expiry string `json:"expiryDate"`
	CVC    string `json:"cardCVC"`
}

type PaymentData added in v0.2.0

type PaymentData struct {
	Card       PaymentCard     `json:"paymentCard"`
	Contact    ContactData     `json:"contactData"`
	Billing    *BillingAddress `json:"billingAddress"`
	ThreeDS    *ThreeDSData    `json:"threeDsData"`
	WebPartner int             `json:"webPartner,omitempty"`
	Device     *Device         `json:"device"`
}

type PaymentType

type PaymentType string
const (
	PaymentTypeAtWeb   PaymentType = "AT_WEB"
	PaymentTypeAtHotel PaymentType = "AT_HOTEL"
)

func (PaymentType) String added in v0.2.0

func (p PaymentType) String() string

type Phone

type Phone struct {
	Number string    `json:"phoneNumber"`
	Type   PhoneType `json:"phoneType"`
}

type PhoneType

type PhoneType string
const (
	PhoneTypeHotel      PhoneType = "PHONEHOTEL"
	PhoneTypeBooking    PhoneType = "PHONEBOOKING"
	PhoneTypeFax        PhoneType = "FAXNUMBER"
	PhoneTypeManagement PhoneType = "PHONEMANAGEMENT"
)

type ProcessTime

type ProcessTime time.Duration

func (*ProcessTime) UnmarshalJSON

func (t *ProcessTime) UnmarshalJSON(data []byte) error

type Promotion added in v0.2.0

type Promotion struct {
	Code        string  `json:"code"`
	Name        Content `json:"name"`
	Description Content `json:"description"`
}

type Radius

type Radius int

func (Radius) Int

func (r Radius) Int() int

func (Radius) MarshalJSON

func (r Radius) MarshalJSON() ([]byte, error)

type Rate

type Rate struct {
	RateKey              string               `json:"rateKey"`
	RateClass            string               `json:"rateClass"`
	RateType             string               `json:"rateType"`
	Net                  Amount               `json:"net"`
	Selling              Amount               `json:"sellingRate"`
	Allotment            int                  `json:"allotment"`
	RateCommentdsID      string               `json:"rateCommentsId,omitempty"`
	PaymentType          PaymentType          `json:"paymentType"`
	Packaging            bool                 `json:"packaging"`
	BoardCode            string               `json:"boardCode"`
	BoardName            string               `json:"boardName"`
	CancellationPolicies []CancellationPolicy `json:"cancellationPolicies"`
	Rooms                int                  `json:"rooms"`
	Adults               int                  `json:"adults"`
	Children             int                  `json:"children"`
	Offers               []Offer              `json:"offers,omitempty"`
}

type RateComment added in v0.2.0

type RateComment struct {
	// Code of the incoming office of the hotel.
	Incoming     int               `json:"incoming"`
	Code         string            `json:"code"`
	HotelCode    int               `json:"hotel"`
	RateComments []RateCommentItem `json:"rateComments"`
}

type RateCommentComment added in v0.2.0

type RateCommentComment struct {
	Start       Datetime `json:"dateStart"`
	End         Datetime `json:"dateEnd"`
	Description string   `json:"description"`
}

type RateCommentItem added in v0.2.0

type RateCommentItem struct {
	Codes    []int                `json:"rateCodes"`
	Comments []RateCommentComment `json:"comments"`
}

type Review added in v0.2.0

type Review struct {
	Rate  string `json:"rate"`
	Count int    `json:"reviewCount"`
	Type  string `json:"type"`
}

type Room added in v0.2.0

type Room struct {
	Code                      string  `json:"code"`
	Type                      string  `json:"type"`
	TypeDescription           Content `json:"typeDescription"`
	Characteristic            string  `json:"characteristic"`
	CharacteristicDescription Content `json:"characteristicDescription"`
	Description               string  `json:"description"`
	MinPax                    int     `json:"minPax"`
	MaxPax                    int     `json:"maxPax"`
	MinAdults                 int     `json:"minAdults"`
	MaxAdults                 int     `json:"maxAdults"`
	MinChildren               int     `json:"minChildren"`
	MaxChildren               int     `json:"maxChildren"`
}

type Segment added in v0.2.0

type Segment struct {
	Code        int     `json:"code"`
	Description Content `json:"description"`
}

type ShiftRate

type ShiftRate struct {
	RateKey   string   `json:"rateKey"`
	RateClass string   `json:"rateClass"`
	RateType  string   `json:"rateType"`
	Net       Amount   `json:"net"`
	Selling   Amount   `json:"sellingRate"`
	Allotment int      `json:"allotment"`
	CheckIn   Datetime `json:"checkIn"`
	CheckOut  Datetime `json:"checkOut"`
}

type SimpleCode added in v0.2.0

type SimpleCode int
const (
	SimpleCode1Star SimpleCode = iota + 1
	SimpleCode2Stars
	SimpleCode3Stars
	SimpleCode4Stars
	SimpleCode5Stars
)

func (SimpleCode) Int added in v0.2.0

func (sc SimpleCode) Int() int

type State

type State struct {
	Code        string `json:"code"`
	Description string `json:"description"`
	Name        string `json:"name"`
	ZoneCode    int    `json:"zoneCode"`
}

type Stay

type Stay struct {
	CheckIn  string `json:"checkIn"`
	CheckOut string `json:"checkOut"`
	// Amount of days after and before the check-in to check availability, keeping the same stay duration.
	ShiftDays int `json:"shiftDays,omitempty"`
	// Defines if results are returned for shiftDays even if there's no results for the searched dates.
	AllowOnlyShift *bool `json:"allowOnlyShift,omitempty"`
}

func (*Stay) Validate

func (stay *Stay) Validate() error

type Supplier added in v0.2.0

type Supplier struct {
	Name      string `json:"name"`
	VATNumber string `json:"vatNumber"`
}

type Tax

type Tax struct {
	Included       bool   `json:"included"`
	Amount         Amount `json:"amount"`
	Currency       string `json:"currency"`
	ClientAmount   Amount `json:"clientAmount"`
	ClientCurrency string `json:"clientCurrency"`
}

type Terminal

type Terminal struct {
	Code        string  `json:"code"`
	Type        string  `json:"type"`
	Country     string  `json:"country"`
	Description Content `json:"description"`
	Name        Content `json:"name"`
}

type ThreeDSData added in v0.2.0

type ThreeDSData struct {
	// Enum: "PROVIDED" "REQUESTED"
	// Use PROVIDED if you have your own integration with a PSP
	Option string `json:"option"`
	// This field contains the 3DS version used for authentication
	Version      string                  `json:"version"`
	InfoProvided ThreeDSDataInfoProvided `json:"infoProvided"`
}

type ThreeDSDataInfoProvided added in v0.2.0

type ThreeDSDataInfoProvided struct {
	// Transaction identifier resulting from authentication processing.
	ID string `json:"id"`
	// Cardholder Authentication Verification Value (CAVV)
	CAVV string `json:"cavv"`
	// Electronic Commerce Indicator (ECI). The ECI value is part of the two data elements
	// that indicate the transaction was processed electronically.
	ECI string `json:"eci"`
}

type Timestamp

type Timestamp time.Time

Timestamp is time with "2006-01-02 15:04:05.000" layout.

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

type TimestampTZ

type TimestampTZ time.Time

TimestampTZ is time with "2006-01-02T15:04:05Z07:00" layout.

func (TimestampTZ) MarshalJSON

func (t TimestampTZ) MarshalJSON() ([]byte, error)

func (*TimestampTZ) UnmarshalJSON

func (t *TimestampTZ) UnmarshalJSON(data []byte) error

type Unit

type Unit string
const (
	UnitMiles      Unit = "mi"
	UnitKilometers Unit = "km"
)

func (Unit) String

func (u Unit) String() string

type UpsellingRate added in v0.2.0

type UpsellingRate struct {
	Rate
	Discount         string      `json:"discount"`
	DiscountPercent  string      `json:"discountPCT"`
	HotelMandatory   bool        `json:"hotelMandatory"`
	Comission        Amount      `json:"comission"`
	ComissionVAT     string      `json:"comissionVAT"`
	ComissionPercent string      `json:"comissionPCT"`
	Rateup           Amount      `json:"rateup"`
	Brand            string      `json:"brand"`
	Taxes            []Tax       `json:"taxes"`
	DailyRates       []DailyRate `json:"dailyRates"`
}

type ValidationError

type ValidationError struct {
	Required  bool
	FieldName string
	Min       int
	Max       int
	Allow     []string
}

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Voucher added in v0.2.0

type Voucher struct {
	Language string `json:"language,omitempty"`
	Email    Email  `json:"email"`
	// Accepted formats: PNG, JPG, GIF & BMP. Max size: 100px x 100px.
	// The filename part of the picture path cannot exceed 35 characters length.
	Logo string `json:"logo"`
}

type Zone

type Zone struct {
	Code        int     `json:"zoneCode"`
	Name        string  `json:"name"`
	Description Content `json:"description"`
}

Jump to

Keyboard shortcuts

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