Skip to main content

BookingClient C# SDK 1.0.0

Welcome to the BookingClient SDK documentation. This guide will help you get started with integrating and using the BookingClient SDK in your project.

Versions

  • API version: 1.0
  • SDK version: 1.0.0

About the API

Partner Connect API Service

Table of Contents

Setup & Configuration

Supported Language Versions

This SDK is compatible with the following versions: C# >= .NET 6

Installation

To get started with the SDK, we recommend installing using nuget:

dotnet add package BookingClient

Authentication

Access Token Authentication

The BookingClient API uses an Access Token for authentication.

This token must be provided to authenticate your requests to the API.

Setting the Access Token

When you initialize the SDK, you can set the access token as follows:

using BookingClient;
using BookingClient.Config;

var config = new BookingClientConfig()
{
AccessToken = "YOUR_ACCESS_TOKEN"
};

var client = new BookingClientClient(config);

If you need to set or update the access token after initializing the SDK, you can use:

client.SetAccessToken("YOUR_ACCESS_TOKEN")

API Key Authentication

The BookingClient API uses API keys as a form of authentication. An API key is a unique identifier used to authenticate a user, developer, or a program that is calling the API.

Setting the API key

When you initialize the SDK, you can set the API key as follows:

using BookingClient;
using BookingClient.Config;

var config = new BookingClientConfig()
{
ApiKeyAuth = new ApiKeyAuthConfig("YOUR_API_KEY")
};

var client = new BookingClientClient(config);

If you need to set or update the API key after initializing the SDK, you can use:

client.SetApiKey("YOUR_API_KEY")

Sample Usage

Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:

using BookingClient;
using BookingClient.Config;
using BookingClient.Models;
using Environment = BookingClient.Http.Environment;

var apiKeyConfig = new ApiKeyAuthConfig("YOUR_API_KEY");

var config = new BookingClientConfig
{
Environment = Environment.Default,
AccessToken = "YOUR_ACCESS_TOKEN",
ApiKeyAuth = apiKeyConfig
};

var client = new BookingClientClient(config);

var booker = new BookerInputDto("gt", BookerInputDto.Platform.Android);
var guests = new GuestsInputDto(5, 0);
var input = new SearchInputDto("checkin", "checkout", booker, guests);

var response = await client.DemandApiV3Compatible.SearchAsync(input, SearchAccept.ApplicationJson);

Console.WriteLine(response);

Services

The SDK provides various services to interact with the API.

Below is a list of all available services with links to their detailed documentation:

Models

The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.

Below is a list of all available models with links to their detailed documentation:
NameDescription
SearchInputDto
ResponseOutputListSearchOutputDto
SearchAccept
DetailsInputDto
ResponseOutputListDetailsOutputDto
PostDetailsAccept
ConstantInputDto
ResponseOutputConstantsOutputDto
GetAccommodationConstantsAccept
ResponseOutputV2ReviewScoresOutputDto
ReviewScoresInputDto
GetHotelsReviewScoresAccept
ResponseOutputV2HotelsOutputDto
HotelsInputDto
GetHotelsAccept
ResponseOutputV2HotelTypesOutputDto
HotelTypeInputDto
GetHotelTypesAccept
ResponseOutputV2HotelThemeTypesOutputDto
HotelThemeTypeInputDto
GetHotelThemeTypesAccept
ResponseOutputV2HotelFacilityTypeOutputDto
HotelFacilityInputDto
GetRoomFacilityTypesAccept
ResponseOutputV2HotelAvailabilityOutputDto
HotelAvailabilityInputDto
GetHotelAvailabilityAccept
ResponseOutputV2BlockAvailabilityOutputDto
BlockAvailabilityInputDto
GetBlockAvailabilityAccept
BookerInputDtoThe booker's information.
GuestsInputDtoThe guest details for the request.
CoordinatesLimit the result list to the specified coordinates.
AllocationInputDtoThe exact allocation of guests to rooms.
SearchOutputDto
PriceDataDtoDoubleThe price components of this product or selection of products. 'base' and 'extra_charges' are returned only when explicitly requested (via 'extras=extra_charges').
ProductDto
ExtraChargesDtoDoubleThe charge breakdown. Includes taxes and fees.
PoliciesDtoThe policies for this product.
PriceDataDtoListChargeDtoThe price components of this product or selection of products. 'base' and 'extra_charges' are returned only when explicitly requested (via 'extras=extra_charges').
DealDtoThis specifies the deal tagging for the product.
CancellationDtoThe cancellation policy for this product.
MealPlanDtoThe meal plan policy for this product.
PaymentDtoPayment terms and conditions for this product.
ExtraChargesDtoListChargeDtoThe charge breakdown. Includes taxes and fees.
ChargeDto
DetailsOutputDto
TranslatedStringTranslated description of this room. The maximum number of characters returned may be limited by contract.
CheckinCheckoutTimesDto
ContactsDtoContact information of the accommodation.
FacilityDtoThe list of facilities available in this property. Requires {"extras":["facilities"]}.
DescriptionDtoTextual information about the accommodation. Requires {"extras":["description"]}.
KeyCollectionInformationDto
LocationDtoAll location related information of this accommodation property.
PhotoDto
ProgramSettingsDtoDetails of programmes undergone by the property.
RatingDto
RoomDtoThe list of room types available at this property. Requires {"extras":["rooms"]}.
LocalTimeThe time till when checkout can be done at this property.
ContactDtoContact information of the accommodation. It can be null if the data is missing.
TranslationInformationText containing important information about the property. The value is translated in the requested languages.
TruncatedStringThe translated description text of this accommodation property in the requested languages. The maximum number of characters returned may be limited by contract.
AlternativeKeyLocationDtoAlternate location to collect the key of this accommodation property. This is returned if the key to access the property is in another location.
LazyTranslatedStringTranslated accommodation address.
CoordinatesDtoA signed integer number that uniquely identifies a city.
PhotoUrlDto
BedOptionDtoLists all possible bedding options for this room or apartment.
CribsAndExtraBedsDtoLists room options regarding adding cribs and/or extra beds.
RoomMaximumOccupancyDtoOccupancy limits and options.
NumberOfRoomsDtoTotal rooms available.
BedConfigurationDtoLists all alternative bed configurations that are supported.
BedDtoDetail list of all different types and number of beds included in this configuration.
Meta
ReviewScoresOutputDto
ScoreBreakdownA breakdown of scores per reviewer type and review question.
ScoreDistributionA breakdown of all review scores into buckets 1 - 10.
QuestionDtoReview scores per question.
HotelsOutputDto
HotelDataDtoHotel specific information.
RoomDataDtoThis block has room data for this hotel.
HotelPhotoDtoPhotos specific information of the hotel.
RoomInfoDto
BedroomDto
RoomOccupancyDto
RoomSizeDto
HotelTypesOutputDto
TranslationDto
HotelThemeTypesOutputDto
HotelFacilityTypeOutputDto
HotelAvailabilityOutputDto
BlockAvailabilityOutputDto
BlockOutputDtoThe object containing all the relevant information for the combination of room, policy, meal and occupancy that determines the price." A block is the unique entity you book with booking.com.

License

This SDK is licensed under the MIT License.

See the LICENSE file for more details.

Build Your Own SDKs with  liblab

Build developer friendly SDKs in minutes from your APIs

Start for Free →