Skip to main content

C# SDK

Install

dotnet add package Bundleport.Connect.Hotels.Client
dotnet add package Google.Protobuf

The package exposes the typed IntegrationClient plus ASP.NET Core helpers in ServiceCollectionExtensions.

Initialize the client

Direct instantiation

using Bundleport.Connect.Hotels.Client;

var options = new IntegrationClientOptions
{
Timeout = TimeSpan.FromSeconds(5),
Debug = false // Set to true for JSON payloads
};
options.Headers["Authorization"] = "ApiKey <your-bundleport-key>";

var client = new IntegrationClient("https://api.connect.bundleport.com", options: options);

Dependency injection (ASP.NET Core)

using Bundleport.Connect.Hotels.Client;

var builder = WebApplication.CreateBuilder(args);

builder.Services.AddIntegrationClient(
"https://api.connect.bundleport.com",
options =>
{
options.Timeout = TimeSpan.FromSeconds(5);
options.Debug = false; // Set to true for JSON payloads
options.Headers["Authorization"] = "ApiKey <your-bundleport-key>";
});

Inject IntegrationClient wherever you need to perform requests:

public class SearchController : ControllerBase
{
private readonly IntegrationClient _client;

public SearchController(IntegrationClient client) => _client = client;

[HttpPost("/search")]
public async Task<IActionResult> Search([FromBody] SearchRequest request)
{
var response = await _client.SearchAsync(request);
return Ok(response);
}
}

Service calls

All RPC methods return Task<TResponse> and accept a request object.

using Bundleport.Connect.Hotels.Client;
using Bundleport.Connect.Hotels;

var serviceOptions = new IntegrationClientOptions
{
Timeout = TimeSpan.FromSeconds(5),
Debug = false,
};
serviceOptions.Headers["Authorization"] = "ApiKey <your-bundleport-key>";

var client = new IntegrationClient(
"https://api.connect.bundleport.com",
options: serviceOptions);

// Search for hotels
var searchResponse = await client.SearchAsync(new SearchRequest
{
Stay = new Stay
{
CheckIn = "2025-02-10",
CheckOut = "2025-02-12"
},
Occupancies = { new Occupancy { Paxes = { new Pax { Age = 30 } } } },
Settings = new SettingsInput
{
AccessIds = { "YOUR_ACCESS_ID" }
}
});

// Get a quote
var quoteResponse = await client.QuoteAsync(new QuoteRequest
{
OptionRefId = searchResponse.Options[0].OptionRefId,
Settings = new SettingsInput
{
AccessIds = { "YOUR_ACCESS_ID" }
}
});

// Book the hotel
var bookingResponse = await client.BookAsync(new BookRequest
{
OptionRefId = quoteResponse.OptionQuote.OptionRefId,
Holder = new HolderInput
{
Name = "Alice",
Surname = "Doe"
},
Settings = new SettingsInput
{
AccessIds = { "YOUR_ACCESS_ID" }
}
});

// Cancel a booking
var cancelResponse = await client.CancelAsync(new CancelRequest
{
BookingReference = bookingResponse.Booking.Reference.BookingId,
Settings = new SettingsInput
{
AccessIds = { "YOUR_ACCESS_ID" }
}
});

// Get booking details
var detailResponse = await client.BookingDetailAsync(new BookingDetailRequest
{
BookingReference = bookingResponse.Booking.Reference.BookingId,
Settings = new SettingsInput
{
AccessIds = { "YOUR_ACCESS_ID" }
}
});

// List bookings
var listResponse = await client.BookingListAsync(new BookingListRequest
{
Filters = new BookingListFilters { PageSize = 50 },
Settings = new SettingsInput
{
AccessIds = { "YOUR_ACCESS_ID" }
}
});

Other helper methods map 1:1 to the Integration RPC surface:

  • GetBoardsAsync
  • GetCategoriesAsync
  • GetHotelsAsync
  • GetRoomsAsync
  • GetDestinationsAsync
  • GetMetadataAsync
  • SearchDestinationsAsync

Refer to the REST API reference for payload schemas.