3.2.0 • Published 5 years ago

allocloud-js-sdk v3.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

ALLOcloud JavaScript SDK

An isomorphic/universal promise based interface to the ALLOcloud API.

CircleCI npm

Install

$ yarn add allocloud-js-sdk
# or with NPM
$ npm install --save allocloud-js-sdk

Usage

See typings for available method while we don't have proper documentation for this lib. Plan is to use typedoc so we can infer documentation from typings and get things done faster.

import ALLOcloud from "allocloud-js-sdk";

const API_KEY = process.env.ALLOCLOUD_API_KEY;

const main = async () => {
  const client = await ALLOcloud.create(API_KEY);

  const devices = await client.listDevices();
  const deviceThree = await client.getDevice(3);
  const contacts = await client.listContacts();

  console.log("Devices count:", devices.length);
  console.log("Contacts count:", contacts.length);
  console.log("Device (id: 3) name:", deviceThree.name);

  const newCalendar = {
    name: "My super new calendar",
    is_external_calendar: false,
    ics: "BEGIN:VCALENDAR\nVERSION:2.0\n{ICS_DATA_HERE}\nEND:VCALENDAR",
    url: "",
    time_zone: "Europe/Brussels"
  };

  const calendar = await client.createCalendar(newCalendar);
  console.log("New calendar created. id:", calendar.id);
};

main();