@leisurelink/calendar-client

There is more than one calendar-client. There is inventory-calendar-client for inventory-calendar, which has a V1 and a V2 published to NPM under the name calendar-client. The V1 is used by Orange, and V2 is used for IH-APP.

Usage no npm install needed!

<script type="module">
  import leisurelinkCalendarClient from 'https://cdn.skypack.dev/@leisurelink/calendar-client';
</script>

README

Calendar-client

Ambiguity

There is more than one calendar-client. There is inventory-calendar-client for inventory-calendar, which has a V1 and a V2 published to NPM under the name calendar-client. The V1 is used by Orange, and V2 is used for IH-APP.

This repo will publish calendar-client as a V3 for the GitHub repo calendar-api

Usage

let calendarClient = require('@leisurelink/calendar-client');
let client = calendarClient(keyId, key, baseUrl);

Methods

Constructing

  • let client = calendarClient(keyId, key, baseUrl);
  • keyId: trusted endpoint key id, ex: "my-api/self"
  • key: trusted endpoint key as a Buffer
  • baseUrl: calendar api base URL, for example the dev URL might be https://portal-dev.leisurelink.com

getCalendarById

  • client.getCalendarById(referenceId, lang).then(result => { ... })
  • Used to GET a Calendar object by its referenceId.
  • referenceId: the identifier of the Calendar. This is often the UnitId.
  • lang: sets the language of the request. This is required. For example, en-US
  • Possible response codes:
    • 200 for a success.
    • 400 if the language is not provided or doesn't match the required pattern.
    • 400 if the referenceId is not a standard shortId type identifier.
    • 404 if the calendarId does not have a corresponding document.
    • 500 for any unexpected errors.

putCalendarById

  • client.putCalendarById(referenceId, lang, calendarObject).then(result => { ... })
  • Used to CREATE or REPLACE a Calendar object.
  • referenceId: the identifier of the Calendar. This is often the UnitId.
  • lang: sets the language of the request. This is required. For example, en-US
  • calendarObject: the calendar settings object to store
  • Possible response codes:
    • 200 for a success.
    • 400 if the language is not provided or doesn't match the required pattern.
    • 400 if the referenceId is not a standard shortId type identifier.
    • 400 if unknown properties are passed in.
    • 400 if the calendarType is not a valid Type (NONE, INVENTORY, CONFIRMATION_METHOD)
    • 400 if the defaultConfirmationMethod is not a valid Type (NONE, AVAILABLE, UNAVAILABLE, CALL_AND_REQUEST)
    • 500 for any unexpected errors.

patchCalendarById

  • client.patchCalendarById(referenceId, lang, calendarObject).then(result => { ... })
  • Used to UPDATE a Calendar object.
  • referenceId: the identifier of the Calendar. This is often the UnitId.
  • lang: sets the language of the request. This is required. For example, en-US
  • calendarObject: the calendar settings object to store
  • Possible response codes:
    • 200 for a success
    • 400 if the language is not provided or doesn't match the required pattern
    • 400 if the referenceId is not a standard shortId type id.
    • 400 if unknown properties are passed in.
    • 400 if the calendarType is not a valid Type (NONE, INVENTORY, CONFIRMATION_METHOD)
    • 400 if the defaultConfirmationMethod is not a valid Type (NONE, AVAILABLE, UNAVAILABLE, CALL_AND_REQUEST)
    • 500 for any unexpected errors.

deleteCalendarById

  • client.deleteCalendarById(referenceId, lang).then(result => { ... })
  • Used to DELETE a Calendar object.
  • referenceId: the identifier of the Calendar. This is often the UnitId.
  • lang: sets the language of the request. This is required. For example, en-US
  • Possible response codes:
    • 204 for a success.
    • 400 if the language is not provided or doesn't match the required pattern
    • 400 if the referenceId is not a standard shortId type id.
    • 500 for any unexpected errors.