docs(calendar): enhance docs and display interface

This commit is contained in:
Ibby 2016-12-06 08:57:53 -05:00
parent d02688971d
commit 2f9c5e6674

View File

@ -5,22 +5,49 @@ import { Cordova, Plugin } from './plugin';
*/ */
export interface CalendarOptions { export interface CalendarOptions {
/**
* Id
*/
id?: string; id?: string;
/**
*
*/
firstReminderMinutes?: number; firstReminderMinutes?: number;
/**
*
*/
secondReminderMinutes?: number; secondReminderMinutes?: number;
recurrence?: string; // options are: 'daily', 'weekly', 'monthly', 'yearly' /**
* Recurrence. Can be set to `daily`, `weekly`, `monthly` or `yearly`
*/
recurrence?: string;
recurrenceInterval?: number; // only used when recurrence is set /**
* Recurrence interval. Valid only when `recurrence` option is set.
*/
recurrenceInterval?: number;
/**
* Recurrence end date. Valid only when `recurrence` option is set.
*/
recurrenceEndDate?: Date; recurrenceEndDate?: Date;
/**
* Calendar name. Ths is supported by `iOS` only.
*/
calendarName?: string; calendarName?: string;
/**
* Calendar id
*/
calendarId?: number; calendarId?: number;
/**
* URL
*/
url?: string; url?: string;
} }
@ -44,7 +71,8 @@ export interface CalendarOptions {
* (err) => { console.log(err); } * (err) => { console.log(err); }
* ); * );
* ``` * ```
* * @interfaces
* CalendarOptions
*/ */
@Plugin({ @Plugin({
pluginName: 'Calendar', pluginName: 'Calendar',
@ -111,9 +139,7 @@ export class Calendar {
* @returns {Promise<any>} Returns a Promise * @returns {Promise<any>} Returns a Promise
*/ */
@Cordova() @Cordova()
static createCalendar( static createCalendar(nameOrOptions: string | any): Promise<any> { return; }
nameOrOptions: string | { calendarName: string, calendarColor: string }
): Promise<any> { return; }
/** /**
* Delete a calendar. (iOS only) * Delete a calendar. (iOS only)
@ -126,31 +152,12 @@ export class Calendar {
/** /**
* Returns the default calendar options. * Returns the default calendar options.
* *
* @return Returns an object with the default calendar options: * @return {CalendarOptions} 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
*/ */
@Cordova({ @Cordova({
sync: true sync: true
}) })
static getCalendarOptions(): CalendarOptions { static getCalendarOptions(): CalendarOptions { return; }
return {
firstReminderMinutes: 60,
secondReminderMinutes: null,
recurrence: null,
recurrenceInterval: 1,
recurrenceEndDate: null,
calendarName: null,
calendarId: null,
url: null
};
}
/** /**
* Silently create an event. * Silently create an event.
@ -288,7 +295,9 @@ export class Calendar {
* @param {Date} [endDate] The end date * @param {Date} [endDate] The end date
* @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error. * @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error.
*/ */
@Cordova() @Cordova({
platforms: ['Android']
})
static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; } static listEventsInRange(startDate: Date, endDate: Date): Promise<any> { return; }
/** /**
@ -302,7 +311,9 @@ export class Calendar {
* Get a list of all future events in the specified calendar. (iOS only) * Get a list of all future events in the specified calendar. (iOS only)
* @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error. * @returns {Promise<any>} Returns a Promise that resolves with the list of events, or rejects with an error.
*/ */
@Cordova() @Cordova({
platforms: ['iOS']
})
static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; } static findAllEventsInNamedCalendar(calendarName: string): Promise<any> { return; }
/** /**
@ -320,7 +331,9 @@ export class Calendar {
* @param {Date} [newEndDate] The new event end date * @param {Date} [newEndDate] The new event end date
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova({
platforms: ['iOS']
})
static modifyEvent( static modifyEvent(
title?: string, title?: string,
location?: string, location?: string,
@ -351,7 +364,9 @@ export class Calendar {
* @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions` * @param {CalendarOptions} [newOptions] New event options, see `getCalendarOptions`
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova({
platforms: ['iOS']
})
static modifyEventWithOptions( static modifyEventWithOptions(
title?: string, title?: string,
location?: string, location?: string,
@ -397,7 +412,9 @@ export class Calendar {
* @param {string} calendarName * @param {string} calendarName
* @return Returns a Promise * @return Returns a Promise
*/ */
@Cordova() @Cordova({
platforms: ['iOS']
})
static deleteEventFromNamedCalendar( static deleteEventFromNamedCalendar(
title?: string, title?: string,
location?: string, location?: string,