chore(calendar): update calendar

This commit is contained in:
Tim Lancina 2016-02-08 16:11:40 -06:00
parent 46e5247963
commit 072173308d
4 changed files with 986 additions and 61 deletions

View File

@ -1,19 +1,224 @@
export declare class Calendar { export interface CalendarOptions {
static createCalendar(options: any): void; firstReminderMinutes?: number;
static deleteCalendar(calendarName: string): void; secondReminderMinutes?: number;
static getCalendarOptions(): void; recurrence?: string;
static createEvent(title: any, location: any, notes: any, startDate: any, endDate: any): void; recurrenceInterval?: number;
static createEventWithOptions(title: any, location: any, notes: any, startDate: any, endDate: any, options: any): void; recurrenceEndDate?: Date;
static createEventInteractively(title: any, location: any, notes: any, startDate: any, endDate: any): void; calendarName?: string;
static createEventInteractivelyWithOptions(title: any, location: any, notes: any, startDate: any, endDate: any, options: any): void; calendarId?: number;
static createEventInNamedCalendar(title: any, location: any, notes: any, startDate: any, endDate: any, calendarName: any): void; url?: string;
static findEvent(title: any, location: any, notes: any, startDate: any, endDate: any): void; }
static listEventsInRange(startDate: any, endDate: any): void; export interface Calendar {
static listCalendars(): void; id: number;
static findAllEventsInNamedCalendar(calendarName: string): void; name: string;
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; * This plugin allows you to add events to the Calendar of the mobile device.
static deleteEventFromNamedCalendar(title: any, location: any, notes: any, startDate: any, endDate: any, calendarName: any): void; *
static openCalendar(date: any): void; * 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error.
*/
static listCalendars(): Promise<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* 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<any>;
/**
* Open the calendar at the specified date.
* @return {Date} date
*/
static openCalendar(date: Date): Promise<any>;
} }

View File

@ -5,35 +5,348 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
return c > 3 && r && Object.defineProperty(target, key, r), r; return c > 3 && r && Object.defineProperty(target, key, r), r;
}; };
var plugin_1 = require('./plugin'); 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 () { var Calendar = (function () {
function Calendar() { function Calendar() {
} }
Calendar.createCalendar = function (options) { }; /**
Calendar.deleteCalendar = function (calendarName) { }; * Create a calendar. (iOS only)
Calendar.getCalendarOptions = function () { }; *
Calendar.createEvent = function (title, location, notes, startDate, endDate) { }; * @usage
Calendar.createEventWithOptions = function (title, location, notes, startDate, endDate, options) { }; * ```
Calendar.createEventInteractively = function (title, location, notes, startDate, endDate) { }; * Calendar.createCalendar('MyCalendar').then(
Calendar.createEventInteractivelyWithOptions = function (title, location, notes, startDate, endDate, options) { }; * (msg) => { console.log(msg); },
Calendar.createEventInNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { }; * (err) => { console.log(err); }
Calendar.findEvent = function (title, location, notes, startDate, endDate) { }; * );
Calendar.listEventsInRange = function (startDate, endDate) { }; * ```
Calendar.listCalendars = function () { }; *
Calendar.findAllEventsInNamedCalendar = function (calendarName) { }; * @param {string | Object} nameOrOptions either a string name or a options object.
Calendar.modifyEvent = function (title, location, notes, startDate, endDate, newTitle, newLocation, newNotes, newStartDate, newEndDate) { }; * options:
Calendar.modifyEventWithOptions = function (title, location, notes, startDate, endDate, newTitle, newEventLocation, newNotes, newStartDate, newEndDate, options) { }; * calendarName: string the name of the calendar
Calendar.deleteEvent = function (title, location, notes, startDate, endDate) { }; * calendarColor: string the hex color of the calendar
Calendar.deleteEventFromNamedCalendar = function (title, location, notes, startDate, endDate, calendarName) { }; * @return Returns a Promise
Calendar.openCalendar = function (date) { }; */
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([ __decorate([
plugin_1.Cordova() plugin_1.Cordova()
], Calendar, "createCalendar", null); ], Calendar, "createCalendar", null);
__decorate([ __decorate([
plugin_1.Cordova() plugin_1.Cordova()
], Calendar, "deleteCalendar", null); ], Calendar, "deleteCalendar", null);
__decorate([
plugin_1.Cordova()
], Calendar, "getCalendarOptions", null);
__decorate([ __decorate([
plugin_1.Cordova() plugin_1.Cordova()
], Calendar, "createEvent", null); ], Calendar, "createEvent", null);
@ -48,10 +361,10 @@ var Calendar = (function () {
], Calendar, "createEventInteractivelyWithOptions", null); ], Calendar, "createEventInteractivelyWithOptions", null);
__decorate([ __decorate([
plugin_1.Cordova() plugin_1.Cordova()
], Calendar, "createEventInNamedCalendar", null); ], Calendar, "findEvent", null);
__decorate([ __decorate([
plugin_1.Cordova() plugin_1.Cordova()
], Calendar, "findEvent", null); ], Calendar, "findEventWithOptions", null);
__decorate([ __decorate([
plugin_1.Cordova() plugin_1.Cordova()
], Calendar, "listEventsInRange", null); ], Calendar, "listEventsInRange", null);

File diff suppressed because one or more lines are too long

View File

@ -1,59 +1,466 @@
import {Plugin, Cordova} from './plugin'; 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({ @Plugin({
name: 'Calendar', name: 'Calendar',
plugin: 'cordova-plugin-calendar', plugin: 'cordova-plugin-calendar',
pluginRef: 'plugins.calendar' pluginRef: 'plugins.calendar'
}) })
export class 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() @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<any>((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() @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<any>((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() @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<any>((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() @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<any>((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() @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<any>((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() @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<any>((res, rej) => {});
}
@Cordova() // deprecated
static createEventInNamedCalendar(title, location, notes, startDate, endDate, calendarName) {} // @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() @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<any>((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() @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<any>((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() @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<any>((res, rej) => {});
}
/**
* Get a list of all calendars.
* @return A Promise that resolves with the list of calendars, or rejects with an error.
*/
@Cordova() @Cordova()
static findAllEventsInNamedCalendar(calendarName:string) {} static listCalendars(){
return new Promise<any>((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() @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<any>((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() @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<any>((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<any>((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() @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<any>((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<any>((res, rej) => {});
}
/**
* Open the calendar at the specified date.
* @return {Date} date
*/
@Cordova() @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<any>((res, rej) => {});
}
} }