npm package: @olivercrockett/bookingapis
Description: A simple NPM package to access the BookingAPIs.dev API and allow you to take and manage bookings, hassle free.
Author: Oliver Crockett
Latest version: 0.0.1

![Logo](https://bookingapis.dev/logo.png)

  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.

  <!-- [![NPM Version][npm-version-image]][npm-url]
  [![NPM Install Size][npm-install-size-image]][npm-install-size-url]
  [![NPM Downloads][npm-downloads-image]][npm-downloads-url] -->

  # 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. <br/> <br/>

> You can get your API keys in your dashboard at any time, visit [developers](https://bookingapis.dev) to _generate_ or _get_ your keys.

<br />

  [See an example of how to use our package](example)

<br />

```js
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](https://nodejs.org/en/) module available through the
[npm registry](https://www.npmjs.com/).

Before installing, [download and install Node.js](https://nodejs.org/en/download/).
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](https://docs.npmjs.com/creating-a-package-json-file).

Installation is done using the
[`npm install` command](https://docs.npmjs.com/getting-started/installing-npm-packages-locally):

```console
$ npm install @olivercrockett/bookingapis
```

Follow [our installing guide](https://docs.bookingapis.dev/quick-start)
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

  * [Website and Documentation](https://bookingapis.dev) ---- [Documentation](https://docs.bookingapis.dev)]
  * [Twitter](https://twitter.com/bookingapis) for announcements and information
  * [Discord Server](https://discord.gg/W4n8JkwHBq) for discussion and support
  * [Contact](https://bookingapis.dev/contact) for discussion and support



## Contributing

  <!-- [![Linux Build][github-actions-ci-image]][github-actions-ci-url]
  [![Windows Build][appveyor-image]][appveyor-url]
  [![Test Coverage][coveralls-image]][coveralls-url] -->

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](Contributing.md) for more technical details on contributing.

### Security Issues

If you discover a security vulnerability in PieCard, please see [Security Policies and Procedures](Security.md).

### Running Tests

To run the test suite, first install the dependencies, then run `npm test`:

```console
$ npm install
$ npm test
```

## People

The original author of BookingAPIs.dev and current lead maintainer is [Oliver Crockett](https://github.com/olivercrockett

## License

  [MIT](LICENSE)