From 072173308db1919d7958ed75372cc8ba2e910ad1 Mon Sep 17 00:00:00 2001 From: Tim Lancina Date: Mon, 8 Feb 2016 16:11:40 -0600 Subject: [PATCH] chore(calendar): update calendar --- dist/plugins/calendar.d.ts | 241 +++++++++++++++++-- dist/plugins/calendar.js | 357 ++++++++++++++++++++++++++-- dist/plugins/calendar.js.map | 2 +- src/plugins/calendar.ts | 447 +++++++++++++++++++++++++++++++++-- 4 files changed, 986 insertions(+), 61 deletions(-) diff --git a/dist/plugins/calendar.d.ts b/dist/plugins/calendar.d.ts index 0be86ae5e..bebbd0ceb 100644 --- a/dist/plugins/calendar.d.ts +++ b/dist/plugins/calendar.d.ts @@ -1,19 +1,224 @@ -export declare class Calendar { - static createCalendar(options: any): void; - static deleteCalendar(calendarName: string): void; - static getCalendarOptions(): void; - static createEvent(title: any, location: any, notes: any, startDate: any, endDate: any): void; - static createEventWithOptions(title: any, location: any, notes: any, startDate: any, endDate: any, options: any): void; - static createEventInteractively(title: any, location: any, notes: any, startDate: any, endDate: any): void; - static createEventInteractivelyWithOptions(title: any, location: any, notes: any, startDate: any, endDate: any, options: any): void; - static createEventInNamedCalendar(title: any, location: any, notes: any, startDate: any, endDate: any, calendarName: any): void; - static findEvent(title: any, location: any, notes: any, startDate: any, endDate: any): void; - static listEventsInRange(startDate: any, endDate: any): void; - static listCalendars(): void; - static findAllEventsInNamedCalendar(calendarName: string): void; - static modifyEvent(title: any, location: any, notes: any, startDate: any, endDate: any, newTitle: any, newLocation: any, newNotes: any, newStartDate: any, newEndDate: any): void; - static modifyEventWithOptions(title: any, location: any, notes: any, startDate: any, endDate: any, newTitle: any, newEventLocation: any, newNotes: any, newStartDate: any, newEndDate: any, options: any): void; - static deleteEvent(title: any, location: any, notes: any, startDate: any, endDate: any): void; - static deleteEventFromNamedCalendar(title: any, location: any, notes: any, startDate: any, endDate: any, calendarName: any): void; - static openCalendar(date: any): void; +export interface CalendarOptions { + firstReminderMinutes?: number; + secondReminderMinutes?: number; + recurrence?: string; + recurrenceInterval?: number; + recurrenceEndDate?: Date; + calendarName?: string; + calendarId?: number; + url?: string; +} +export interface Calendar { + id: number; + name: string; +} +/** + * This plugin allows you to add events to the Calendar of the mobile device. + * + * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). + * + */ +export declare class Calendar { + /** + * Create a calendar. (iOS only) + * + * @usage + * ``` + * Calendar.createCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` + * + * @param {string | Object} nameOrOptions either a string name or a options object. + * options: + * calendarName: string the name of the calendar + * calendarColor: string the hex color of the calendar + * @return Returns a Promise + */ + static createCalendar(nameOrOptions: string | { + calendarName: string; + calendarColor: string; + }): Promise; + /** + * Delete a calendar. (iOS only) + * + * @usage + * ``` + * Calendar.deleteCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` + * + * @param {string} name Name of the calendar to delete. + * @return Returns a Promise + */ + static deleteCalendar(name: string): Promise; + /** + * Returns the default calendar options. + * + * @return Returns an object with the default calendar options + * ``` + * { + * firstReminderMinutes: 60, + * secondReminderMinutes: null, + * recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly' + * recurrenceInterval: 1, // only used when recurrence is set + * recurrenceEndDate: null, + * calendarName: null, + * calendarId: null, + * url: null + * } + * ``` + */ + static getCalendarOptions(): CalendarOptions; + /** + * Silently create an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + static createEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise; + /** + * Silently create an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + static createEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise; + /** + * Interactively create an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + static createEventInteractively(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise; + /** + * Interactively create an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + static createEventInteractivelyWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise; + /** + * Find an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + static findEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise; + /** + * Find an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise that resolves with the event, or rejects with an error. + */ + static findEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, options?: CalendarOptions): Promise; + /** + * Find a list of events within the specified date range. (Android only) + * + * @param {Date} [startDate] The start date + * @param {Date} [endDate] The end date + * @return Returns a Promise that resolves with the list of events, or rejects with an error. + */ + static listEventsInRange(startDate: Date, endDate: Date): Promise; + /** + * Get a list of all calendars. + * @return A Promise that resolves with the list of calendars, or rejects with an error. + */ + static listCalendars(): Promise; + /** + * Get a list of all future events in the specified calendar. (iOS only) + * @return Returns a Promise that resolves with the list of events, or rejects with an error. + */ + static findAllEventsInNamedCalendar(calendarName: string): Promise; + /** + * Modify an event. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} [newTitle] The new event title + * @param {string} [newLocation] The new event location + * @param {string} [newNotes] The new event notes + * @param {Date} [newStartDate] The new event start date + * @param {Date} [newEndDate] The new event end date + * @return Returns a Promise + */ + static modifyEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, newTitle?: string, newLocation?: string, newNotes?: string, newStartDate?: Date, newEndDate?: Date): Promise; + /** + * Modify an event with additional options. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} [newTitle] The new event title + * @param {string} [newLocation] The new event location + * @param {string} [newNotes] The new event notes + * @param {Date} [newStartDate] The new event start date + * @param {Date} [newEndDate] The new event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + static modifyEventWithOptions(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, newTitle?: string, newLocation?: string, newNotes?: string, newStartDate?: Date, newEndDate?: Date, options?: CalendarOptions): Promise; + /** + * Delete an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + static deleteEvent(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date): Promise; + /** + * Delete an event from the specified Calendar. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} calendarName + * @return Returns a Promise + */ + static deleteEventFromNamedCalendar(title?: string, location?: string, notes?: string, startDate?: Date, endDate?: Date, calendarName?: string): Promise; + /** + * Open the calendar at the specified date. + * @return {Date} date + */ + static openCalendar(date: Date): Promise; } diff --git a/dist/plugins/calendar.js b/dist/plugins/calendar.js index 877f767fd..ccd0a9c86 100644 --- a/dist/plugins/calendar.js +++ b/dist/plugins/calendar.js @@ -5,35 +5,348 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, return c > 3 && r && Object.defineProperty(target, key, r), r; }; var plugin_1 = require('./plugin'); +/** + * This plugin allows you to add events to the Calendar of the mobile device. + * + * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). + * + */ var Calendar = (function () { function Calendar() { } - Calendar.createCalendar = function (options) { }; - Calendar.deleteCalendar = function (calendarName) { }; - Calendar.getCalendarOptions = function () { }; - Calendar.createEvent = function (title, location, notes, startDate, endDate) { }; - Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) { }; - Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) { }; - Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) { }; - Calendar.createEventInNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { }; - Calendar.findEvent = function (title, location, notes, startDate, endDate) { }; - Calendar.listEventsInRange = function (startDate, endDate) { }; - Calendar.listCalendars = function () { }; - Calendar.findAllEventsInNamedCalendar = function (calendarName) { }; - Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) { }; - Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newEventLocation, newNotes, newStartDate, newEndDate, options) { }; - Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { }; - Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { }; - Calendar.openCalendar = function (date) { }; + /** + * Create a calendar. (iOS only) + * + * @usage + * ``` + * Calendar.createCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` + * + * @param {string | Object} nameOrOptions either a string name or a options object. + * options: + * calendarName: string the name of the calendar + * calendarColor: string the hex color of the calendar + * @return Returns a Promise + */ + Calendar.createCalendar = function (nameOrOptions) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Delete a calendar. (iOS only) + * + * @usage + * ``` + * Calendar.deleteCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` + * + * @param {string} name Name of the calendar to delete. + * @return Returns a Promise + */ + Calendar.deleteCalendar = function (name) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Returns the default calendar options. + * + * @return Returns an object with the default calendar options + * ``` + * { + * firstReminderMinutes: 60, + * secondReminderMinutes: null, + * recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly' + * recurrenceInterval: 1, // only used when recurrence is set + * recurrenceEndDate: null, + * calendarName: null, + * calendarId: null, + * url: null + * } + * ``` + */ + Calendar.getCalendarOptions = function () { + return { + firstReminderMinutes: 60, + secondReminderMinutes: null, + recurrence: null, + recurrenceInterval: 1, + recurrenceEndDate: null, + calendarName: null, + calendarId: null, + url: null + }; + }; + /** + * Silently create an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + Calendar.createEvent = function (title, location, notes, startDate, endDate) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Silently create an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Interactively create an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Interactively create an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + // deprecated + // @Cordova() + // static createEventInNamedCalendar( + // title?: string, + // location?: string, + // notes?: string, + // startDate?: Date, + // endDate?: Date, + // calendarName?: string + // ) {} + /** + * Find an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + Calendar.findEvent = function (title, location, notes, startDate, endDate) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Find an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise that resolves with the event, or rejects with an error. + */ + Calendar.findEventWithOptions = function (title, location, notes, startDate, endDate, options) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Find a list of events within the specified date range. (Android only) + * + * @param {Date} [startDate] The start date + * @param {Date} [endDate] The end date + * @return Returns a Promise that resolves with the list of events, or rejects with an error. + */ + Calendar.listEventsInRange = function (startDate, endDate) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Get a list of all calendars. + * @return A Promise that resolves with the list of calendars, or rejects with an error. + */ + Calendar.listCalendars = function () { + return new Promise(function (res, rej) { }); + }; + /** + * Get a list of all future events in the specified calendar. (iOS only) + * @return Returns a Promise that resolves with the list of events, or rejects with an error. + */ + Calendar.findAllEventsInNamedCalendar = function (calendarName) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Modify an event. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} [newTitle] The new event title + * @param {string} [newLocation] The new event location + * @param {string} [newNotes] The new event notes + * @param {Date} [newStartDate] The new event start date + * @param {Date} [newEndDate] The new event end date + * @return Returns a Promise + */ + Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Modify an event with additional options. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} [newTitle] The new event title + * @param {string} [newLocation] The new event location + * @param {string} [newNotes] The new event notes + * @param {Date} [newStartDate] The new event start date + * @param {Date} [newEndDate] The new event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate, options) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Delete an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ + Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Delete an event from the specified Calendar. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} calendarName + * @return Returns a Promise + */ + Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; + /** + * Open the calendar at the specified date. + * @return {Date} date + */ + Calendar.openCalendar = function (date) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise(function (res, rej) { }); + }; __decorate([ plugin_1.Cordova() ], Calendar, "createCalendar", null); __decorate([ plugin_1.Cordova() ], Calendar, "deleteCalendar", null); - __decorate([ - plugin_1.Cordova() - ], Calendar, "getCalendarOptions", null); __decorate([ plugin_1.Cordova() ], Calendar, "createEvent", null); @@ -48,10 +361,10 @@ var Calendar = (function () { ], Calendar, "createEventInteractivelyWithOptions", null); __decorate([ plugin_1.Cordova() - ], Calendar, "createEventInNamedCalendar", null); + ], Calendar, "findEvent", null); __decorate([ plugin_1.Cordova() - ], Calendar, "findEvent", null); + ], Calendar, "findEventWithOptions", null); __decorate([ plugin_1.Cordova() ], Calendar, "listEventsInRange", null); diff --git a/dist/plugins/calendar.js.map b/dist/plugins/calendar.js.map index abab58ee1..443b76e2a 100644 --- a/dist/plugins/calendar.js.map +++ b/dist/plugins/calendar.js.map @@ -1 +1 @@ -{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/plugins/calendar.ts"],"names":["Calendar","Calendar.constructor","Calendar.createCalendar","Calendar.deleteCalendar","Calendar.getCalendarOptions","Calendar.createEvent","Calendar.createEventWithOptions","Calendar.createEventInteractively","Calendar.createEventInteractivelyWithOptions","Calendar.createEventInNamedCalendar","Calendar.findEvent","Calendar.listEventsInRange","Calendar.listCalendars","Calendar.findAllEventsInNamedCalendar","Calendar.modifyEvent","Calendar.modifyEventWithOptions","Calendar.deleteEvent","Calendar.deleteEventFromNamedCalendar","Calendar.openCalendar"],"mappings":";;;;;;AAAA,uBAA8B,UAAU,CAAC,CAAA;AAEzC;IAAAA;IAwDAC,CAACA;IAjDQD,uBAAcA,GADrBA,UACsBA,OAAWA,IAAGE,CAACA;IAG9BF,uBAAcA,GADrBA,UACsBA,YAAmBA,IAAGG,CAACA;IAGtCH,2BAAkBA,GADzBA,cAC6BI,CAACA;IAGvBJ,oBAAWA,GADlBA,UACmBA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,IAAGK,CAACA;IAG1DL,+BAAsBA,GAD7BA,UAC8BA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,EAAEA,OAAOA,IAAGM,CAACA;IAG9EN,iCAAwBA,GAD/BA,UACgCA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,IAAGO,CAACA;IAGvEP,4CAAmCA,GAD1CA,UAC2CA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA,EAAEA,OAAOA,IAAGQ,CAACA;IAG3FR,mCAA0BA,GADjCA,UACkCA,KAAKA,EAAEA,QAAQA,EAAEA,KAAKA,EAAEA,SAASA,EAAEA,OAAOA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;IAErFA;QAACA,gBAAOA,EAAEA;OACHA,oCAAwBA,QAA+CA;IAE9EA;QAACA,gBAAOA,EAAEA;OACHA,+CAAmCA,QAAwDA;IAElGA;QAACA,gBAAOA,EAAEA;OACHA,sCAA0BA,QAA6DA;IAE9FA;QAACA,gBAAOA,EAAEA;OACHA,qBAASA,QAA+CA;IAE/DA;QAACA,gBAAOA,EAAEA;OACHA,6BAAiBA,QAA+BA;IAEvDA;QAACA,gBAAOA,EAAEA;OACHA,yBAAaA,QAAIA;IAExBA;QAACA,gBAAOA,EAAEA;OACHA,wCAA4BA,QAAwBA;IAE3DA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAA0GA;IAE5HA;QAACA,gBAAOA,EAAEA;OACHA,kCAAsBA,QAAwHA;IAErJA;QAACA,gBAAOA,EAAEA;OACHA,uBAAWA,QAA+CA;IAEjEA;QAACA,gBAAOA,EAAEA;OACHA,wCAA4BA,QAA6DA;IAEhGA;QAACA,gBAAOA,EAAEA;OACHA,wBAAYA,QAASA;IAvD9BA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;iBAoDDA;IAADA,eAACA;AAADA,CAACA,AAxDD,IAwDC;AAnDY,gBAAQ,WAmDpB,CAAA"} \ No newline at end of file +{"version":3,"file":"calendar.js","sourceRoot":"","sources":["../../src/plugins/calendar.ts"],"names":["Calendar","Calendar.constructor","Calendar.createCalendar","Calendar.deleteCalendar","Calendar.getCalendarOptions","Calendar.createEvent","Calendar.createEventWithOptions","Calendar.createEventInteractively","Calendar.createEventInteractivelyWithOptions","Calendar.findEvent","Calendar.findEventWithOptions","Calendar.listEventsInRange","Calendar.listCalendars","Calendar.findAllEventsInNamedCalendar","Calendar.modifyEvent","Calendar.modifyEventWithOptions","Calendar.deleteEvent","Calendar.deleteEventFromNamedCalendar","Calendar.openCalendar"],"mappings":";;;;;;A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WA,QAajBA;IAaFA;QAACA,gBAAOA,EAAEA;OACHA,wCAA4BA,QAclCA;IAMAA;QAACA,gBAAOA,EAAEA;OACHA,wBAAYA,QAOlBA;IAxbHA;QAACA,eAAMA,CAACA;YACNA,IAAIA,EAAEA,UAAUA;YAChBA,MAAMA,EAAEA,yBAAyBA;YACjCA,SAASA,EAAEA,kBAAkBA;SAC9BA,CAACA;iBAqbDA;IAADA,eAACA;AAADA,CAACA,AAzbD,IAybC;AApbY,gBAAQ,WAobpB,CAAA"} \ No newline at end of file diff --git a/src/plugins/calendar.ts b/src/plugins/calendar.ts index e22cc34a3..4bb29e3c2 100644 --- a/src/plugins/calendar.ts +++ b/src/plugins/calendar.ts @@ -1,59 +1,466 @@ import {Plugin, Cordova} from './plugin'; +export interface CalendarOptions { + firstReminderMinutes?: number; + secondReminderMinutes?: number; + recurrence?: string, // options are: 'daily', 'weekly', 'monthly', 'yearly' + recurrenceInterval?: number, // only used when recurrence is set + recurrenceEndDate?: Date; + calendarName?: string; + calendarId?: number; + url?: string; +} + +export interface Calendar { + id: number, + name: string +} + +/** + * This plugin allows you to add events to the Calendar of the mobile device. + * + * Requires Cordova plugin: `cordova-plugin-calendar`. For more info, please see the [Calendar plugin docs](https://github.com/EddyVerbruggen/Calendar-PhoneGap-Plugin). + * + */ @Plugin({ name: 'Calendar', plugin: 'cordova-plugin-calendar', pluginRef: 'plugins.calendar' }) export class Calendar { + /** + * Create a calendar. (iOS only) + * + * @usage + * ``` + * Calendar.createCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` + * + * @param {string | Object} nameOrOptions either a string name or a options object. + * options: + * calendarName: string the name of the calendar + * calendarColor: string the hex color of the calendar + * @return Returns a Promise + */ @Cordova() - static createCalendar(options:any) {} + static createCalendar(nameOrOptions: string | { calendarName: string, calendarColor: string }) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Delete a calendar. (iOS only) + * + * @usage + * ``` + * Calendar.deleteCalendar('MyCalendar').then( + * (msg) => { console.log(msg); }, + * (err) => { console.log(err); } + * ); + * ``` + * + * @param {string} name Name of the calendar to delete. + * @return Returns a Promise + */ @Cordova() - static deleteCalendar(calendarName:string) {} + static deleteCalendar(name: string) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } - @Cordova() - static getCalendarOptions() {} + /** + * Returns the default calendar options. + * + * @return Returns an object with the default calendar options + * ``` + * { + * firstReminderMinutes: 60, + * secondReminderMinutes: null, + * recurrence: null, // options are: 'daily', 'weekly', 'monthly', 'yearly' + * recurrenceInterval: 1, // only used when recurrence is set + * recurrenceEndDate: null, + * calendarName: null, + * calendarId: null, + * url: null + * } + * ``` + */ + static getCalendarOptions(): CalendarOptions { + return { + firstReminderMinutes: 60, + secondReminderMinutes: null, + recurrence: null, + recurrenceInterval: 1, + recurrenceEndDate: null, + calendarName: null, + calendarId: null, + url: null + } + } + /** + * Silently create an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ @Cordova() - static createEvent(title, location, notes, startDate, endDate) {} + static createEvent( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Silently create an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ @Cordova() - static createEventWithOptions(title, location, notes, startDate, endDate, options) {} + static createEventWithOptions( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + options?: CalendarOptions + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Interactively create an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ @Cordova() - static createEventInteractively(title, location, notes, startDate, endDate) {} + static createEventInteractively( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Interactively create an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ @Cordova() - static createEventInteractivelyWithOptions(title, location, notes, startDate, endDate, options) {} + static createEventInteractivelyWithOptions( + title?:string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + options?: CalendarOptions + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } - @Cordova() - static createEventInNamedCalendar(title, location, notes, startDate, endDate, calendarName) {} + // deprecated + // @Cordova() + // static createEventInNamedCalendar( + // title?: string, + // location?: string, + // notes?: string, + // startDate?: Date, + // endDate?: Date, + // calendarName?: string + // ) {} + /** + * Find an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ @Cordova() - static findEvent(title, location, notes, startDate, endDate) {} + static findEvent( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Find an event with additional options. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise that resolves with the event, or rejects with an error. + */ @Cordova() - static listEventsInRange(startDate:any, endDate:any) {} + static findEventWithOptions( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + options?: CalendarOptions + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Find a list of events within the specified date range. (Android only) + * + * @param {Date} [startDate] The start date + * @param {Date} [endDate] The end date + * @return Returns a Promise that resolves with the list of events, or rejects with an error. + */ @Cordova() - static listCalendars(){} + static listEventsInRange(startDate: Date, endDate: Date) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Get a list of all calendars. + * @return A Promise that resolves with the list of calendars, or rejects with an error. + */ @Cordova() - static findAllEventsInNamedCalendar(calendarName:string) {} + static listCalendars(){ + return new Promise((res, rej) => {}); + } + /** + * Get a list of all future events in the specified calendar. (iOS only) + * @return Returns a Promise that resolves with the list of events, or rejects with an error. + */ @Cordova() - static modifyEvent(title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) {} + static findAllEventsInNamedCalendar(calendarName: string) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Modify an event. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} [newTitle] The new event title + * @param {string} [newLocation] The new event location + * @param {string} [newNotes] The new event notes + * @param {Date} [newStartDate] The new event start date + * @param {Date} [newEndDate] The new event end date + * @return Returns a Promise + */ @Cordova() - static modifyEventWithOptions(title, location, notes, startDate, endDate, newTitle, newEventLocation, newNotes, newStartDate, newEndDate, options) {} + static modifyEvent( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + newTitle?: string, + newLocation?: string, + newNotes?: string, + newStartDate?: Date, + newEndDate?: Date + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } - @Cordova() - static deleteEvent(title, location, notes, startDate, endDate) {} + /** + * Modify an event with additional options. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} [newTitle] The new event title + * @param {string} [newLocation] The new event location + * @param {string} [newNotes] The new event notes + * @param {Date} [newStartDate] The new event start date + * @param {Date} [newEndDate] The new event end date + * @param {CalendarOptions} [options] Additional options, see `getCalendarOptions` + * @return Returns a Promise + */ + @Cordova() + static modifyEventWithOptions( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + newTitle?: string, + newLocation?: string, + newNotes?: string, + newStartDate?: Date, + newEndDate?: Date, + options?: CalendarOptions + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Delete an event. + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @return Returns a Promise + */ @Cordova() - static deleteEventFromNamedCalendar(title, location, notes, startDate, endDate, calendarName) {} + static deleteEvent( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + /** + * Delete an event from the specified Calendar. (iOS only) + * + * @param {string} [title] The event title + * @param {string} [location] The event location + * @param {string} [notes] The event notes + * @param {Date} [startDate] The event start date + * @param {Date} [endDate] The event end date + * @param {string} calendarName + * @return Returns a Promise + */ + @Cordova() + static deleteEventFromNamedCalendar( + title?: string, + location?: string, + notes?: string, + startDate?: Date, + endDate?: Date, + calendarName?: string + ) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } + + /** + * Open the calendar at the specified date. + * @return {Date} date + */ @Cordova() - static openCalendar(date) {} + static openCalendar(date: Date) { + // This Promise is replaced by one from the @Cordova decorator that wraps + // the plugin's callbacks. We provide a dummy one here so TypeScript + // knows that the correct return type is Promise, because there's no way + // for it to know the return type from a decorator. + // See https://github.com/Microsoft/TypeScript/issues/4881 + return new Promise((res, rej) => {}); + } }