# @555platform/555-calendar-sdk

> Calendar SDK for 555 Platform

Latest version **1.0.1** (published 2021-06-20) · 0 weekly downloads

## Install

```sh
npm install @555platform/555-calendar-sdk
pnpm add @555platform/555-calendar-sdk
yarn add @555platform/555-calendar-sdk
bun add @555platform/555-calendar-sdk
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-06-20 |
| First published | 2021-06-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 63.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Comcast |
| Maintainers | nadeemgudaganur, robjsliwa, kdriadon, colinroberts, nija |
| Keywords | 555 |

## Links

- npm: https://www.npmjs.com/package/@555platform/555-calendar-sdk
- Repository: https://github.comcast.com/555-platform/555-calendar-sdk
- npm.io page: https://npm.io/package/@555platform/555-calendar-sdk

## Recent versions

- 1.0.1 (latest) — 2021-06-20
- 1.0.0 — 2021-06-11

## README

# Calendar

## Overview

Calendar Library provides API'S to create calendar,events and reminders. A calendar is a container for events. These events can be single instance or repeating events. Repeating events will have ending time. Multiple calendars can be created per domain, for example, work and personal calendars. Events are associated with calendar type. Events can have reminders set on them.

## Installation

``` javascript
npm install @555platform/555-calendar-sdk
```

## Calendar API's

Calendar Library provides API's to Create,Read,Update and delete calendar for user.

## Init :

init API is used to initialize server URL. init accepts a config parameter. config is of type object, which should have a property config.URL

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.init("config")
````

## Create Calendar :

createCalendar API is used to create calendar for user. we need to pass username and calendarname as parameters.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.createCalendar("username", "calendarname")
````

### Handling Response

createCalendar API returns a promise. Response will have calendar deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
Calendar.createCalendar("Rahul","home").then(response => {
      console.log(" Calendarlist Data ::",response)
    }).catch(error => {
      console.log("get calendarlist failed ::", error);
    });
}
  
 ```

 ## Get Calendar :

getCalendar API is used to get calendar details for user. we need to pass username as parameter.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.getCalendar("username")
````

### Handling Response

getCalendar API returns a promise. Response will have calendar deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
Calendar.getCalendar("Rahul").then(response => {
      console.log(" Calendarlist Data ::",response)
    }).catch(error => {
      console.log("get calendarlist failed ::", error);
    });
}
  
 ```

### Update Calendar :

updateCalendar API is used to update calendar details for user. we need to pass calendarId and calendarName as parameters.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.updateCalendar("calendarid","calendarname")
````

### Handling Response

updateCalendar API returns a promise. Response will have calendar deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
Calendar.updateCalendar("1ea1f9d3b4a927b264c83c07", "home").then(response => {
      console.log(" Calendarlist updateds ::",response)
    }).catch(error => {
      console.log("get calendarlist failed ::", error);
    });
}
  
```


### Delete Calendar :

deleteCalendar API is used to delete calendar of user. we need to pass calendarId as parameter.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.deleteCalendar("calendarid")
````

### Handling Response

deleteCalendar API returns a promise. Response will have calendar deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
Calendar.deleteCalendar("1ea1f9d3b4a927b264c83c07").then(response => {
      console.log(" Calendarlist updateds ::",response)
    }).catch(error => {
      console.log("get calendarlist failed ::", error);
    });
}
  
```

## Event API's

Calendar Library provides API's to create,update,cancel and delete events in calendar for user.


## Create Event :

createEvent API is used to create event in calendar for user. we need to pass eventData as parameter.

Below is the eventdata need to be passed as parameter to createEvent API.


| Property          | Type   | Description           |
|-------------------|--------|-----------------------|
| calendar_id         | string | Unique calendar id|
| subject | string | title of event
| body             | json | <ul> <li>contentType - type of content</li><li>content - description of event</li></ul>              |
| start          | json | start date and time of event <ul> <li>date_time - date and time</li></ul>    |
| end          | json | end date and time of event <ul> <li>date_time - date and time</li></ul>     |
 participants         | array[Objects] | <ul> <li>Event Organizer</li><li>Required participants</li><li>Optional participants</li></ul>|
| location         | string | location of event or meeting link|
| recurrence         | Object | Defines the type of event|
| allow_new_time_proposals          | bool | allow time to change    |
| show_as              | string | state of user   |

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.createEvent({eventData})
````

### Handling Response

createCalendar API returns a promise. Response will have event deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
  let eventData = {
      "calendar_id": "8fa1f9d3b4a927b264c83c00",
      "subject": "Let's chat about chat",
      "body": {
          "contentType": "HTML",
          "content": "Talk about all things chat..."
      },
      "start": {
          "date_time": "2020-04-28T17:30:00Z"
      },
      "end": {
          "date_time": "2020-04-28T18:00:00Z"
      },
      "location": {
          "display_name": "Rob's desk"
      },
      "participants": [
          {
              "user_id": "7E163156-7762-4BEB-A1C6-729EA81755A7",
              "type": "organizer"
          },
          {
              "user_id": "7E163156-7762-4BEB-A1C6-729EA81755B8",
              "type": "required"
          }
      ],
      "recurrence": {
          "pattern": {
              "type": "weekly",
              "interval": 1,
              "days_of_week": [
                  "Tuesday"
              ]
          },
          "range": {
              "type": "endDate",
              "start_date": "2020-04-28T00:00:00Z",
              "end_date": "2020-06-28T00:00:00Z"
          }
      },
      "allow_new_time_proposals": true,
      "show_as": "busy"
  }

  Calendar.createEvent(eventData).then((response) => {
      console.log("create event response ::",response)

  })
  .catch(error => {
      console.log(error);
  })
  
 ```

 ## Update Event :

updateEvent API is used to update event for user. we need to pass userid,eventid and update event info as parameter.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.updateEvent(userid,eventid,updatedEventInfo)
````

### Handling Response

updateEvent API returns a promise. Response will have event deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
  Calendar.updateEvent(userid,eventid,updatedEventInfo).then((response) => {
      console.log("create event response ::",response)

  })
  .catch(error => {
      console.log(error);
  })
  
 ```

 ## Cancel Event :

cancelEvent API is used to cancel event for user. we need to pass userid,eventid as parameter.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.cancelEvent(userid,eventid)
````

### Handling Response

cancelEvent API returns a promise. Response will have event deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
  Calendar.cancelEvent(userid,eventid).then((response) => {
      console.log("create event response ::",response)

  })
  .catch(error => {
      console.log(error);
  })
  
 ```

  ## Delete Event :

deleteEvent API is used to delete event for user. we need to pass userid,eventid as parameter.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.deleteEvent(userid,eventid)
````

### Handling Response

deleteEvent API returns a promise. Response will have event deatils if call is successful otherwise error JSON with code and reason for error.

```javascript
  Calendar.deleteEvent(userid,eventid).then((response) => {
      console.log("create event response ::",response)

  })
  .catch(error => {
      console.log(error);
  })
  
 ```

  ## List Events :

listEvents API is used to list events for user. We need to pass userId, calendarId, startDate and endDate as parameters. startDate and endDate are dates for which user wants to fetch the events.

```javascript
import {Calendar} from '@555platform/555-calendar-sdk';
Calendar.listEvents(userId, calendarId, startDate, endDate)
````

### Handling Response

listEvents API returns a promise. Response will have event details if call is successful otherwise error JSON with code and reason for error.

```javascript
  const userId = '7E163156-7762-4BEB-A1C6-729EA81755A7';
  const calendarId = '8fa1f9d3b4a927b264c83c00';
  const startDate = '2021-06-18T00:00:00Z';
  const endDate = '2021-06-22T00:00:00Z';

  Calendar.listEvents('userId','calendarId','startDate','endDate')
  .then((response) => {
      console.log("list event response ::",response)
  })
  .catch(error => {
      console.log(" error"+error.message);
  })
  
 ```

---
_Source: https://npm.io/package/@555platform/555-calendar-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
