konfig/nuitee-lite-php-sdk

**Lite API** 可以用于以下操作:获取一组酒店的房间价格和可用性;选择具有房间可用性的特定酒店并进行预订;管理预订 - 检索和取消现有预订;获取酒店的静态内容,按目的地搜索酒店。

v1.8.0 2023-04-27 16:57 UTC

This package is auto-updated.

Last update: 2024-08-27 19:48:12 UTC


README

**Lite API** 可以用于以下操作:

获取一组酒店的房间价格和可用性;选择具有房间可用性的特定酒店并进行预订;管理预订 - 检索和取消现有预订;获取酒店的静态内容,按目的地搜索酒店。

安装和用法

要求

此库需要 PHP ^8.0

Composer

要使用 Composer 安装绑定,请将以下内容添加到 composer.json

{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/konfig-dev/nuitee-lite-php-sdk.git"
    }
  ],
  "require": {
    "konfig/nuitee-lite-php-sdk": "1.8.0"
  }
}

然后运行 composer install

手动安装

下载文件并包含 autoload.php

<?php
require_once('/path/to/nuitee-lite-php-sdk/vendor/autoload.php');

入门指南

请按照 安装程序 进行操作,然后运行以下命令

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure API key authorization: apikeyAuth
$config = Nuitee\Configuration::getDefaultConfiguration()->setApiKey('X-API-Key', 'YOUR_API_KEY');
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// $config = Nuitee\Configuration::getDefaultConfiguration()->setApiKeyPrefix('X-API-Key', 'Bearer');

// Setting host path is optional and defaults to https://api.liteapi.travel/v1.0
// Nuitee\Configuration::getDefaultConfiguration()->setHost("https://api.liteapi.travel/v1.0");

$apiInstance = new Nuitee\Api\BookApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    // new GuzzleHttp\Client(),
    $config
);

$book_request = new \Nuitee\Model\BookRequest([
        "prebook_id" => "prebook_id_example",
    ]);

try {
    $result = $apiInstance->book(
        book_request: $book_request
    );
    print_r($result->$getData());
    print_r($result->$getGuestLevel());
    print_r($result->$getSandbox());
} catch (\Exception $e) {
    echo 'Exception when calling BookApi->book: ', $e->getMessage(), PHP_EOL;
}

API 端点

所有 URI 都相对于 https://api.liteapi.travel/v1.0

模型

授权

apikeyAuth

  • 类型: API密钥
  • API密钥参数名称: X-API-Key
  • 位置: HTTP头

测试

运行测试,使用

composer install
vendor/bin/phpunit

关于此包

此PHP包由Konfig自动生成

  • API版本: 1.0.0
    • 包版本: 1.8.0