1.0.3 • Published 1 year ago

hostaway-wrapper v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

hostaway-wrapper

Hostaway.com simple api wrapper library for Node.js

Install

npm install hostaway-wrapper

Usage

In your project, initialise a new instance of the hostaway-wrapper and provide Your Hostaway account ID and Client’s secret (can be obtained in your Hostaway dashboard.

import HostAway from 'hostaway-wrapper';

const hass = new HostAway({
  client_id: <Your-Hostaway-account-ID>,
  client_secret: <Clients-Secret>
});

Before calling any functions it is necessary to call auth function:

hass.auth().then(function(){
	// call everything you need inside here

      hass.listings.get_listings().then(function(data) {
         console.log(data);
      })

});

Interface

Implemented API methods

Listings

https://api.hostaway.com/documentation?shell#listings

// Example

      hass.listings.get_listings().then(function(data) {
         console.log(data);
      })

Reservations

https://api.hostaway.com/documentation?shell#reservations

// Example

      hass.reservations.get_reservation(52662251).then(function(data) {
         console.log(data);
      })
reservations - get_reservations() output.
status - is an array of statuses to GET as logical 'OR' (||).
Example:
status=[new,modified,cancelled] // new||modified||cancelled
Will return resewrvations with status new OR modified OR cancelled

Calendar

https://api.hostaway.com/documentation?shell#calendar

// Example

      hass.calendar.get_calendar(52662251,'2018-09-01','2018-09-30',1).then(function(data) {
         console.log(data);
      })

Coversations

https://api.hostaway.com/documentation?shell#conversations

// Example

      hass.conversations.get_conversations().then(function(data) {
         console.log(data);
      })

COI (Common information endpoints)

https://api.hostaway.com/documentation?shell#common-information-endpoints

// Example

      hass.coi.get_countries().then(function(data) {
         console.log(data);
      })

License

The MIT License (MIT)

Copyright (c) 2022-2023 Sandro Puljic (puljic@gmail.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.