Giter Site home page Giter Site logo

hotelbeds-go's Introduction

HotelBeds client written in Go

Go Tests

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/[email protected] # 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.

hotelbeds-go's People

Contributors

0x9ef avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.