Skip to content

BTU.js is a Javascript library for interacting with the BTU Protocol. Using it, you can easily make calls to the BTU smart contracts and API to build a booking app or dapp. Functionality includes searching and booking 2M hotels OR activities and booking them live! With BTU.js, every developer can become a booking company and earn $BTU tokens

Notifications You must be signed in to change notification settings

btuprotocol/BTU.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BTU.JS

BTU.JS is a javascript library that interacts with BTU Protocol. It allows any developer to build a booking application or a widget.

Getting started

Install BTU.JS

npm install btujs --save

Instantiate BTU.JS

const btujs = require('btujs');

const myBtujs = new btujs();

Components

Dappbar

Documentation for this project

Resources methods

searchResources()

Search for resources regardless of their availabilities.

Prototype

  myBtujs.resources.searchResources(String resourceType, Object body, Function callback)

Usage


getResource()

Query resource by its ID to get its details.

Prototype

  myBtujs.resources.getResource(String resourceType, String resourceId, Object body, Function callback)

Usage


getResourceItem()

Query resource by its ID and its sub-item ID to get sub-item details.

Prototype

  myBtujs.resource.getResourceItem(String resourceType, String resourceId, String itemId, Object body, Function callback)

Usage


Availabilities methods

searchAvailableResources()

Search for availables resources only.

Prototype

  myBtujs.availabilities.searchAvailableResources(String resourceType, Object body, Function callback)

Usage


getResourceAvailabilities()

Query a resource by its ID and get its availabilities.

Prototype

  myBtujs.availabilities.getResourceAvailabilities(String resourceType, String resourceId, Object body, Function callback)

isResourceAvailable()

Check if a resource is available under different conditions.

Prototype

  myBtujs.availabilities.isResourceAvailable(String resourceType, String resourceId, Object body, Function callback)

Usage

Response

  {
    isAvailable: true // or false
  }

bookResource()

Book a resource availability.

Prototype

  myBtujs.availabilities.bookResource(String resourceType, String resourceId, Object body, Function callback)

Usage


getBookingDetails()

Get informations about a booking you made.

Prototype

  myBtujs.availabilities.getBookingDetails(String resourceType, String bookingId, Object body, Function callback)

Usage


cancelBooking()

Cancel a reservation you booked through the bookResource method.

Prototype

  myBtujs.availabilities.cancelBooking(String resourceType, String bookingId, Object body, Function callback)

Usage

About

BTU.js is a Javascript library for interacting with the BTU Protocol. Using it, you can easily make calls to the BTU smart contracts and API to build a booking app or dapp. Functionality includes searching and booking 2M hotels OR activities and booking them live! With BTU.js, every developer can become a booking company and earn $BTU tokens

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published