GithubHelp home page GithubHelp logo

thejlifex / simple-caldav-client Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 1.0 19 KB

Simple Caldav Client. Get, Save and Edit your calendar events from a nodejs server!.

License: MIT License

TypeScript 100.00%
caldav-client caldav calendar nodejs expres typescript

simple-caldav-client's Introduction

Simple Caldav Client

Simple Caldav Client is a easy way to connect to a caldav server(owncloud, nextcloud, ...). It is the typescript implementation of this document that explain how to build a CalDAV client. The document is language-agnostic, and considering the massive scope of CalDAV, not complete.

You need only:

  • username
  • password.
  • calendarUrl

Get a demo owncloud account here!

  • Create some Events.
  • Get this events from your Simple Caldav Client in the next step โ†“ .

Example Usage

const startDate = new Date('December 17, 2018 03:24:00');
const calendarUrl = 'https://owncloud10.ocloud.de/remote.php/dav/calendars/admin/personal/';
const username = 'admin';
const password = 'demo123';

const calendarClient = new CalendarClient(calendarUrl, username, password);

calendarClient.getEvents(startDate).then((calendarEvents) => {
    console.log(calendarEvents);
}, (error) => {
    console.error(error);
});

API

/**
 * Get events from `startDate` up to optional `endDate`.
 * if you don't enter a endDate, if will return all events from `startDate`.
 */
CalendarClient.getEvents(startDate: Date, endDate?: Date): Promise<CalendarEvent[]>
/**
 * if the event already exits - it means same `event.uid` - the event will be updated
 * else it will be added.
 * @param event - the event you want to add or update.
 */
CalendarClient.addOrUpdateEvent(event: CalendarEvent): Promise<void>
/**
 * Remove the event in caldav server with the same uid like `event`.
 * @param event - the event you want to remove.
 */
CalendarClient.removeEvent(event: CalendarEvent): Promise<void>
export interface CalendarEvent {
    /**
     * unique ID of the event, needs to be unique and can be used to edit the event in the future
     * EXAMPLE: "eventid01"
     */
    uid: string;

    /**
     * The title of the event
     */
    summary: string;

    /**
     * Description of the event, optional.
     */
    description?: string;

    /**
     * Location of the event, optional.
     */
    location?: string;

    /**
     * Any timeformat handled by moment.js
     * EXAMPLE: new Date('Juni 20, 2019 11:24:00')
     */
    startDate: Date;

    /**
     * Any timeformat handled by moment.js
     * EXAMPLE: new Date('Juni 20, 2019 14:24:00')
     */
    endDate: Date;

    /**
     * time zone in the format
     * EXAMPLE: "Europe/Berlin"
     */
    tzid: string;

    /**
     * specify allDayEvent (no time just date) / note no timezone for allDayEvents
     */
    allDayEvent: boolean;

    /**
     * The source iCalendar data for this event.
     */
    iCalendarData: string;

    duration?: CalendarEventDuration;

    organizer?: string;

    attendees?: string[] | string[][];

    recurrenceId?: number;
}

Installation

Simple Caldav Client requires Node.js to run.

Clone this project.

$ git clone https://github.com/TheJLifeX/simple-caldav-client.git
$ cd simple-caldav-client

Install the dependencies and devDependencies.

$ npm install

Start the server.

$ npm run serve

Tech

Simple Caldav Client uses a number of open source projects to work properly:

  • dependencies
    • expressjs Fast, unopinionated, minimalist web framework for Node.js
    • ical.js Javascript parser for calendar and vcard data.
    • moment Parse, validate, manipulate, and display dates and times in JavaScript.
    • xml2js XML to JavaScript object converter.
  • devDependencies

Todos

  • Get all calendar urls of a given user.

License

MIT

simple-caldav-client's People

Contributors

thejlifex avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.