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.
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/[email protected] # version
See examples/ folder or _test.go
files.
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.
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 articles to stay tuned:
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
}
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
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.