Code Monkey home page Code Monkey logo

booking-com-sdk's Introduction

Booking.com SDK

The library is in active development. Not ready for production yet.

This library is just simple wrapper around booking com API (https://developers.booking.com/api/).

Table of Contents

Installation

composer require digitalbrands/booking-com-sdk

Usage

Initialization

$client = Client::create([
    'login' => 'your_login',
    'password' => 'your_password',
    'timeout' => 5, // Optional
    'v' => '2.2' // Optional
]);

blockAvailability

Not implemented yet

hotelAvailability

Not implemented yet

autocomplete

$models = $client->autocomplete(new AutocompleteQuery('test'));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

chainTypes

$models = $client->getChainTypes((new ChainTypesQuery());

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

changedHotels

$sinceDate=new \DateTime();
$model = $client->getChangedHotelsInfo(new ChangedHotelsQuery($sinceDate));

//Closed hotels
$model->getClosedHotels();

//Changed hotels
$model->getChangedHotels();

cities

$models = $client->getCities((new CitiesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

countries

$models = $client->getCountries((new CountriesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

districts

$models = $client->getDistricts((new DistrictsQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

facilityTypes

$models = $client->getFacilityTypes((new FacilityTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

hotelFacilityTypes

$models = $client->getHotelFacilityTypes((new HotelFacilityTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

hotels

$models = $client->getHotels((new HotelsQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getInfo();
    // etc
}

hotelThemeTypes

$models = $client->getHotelThemeTypes((new HotelThemeTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

hotelTypes

$models = $client->getHotelTypes((new HotelTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

paymentTypes

$models = $client->getPaymentTypes((new PaymentTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

regions

$models = $client->getRegions((new RegionsQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

roomFacilityTypes

$models = $client->getRoomFacilityTypes((new RoomFacilityTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

roomTypes

$models = $client->getRoomTypes((new RoomTypesQuery()));

foreach ($models as $model){
    print $model->getId();
    print $model->getName();
    // etc
}

Support

Please open an issue for support.

Contributing

Feel free to send a pull request!

booking-com-sdk's People

Contributors

aivchen avatar slava-petrov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

booking-com-sdk's Issues

Problem while parsing description

Hello, how are you?

There's a problem parsing the hotel description.
hotelier_welcome_message isn't always present on the response.

For this reason, the description of the hotel isn't parsed.

I'm not 100% sure, but I think that hotel_description is always present when you you pass it in extra parameter.

So I think that a possible solution is change this:

$description = isset($hotelData['hotelier_welcome_message']) ? Description::fromArray($hotelData) : null;

for this:

$description = isset($hotelData['hotel_description']) ? Description::fromArray($hotelData) : null;

On the other hand, fromArray method of Description class must verify that the fields are present in the array.

    public static function fromArray(array $array): self
    {
        return new self(
            $array['hotelier_welcome_message'] ?? '',
            $array['hotel_important_information'] ?? '',
            $array['hotel_description'] ?? '',
            $array['license_number'] ?? ''
        );
    }

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.