Go SDK
The Go module wraps the Integration service using connect-go.
Install
go get github.com/bundleport/connect-hotels-go-client/client
go get github.com/bundleport/connect-hotels-go/hotels
Initialize the client
package main
import (
"context"
"log"
"time"
"github.com/bundleport/connect-hotels-go-client/client"
)
func main() {
cfg := &client.Config{
Timeout: 5 * time.Second,
Debug: false, // Switch to true for JSON payloads
ExtraHeaders: map[string]string{
"Authorization": "ApiKey <your-bundleport-key>",
},
}
hotelsClient := client.NewHotelsClient("https://api.connect.bundleport.com", cfg)
// Use the client...
}
Service calls
Each RPC has a dedicated typed helper. The most common flow:
import (
"context"
"log"
"github.com/bundleport/connect-hotels-go-client/client"
hotels "github.com/bundleport/connect-hotels-go/hotels"
)
func run(ctx context.Context, c *client.HotelsClient) error {
// Search for hotels
searchResp, err := c.Search(ctx, &hotels.SearchRequest{
Stay: &hotels.Stay{
CheckIn: "2025-02-10",
CheckOut: "2025-02-12",
},
Occupancies: []*hotels.Occupancy{
{Paxes: []*hotels.Pax{{Age: 30}}},
},
Settings: &hotels.SettingsInput{
AccessIds: []string{"YOUR_ACCESS_ID"},
},
})
if err != nil {
return err
}
// Get a quote
quoteResp, err := c.Quote(ctx, &hotels.QuoteRequest{
OptionRefId: searchResp.GetOptions()[0].GetOptionRefId(),
Settings: &hotels.SettingsInput{
AccessIds: []string{"YOUR_ACCESS_ID"},
},
})
if err != nil {
return err
}
// Book the hotel
bookResp, err := c.Book(ctx, &hotels.BookRequest{
OptionRefId: quoteResp.GetOptionQuote().GetOptionRefId(),
Holder: &hotels.HolderInput{
Name: "Alice",
Surname: "Doe",
},
Settings: &hotels.SettingsInput{
AccessIds: []string{"YOUR_ACCESS_ID"},
},
})
if err != nil {
return err
}
// Cancel a booking
if _, err := c.Cancel(ctx, &hotels.CancelRequest{
BookingReference: bookResp.GetBooking().GetReference().GetBookingId(),
Settings: &hotels.SettingsInput{
AccessIds: []string{"YOUR_ACCESS_ID"},
},
}); err != nil {
return err
}
// Get booking details
_, _ = c.BookingDetail(ctx, &hotels.BookingDetailRequest{
BookingReference: bookResp.GetBooking().GetReference().GetBookingId(),
Settings: &hotels.SettingsInput{
AccessIds: []string{"YOUR_ACCESS_ID"},
},
})
// List bookings
_, _ = c.BookingList(ctx, &hotels.BookingListRequest{
Filters: &hotels.BookingListFilters{PageSize: 100},
Settings: &hotels.SettingsInput{
AccessIds: []string{"YOUR_ACCESS_ID"},
},
})
return nil
}
Other helpers
The client also exposes:
GetBoardsGetCategoriesGetHotelsGetRoomsGetDestinationsGetMetadataSearchDestinations
See the REST API reference for request/response schemas.