npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

calendar-api

v1.3.0

Published

* [Calendars](#calendars) * [Availability](#availabilty) * [Swagger Docs](#swagger-docs) * [Postman](#postman)

Downloads

2

Readme

Calendar API

Calendars

Before availablility can be set, there must be a calendar created. The calendar contains the following object:

{
  "calendarId": {{shortId}},
  "calendarType": "NONE",
  "sellMode": "NONE"
}

Validation

  • calendarId is a required field, and must be a valid shortId
  • calendarType is one of ['INVENTORY', 'CONFIRMATION_METHOD'] With a default of INVENTORY
  • sellMode is one of [AVAILABLE', 'UNAVAILABLE', 'CALL_AND_REQUEST'] with a default of UNAVAILABLE

Routes

{{host}} is https://portal-dev.leisurelink.com or https://portal.leisurelink.com

Healthcheck

  • GET

  • {{host}}/calendar-api/v1/healthcheck

  • Sample Response (200):

      {
        "version": "calendar-api 1.0.3",
        "Inventory Round Trip": "0s 28.389224ms",
        "Calendar Round Trip": "0s 28.722085ms"
      }
        

Create Calendar

There are two ways to create a Calendar, with the preferred way to be with a PUT. The PUT will overwrite any previous data, where the POST will return a 409 if there is already a calendar object created with the supplied Id.

  • PUT
    • {{host}}/calendar-api/v1/en-US/calendars/{{calendarId}}

    • Sample Request:

        {
            "calendarType": "INVENTORY",
            "sellMode": "UNAVAILABLE"
        }
    • Responses:

      • 400 - For errors.
      • 200 - For a success
  • POST
    • {{host}}/calendar-api/v1/en-US/calendars

    • Sample Request:

        {
          "calendarId": {{shortId}},
          "calendarType": "INVENTORY",
          "sellMode": "UNAVAILABLE"
        }
    • Responses:

      • 409 - Is returned if the calendar already exists
      • 200 - For a success

Get Calendar

  • GET
    • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}
    • Responses:
      • 404 - If the calendarId does not exits
      • 200 - For a success

Patch Calendar

  • PATCH
    • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}
    • Responses:
      • 404 - If the calendarId does not exits
      • 200 - For a success

Delete Calendar

  • DELETE
    • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}
    • Responses:
      • 404 - If the calendarId does not exits
      • 204 - For a success

Availability

Get Available Count

  • GET
  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability-check?begin=2016-03-11&end=2016-03-20
  • Responses:
    • 404 - If the calendarId does not exist

    • 400 - Validation Errors

    • 200 - Success

        {
            available: 0
        }
    • Note - This returns the Math.Max across all days in the range. If there is no availability for a day in the range, the available will be returned as 0.

Get Availability By Day

  • GET
  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability/{date}
  • Responses:
    • 404 - If the calendarId does not exits

    • 400 - Validation Errors

    • 200 - For a success

        {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-03",
            "available": 6
        }
    • Note - If there is not availability for the given calendar/date combo, a default availability object will be returned. The default availability will have the allocated as null

Get Availability By Date Range

  • GET
  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability?begin={begin}&end={end}
  • Responses:
    • 404 - If the calendarId does not exits

    • 400 - Validation Errors

    • 200 - For a success

        [
          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-01",
            "available": 6
          },
          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-03",
            "available": 6
          }
        ]
    • Note - If there is not availability for the given calendar/date combo, a default availability object will be returned. The default availability will have the allocated as null

Put Availability By Day

  • PUT

  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability/{date}

  • Request Body:

      {
          "allocated": 6
      }
  • Responses:

    • 404 - If the calendarId does not exits

    • 400 - Validation errors.

    • 200 - For a success

          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-03",
            "available": 6
          }

Put Availability

  • PUT

  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability

  • Request Body:

      [
          {
              "date": "2016-03-11",
              "allocated": 4
          },
          {
              "date": "2016-03-12",
              "allocated": 4
          }
      ]
  • Responses:

    • 404 - If the calendarId does not exits

    • 400 - Validation Errors

    • 400 - Duplicate Days

    • 200 - For a success

        [
          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-01",
            "available": 6
          },
          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-03",
            "available": 6
          }
        ]

Patch Availability by Ranges

  • PATCH

  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability

  • Request Body:

      [  
          {
              "begin": "2016-03-11",
              "end": "2016-03-20",
              "availability": {
                "allocated": 2
              }
          },
          {
              "begin": "2016-03-24",
              "end": "2016-03-30",
              "availability": {
                "allocated": 3
              }
          }
      ]
  • Responses:

    • 404 - If the calendarId does not exits

    • 400 - Validation Errors

    • 400 - Duplicate Days

    • 200 - For a success

        [
          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-01",
            "available": 6
          },
          {
            "sold": 0,
            "allocated": 6,
            "date": "2016-01-03",
            "available": 6
          }
        ]

Delete Availability By Day

  • DELETE
  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability/{date}
  • Responses:
    • 404 - If the calendarId does not exits
    • 400 - Validation Errors.
    • 204 - For a success

Delete Availability By Date Range

  • DELETE
  • {{host}}/calendar-api/v1/en-US/calendars/{calendarId}/availability?begin={begin}&end={end}
  • Responses:
    • 404 - If the calendarId does not exits
    • 400 - Validation Errors
    • 204 - For a success

Swagger Docs

Postman

In the Leisurelink Postman library (you must be invited) there is a collection called calendar-api