metglobal / hotelspro-java-client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

swagger-java-client

Requirements

Building the API client library requires Maven to be installed.

Installation

To install the API client library to your local Maven repository, simply execute:

mvn install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn deploy

Refer to the official documentation for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>io.swagger</groupId>
    <artifactId>swagger-java-client</artifactId>
    <version>1.0.0</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "io.swagger:swagger-java-client:1.0.0"

Others

At first generate the JAR by executing:

mvn package

Then manually install the following JARs:

  • target/swagger-java-client-1.0.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import hotelspro_client.*;
import hotelspro_client.auth.*;
import hotelspro_client.model.*;
import hotelspro_client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure HTTP basic authorization: basicAuth
        HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
        basicAuth.setUsername("YOUR USERNAME");
        basicAuth.setPassword("YOUR PASSWORD");

        DefaultApi apiInstance = new DefaultApi();
        String productCode = "productCode_example"; // String | product code that returned in Search(or Hotel Availability) Response
        try {
            AvailabilityResponse result = apiInstance.availabilityProductCodeGet(productCode);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#availabilityProductCodeGet");
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://localhost/api/v2

Class Method HTTP request Description
DefaultApi availabilityProductCodeGet GET /availability/{product_code} Availability with Product Code
DefaultApi bookProvisionCodePost POST /book/{provision_code} Book with Provision Code
DefaultApi bookingsBookingCodeGet GET /bookings/{booking_code} Get Booking Detail
DefaultApi bookingsGet GET /bookings/ Get Booking List
DefaultApi cancelBookingCodePost POST /cancel/{booking_code} Cancel Booking with Booking Code
DefaultApi hotelAvailabilityGet GET /hotel-availability/ Hotel Availability with Hotel Code and Search Code
DefaultApi provisionProductCodePost POST /provision/{product_code} Provision with Product Code
DefaultApi searchPost POST /search/ Search with Hotel Code(Hotel Code List) or Destination Code or Geolocation

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

basicAuth

  • Type: HTTP basic authentication

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author

clientintegration@hotelspro.com

About


Languages

Language:Java 99.0%Language:Shell 0.7%Language:Scala 0.3%