0.0.1 • Published 11 months ago

@olivercrockett/bookingapis v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

Logo

The booking APIs aim to reduce the data load on the integrator and save them much work of coding in dates, reservations and more. The APIs provide a fully formed JSON for a site for a week, showcasing every appointment and their booked status.

Quick Start

Get your API keys

Your API requests are authenticated using API keys. Any request that doesn't include an API key will return an error.

You can get your API keys in your dashboard at any time, visit developers to generate or get your keys.

See an example of how to use our package

const { Bookings } = require("@olivercrockett/bookingapis");

const apiKey = "YOUR_API_KEY";

// Initialization
const bookings = new Bookings(apiKey);

// Get availability for a week
const site = STRING;
const date = STRING;
bookings
  .getAvailability(site, date)
  .then((response) => {
    console.log("Returned availability : ", response);
  })
  .catch((err) => console.log("Getting availability error : ", err));


// Make a booking
const day_time = STRING;
const note = STRING;
const user = OJBECT;
const metadata = OBJECT;
bookings
  .makeBooking(site, day_time, note, user, metadata)
  .then((response) => {
    console.log("Created booking : ", response);
  })
  .catch((err) => console.log("Creating booking error : ", err));


// Cancel a booking
const bookingId = STRING;
bookings
  .cancelBooking(bookingId)
  .then((response) => {
    console.log("Cancelled booking : ", response);
  })
  .catch((err) => console.log("Cancelling booking error : ", err));


// Get bookings for a time range
const start = STRING; // '2023-06-06T00:00:00.000Z'
const end = STRING; // '2023-06-07T00:00:00.000Z'
bookings
  .getBookings(start, end)
  .then((response) => {
    console.log("Returned bookings : ", response);
  })
  .catch((err) => console.log("Getting bookings error : ", err));


// Get bookings for a site
bookings
  .getBookings(start, end, site)
  .then((response) => {
    console.log("Returned bookings : ", response);
  })
  .catch((err) => console.log("Getting bookings error : ", err));

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js. Node.js 0.10 or higher is required.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm install @olivercrockett/bookingapis

Follow our installing guide for more information.

Features

  • Create booking
  • Cancel booking
  • Get list of bookings
  • Get bookings for a dedicated range
  • Easy list of a site's availabilities
  • Support for an unlimited number of sites

Docs & Community

Contributing

The BookingAPIs.dev project welcomes all constructive contributions. Contributions take many forms, from code for bug fixes and enhancements, to additions and fixes to documentation, additional tests, trigging incoming pull requests and issues, and more!

See the Contributing Guide for more technical details on contributing.

Security Issues

If you discover a security vulnerability in PieCard, please see Security Policies and Procedures.

Running Tests

To run the test suite, first install the dependencies, then run npm test:

$ npm install
$ npm test

People

The original author of BookingAPIs.dev and current lead maintainer is Oliver Crockett(https://github.com/olivercrockett

License

MIT