@ebarooni/capacitor-calendar 6.4.1 → 6.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +53 -5
- package/android/build.gradle +2 -2
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendar.kt +200 -117
- package/android/src/main/java/dev/barooni/capacitor/calendar/CapacitorCalendarPlugin.kt +85 -3
- package/assets/images/text-logo.png +0 -0
- package/dist/docs.json +467 -70
- package/dist/esm/definitions.d.ts +205 -57
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/index.d.ts +18 -14
- package/dist/esm/index.js +12 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schemas/enums/calendar-source-type.d.ts +38 -0
- package/dist/esm/schemas/enums/calendar-source-type.js +40 -0
- package/dist/esm/schemas/enums/calendar-source-type.js.map +1 -0
- package/dist/esm/schemas/enums/calendar-type.d.ts +28 -0
- package/dist/esm/schemas/enums/calendar-type.js +30 -0
- package/dist/esm/schemas/enums/calendar-type.js.map +1 -0
- package/dist/esm/schemas/enums/event-span.d.ts +16 -0
- package/dist/esm/schemas/enums/event-span.js +18 -0
- package/dist/esm/schemas/enums/event-span.js.map +1 -0
- package/dist/esm/schemas/interfaces/calendar-event.d.ts +14 -3
- package/dist/esm/schemas/interfaces/calendar-event.js.map +1 -1
- package/dist/esm/schemas/interfaces/calendar-source.d.ts +15 -0
- package/dist/esm/schemas/interfaces/calendar-source.js +2 -0
- package/dist/esm/schemas/interfaces/calendar-source.js.map +1 -0
- package/dist/esm/schemas/interfaces/calendar.d.ts +43 -2
- package/dist/esm/schemas/interfaces/calendar.js.map +1 -1
- package/dist/esm/web.d.ts +55 -11
- package/dist/esm/web.js +13 -2
- package/dist/esm/web.js.map +1 -1
- package/dist/plugin.cjs.js +101 -2
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +101 -2
- package/dist/plugin.js.map +1 -1
- package/ios/Plugin/CapacitorCalendar.swift +238 -21
- package/ios/Plugin/CapacitorCalendarPlugin.m +4 -0
- package/ios/Plugin/CapacitorCalendarPlugin.swift +141 -15
- package/ios/Plugin/CapacitorReminders.swift +62 -8
- package/ios/Plugin/EventCreationParameters.swift +5 -2
- package/package.json +28 -18
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import { CalendarChooserDisplayStyle } from
|
|
2
|
-
import { CalendarChooserSelectionStyle } from
|
|
3
|
-
import { PluginPermission } from
|
|
4
|
-
import
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
1
|
+
import { CalendarChooserDisplayStyle } from "./schemas/enums/calendar-chooser-display-style";
|
|
2
|
+
import { CalendarChooserSelectionStyle } from "./schemas/enums/calendar-chooser-selection-style";
|
|
3
|
+
import { PluginPermission } from "./schemas/enums/plugin-permission";
|
|
4
|
+
import { EventSpan } from "./schemas/enums/event-span";
|
|
5
|
+
import type { PermissionState } from "@capacitor/core";
|
|
6
|
+
import type { Calendar } from "./schemas/interfaces/calendar";
|
|
7
|
+
import type { RemindersList } from "./schemas/interfaces/reminders-list";
|
|
8
|
+
import type { PluginPermissionsMap } from "./schemas/interfaces/plugin-permissions-map";
|
|
9
|
+
import type { ReminderRecurrenceRule } from "./schemas/interfaces/reminder-recurrence-rule";
|
|
10
|
+
import type { CalendarEvent } from "./schemas/interfaces/calendar-event";
|
|
11
|
+
import type { Reminder } from "./schemas/interfaces/reminder";
|
|
12
|
+
import type { CalendarSource } from "./schemas/interfaces/calendar-source";
|
|
11
13
|
export interface CapacitorCalendarPlugin {
|
|
12
14
|
/**
|
|
13
15
|
* Checks the current authorization status of a specific permission.
|
|
14
16
|
*
|
|
15
|
-
* @
|
|
17
|
+
* @async
|
|
16
18
|
* @since 0.1.0
|
|
17
19
|
* @platform iOS, Android
|
|
18
20
|
* @param options An object with the name of the permission
|
|
@@ -28,7 +30,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
28
30
|
/**
|
|
29
31
|
* Checks the current authorization status of all the required permissions for the plugin.
|
|
30
32
|
*
|
|
31
|
-
* @
|
|
33
|
+
* @async
|
|
32
34
|
* @since 0.1.0
|
|
33
35
|
* @platform iOS, Android
|
|
34
36
|
* @returns {Promise<PluginPermissionsMap>} A promise that resolves with an object containing all the permissions and their status.
|
|
@@ -40,7 +42,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
40
42
|
* Requests authorization to a specific permission, if not already granted.
|
|
41
43
|
* If the permission is already granted, it will directly return the status.
|
|
42
44
|
*
|
|
43
|
-
* @
|
|
45
|
+
* @async
|
|
44
46
|
* @since 0.1.0
|
|
45
47
|
* @platform iOS, Android
|
|
46
48
|
* @param options An object with the name of the permission
|
|
@@ -56,7 +58,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
56
58
|
/**
|
|
57
59
|
* Requests authorization to all the required permissions for the plugin, if they have not already been granted.
|
|
58
60
|
*
|
|
59
|
-
* @
|
|
61
|
+
* @async
|
|
60
62
|
* @since 0.1.0
|
|
61
63
|
* @platform iOS, Android
|
|
62
64
|
* @returns {Promise<PluginPermissionsMap>} A promise that resolves with the new permission statuses after the request is made.
|
|
@@ -68,7 +70,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
68
70
|
* Creates an event in the calendar by using the native calendar.
|
|
69
71
|
* On iOS opens a native sheet and on Android opens an intent.
|
|
70
72
|
*
|
|
71
|
-
* @
|
|
73
|
+
* @async
|
|
72
74
|
* @since 0.1.0
|
|
73
75
|
* @platform iOS, Android
|
|
74
76
|
* @permissions
|
|
@@ -76,28 +78,35 @@ export interface CapacitorCalendarPlugin {
|
|
|
76
78
|
* <ul>
|
|
77
79
|
* <li><strong>Android:</strong> readCalendar</li>
|
|
78
80
|
* </ul>
|
|
79
|
-
* @param {object} options
|
|
80
|
-
* @param {string} options.title
|
|
81
|
-
* @param {string} options.calendarId
|
|
82
|
-
* @param {string} [options.location]
|
|
83
|
-
* @param {number} [options.startDate]
|
|
84
|
-
* @param {number} [options.endDate]
|
|
85
|
-
* @param {boolean} [options.isAllDay]
|
|
86
|
-
* @param {number} [options.alertOffsetInMinutes]
|
|
87
|
-
* an
|
|
88
|
-
*
|
|
81
|
+
* @param {object} options Options for creating the event.
|
|
82
|
+
* @param {string} options.title The title of the event.
|
|
83
|
+
* @param {string} options.calendarId The id of the destination calendar. (Optional)
|
|
84
|
+
* @param {string} [options.location] The location of the event. (Optional)
|
|
85
|
+
* @param {number} [options.startDate] The start date and time of the event. (Optional)
|
|
86
|
+
* @param {number} [options.endDate] The end date and time of the event. (Optional)
|
|
87
|
+
* @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)
|
|
88
|
+
* @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many
|
|
89
|
+
* minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.
|
|
90
|
+
* On iOS only the first two valid elements of the array are taken into account.
|
|
91
|
+
* The parameter is not supported on Android. Negative values are ignored. (Optional)
|
|
92
|
+
* @param {string} [options.url] The URL of the event. (Optional)
|
|
93
|
+
* @param {string} [options.notes] The notes of the event. (Optional)
|
|
89
94
|
* @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.
|
|
90
95
|
* @example
|
|
91
96
|
* if (capacitor.getPlatform() === 'android') {
|
|
92
97
|
* await this.requestPermission({ alias: 'readCalendar' });
|
|
93
98
|
* { result } = result = await this.createEventWithPrompt({
|
|
94
99
|
* title: 'Title',
|
|
95
|
-
* alertOffsetInMinutes: 5,
|
|
100
|
+
* alertOffsetInMinutes: [5, 30],
|
|
101
|
+
* url: 'https://capacitor-calendar.pages.dev',
|
|
102
|
+
* notes: 'A CapacitorJS plugin',
|
|
96
103
|
* });
|
|
97
104
|
* } else {
|
|
98
105
|
* { result } = result = await this.createEventWithPrompt({
|
|
99
106
|
* title: 'Title',
|
|
100
|
-
* alertOffsetInMinutes:
|
|
107
|
+
* alertOffsetInMinutes: [0, 1440],
|
|
108
|
+
* url: 'https://capacitor-calendar.pages.dev',
|
|
109
|
+
* notes: 'A CapacitorJS plugin'
|
|
101
110
|
* });
|
|
102
111
|
* }
|
|
103
112
|
*/
|
|
@@ -108,14 +117,16 @@ export interface CapacitorCalendarPlugin {
|
|
|
108
117
|
startDate?: number;
|
|
109
118
|
endDate?: number;
|
|
110
119
|
isAllDay?: boolean;
|
|
111
|
-
alertOffsetInMinutes?: number;
|
|
120
|
+
alertOffsetInMinutes?: number | number[];
|
|
121
|
+
url?: string;
|
|
122
|
+
notes?: string;
|
|
112
123
|
}): Promise<{
|
|
113
124
|
result: string[];
|
|
114
125
|
}>;
|
|
115
126
|
/**
|
|
116
127
|
* Presents a prompt to the user to select calendars. This method is available only on iOS.
|
|
117
128
|
*
|
|
118
|
-
* @
|
|
129
|
+
* @async
|
|
119
130
|
* @since 0.2.0
|
|
120
131
|
* @platform iOS
|
|
121
132
|
* @permissions
|
|
@@ -144,7 +155,6 @@ export interface CapacitorCalendarPlugin {
|
|
|
144
155
|
* Retrieves a list of calendars available on the device.
|
|
145
156
|
*
|
|
146
157
|
* @async
|
|
147
|
-
* @method listCalendars
|
|
148
158
|
* @platform iOS, Android
|
|
149
159
|
* @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.
|
|
150
160
|
* Each calendar object in the array contains an ID and a title.
|
|
@@ -158,7 +168,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
158
168
|
/**
|
|
159
169
|
* Retrieves the default calendar set on the device.
|
|
160
170
|
*
|
|
161
|
-
* @
|
|
171
|
+
* @async
|
|
162
172
|
* @since 0.3.0
|
|
163
173
|
* @platform iOS, Android
|
|
164
174
|
* @permissions
|
|
@@ -179,7 +189,8 @@ export interface CapacitorCalendarPlugin {
|
|
|
179
189
|
/**
|
|
180
190
|
* Creates an event with the provided options.
|
|
181
191
|
*
|
|
182
|
-
* @
|
|
192
|
+
* @async
|
|
193
|
+
* @since 0.4.0
|
|
183
194
|
* @platform iOS, Android
|
|
184
195
|
* @permissions
|
|
185
196
|
* <h3>Runtime Permissions:</h3>
|
|
@@ -187,15 +198,19 @@ export interface CapacitorCalendarPlugin {
|
|
|
187
198
|
* <li><strong>iOS:</strong> writeCalendar</li>
|
|
188
199
|
* <li><strong>Android:</strong> readCalendar, writeCalendar</li>
|
|
189
200
|
* </ul>
|
|
190
|
-
* @param {object} options
|
|
191
|
-
* @param {string} options.title
|
|
192
|
-
* @param {string} options.calendarId
|
|
193
|
-
* @param {string} [options.location]
|
|
194
|
-
* @param {number} [options.startDate]
|
|
195
|
-
* @param {number} [options.endDate]
|
|
196
|
-
* @param {boolean} [options.isAllDay]
|
|
197
|
-
* @param {number} [options.alertOffsetInMinutes]
|
|
198
|
-
* minutes *before* the event.
|
|
201
|
+
* @param {object} options Options for creating the event.
|
|
202
|
+
* @param {string} options.title The title of the event.
|
|
203
|
+
* @param {string} options.calendarId The id of the destination calendar. (Optional)
|
|
204
|
+
* @param {string} [options.location] The location of the event. (Optional)
|
|
205
|
+
* @param {number} [options.startDate] The start date and time of the event. (Optional)
|
|
206
|
+
* @param {number} [options.endDate] The end date and time of the event. (Optional)
|
|
207
|
+
* @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)
|
|
208
|
+
* @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many
|
|
209
|
+
* minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.
|
|
210
|
+
* On iOS only the first two valid elements of the array are taken into account.
|
|
211
|
+
* Negative values are ignored. (Optional)
|
|
212
|
+
* @param {string} [options.url] The URL of the event. (Optional)
|
|
213
|
+
* @param {string} [options.notes] The notes of the event. (Optional)
|
|
199
214
|
* @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.
|
|
200
215
|
* @example
|
|
201
216
|
* const now = Date.now();
|
|
@@ -206,6 +221,8 @@ export interface CapacitorCalendarPlugin {
|
|
|
206
221
|
* endDate: now + 2 * 60 * 60 * 1000,
|
|
207
222
|
* isAllDay: false,
|
|
208
223
|
* alertOffsetInMinutes: 5,
|
|
224
|
+
* url: 'https://capacitor-calendar.pages.dev',
|
|
225
|
+
* notes: 'A CapacitorJS plugin'
|
|
209
226
|
* };
|
|
210
227
|
* const { result } = await createEvent(eventOptions);
|
|
211
228
|
*/
|
|
@@ -216,14 +233,16 @@ export interface CapacitorCalendarPlugin {
|
|
|
216
233
|
startDate?: number;
|
|
217
234
|
endDate?: number;
|
|
218
235
|
isAllDay?: boolean;
|
|
219
|
-
alertOffsetInMinutes?: number;
|
|
236
|
+
alertOffsetInMinutes?: number | number[];
|
|
237
|
+
url?: string;
|
|
238
|
+
notes?: string;
|
|
220
239
|
}): Promise<{
|
|
221
240
|
result: string;
|
|
222
241
|
}>;
|
|
223
242
|
/**
|
|
224
243
|
* Retrieves the default reminders list set on the device.
|
|
225
244
|
*
|
|
226
|
-
* @
|
|
245
|
+
* @async
|
|
227
246
|
* @platform iOS
|
|
228
247
|
* @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.
|
|
229
248
|
* The returned reminders list object contains an ID and a title.
|
|
@@ -238,7 +257,6 @@ export interface CapacitorCalendarPlugin {
|
|
|
238
257
|
* Retrieves all available reminders lists on the device.
|
|
239
258
|
*
|
|
240
259
|
* @async
|
|
241
|
-
* @method getRemindersLists
|
|
242
260
|
* @platform iOS
|
|
243
261
|
* @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.
|
|
244
262
|
* Each reminders list object in the array contains an ID and a title.
|
|
@@ -252,7 +270,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
252
270
|
/**
|
|
253
271
|
* Creates a reminder with the provided options.
|
|
254
272
|
*
|
|
255
|
-
* @
|
|
273
|
+
* @async
|
|
256
274
|
* @since 0.5.0
|
|
257
275
|
* @platform iOS
|
|
258
276
|
* @permissions
|
|
@@ -315,7 +333,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
315
333
|
* Opens the calendar app. Since the user leaves your app, use this method with caution.
|
|
316
334
|
* It will open the calendar on today's date if no date is provided.
|
|
317
335
|
*
|
|
318
|
-
* @
|
|
336
|
+
* @async
|
|
319
337
|
* @platform iOS, Android
|
|
320
338
|
* @param {object} options - Options for opening the calendar.
|
|
321
339
|
* @param {number} options.date - The date at which the calendar should be opened. (Optional)
|
|
@@ -329,7 +347,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
329
347
|
/**
|
|
330
348
|
* Opens the reminders app. Since the user leaves your app, use this method with caution.
|
|
331
349
|
*
|
|
332
|
-
* @
|
|
350
|
+
* @async
|
|
333
351
|
* @platform iOS
|
|
334
352
|
* @returns {Promise<void>}
|
|
335
353
|
* @example
|
|
@@ -339,7 +357,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
339
357
|
/**
|
|
340
358
|
* Retrieves the list of calendar events present in the given date range.
|
|
341
359
|
*
|
|
342
|
-
* @
|
|
360
|
+
* @async
|
|
343
361
|
* @since 0.10.0
|
|
344
362
|
* @platform iOS, Android
|
|
345
363
|
* @permissions
|
|
@@ -367,7 +385,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
367
385
|
/**
|
|
368
386
|
* Deletes events from the calendar given their IDs.
|
|
369
387
|
*
|
|
370
|
-
* @
|
|
388
|
+
* @async
|
|
371
389
|
* @since 0.11.0
|
|
372
390
|
* @platform iOS, Android
|
|
373
391
|
* @permissions
|
|
@@ -399,7 +417,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
399
417
|
/**
|
|
400
418
|
* Creates a calendar
|
|
401
419
|
*
|
|
402
|
-
* @
|
|
420
|
+
* @async
|
|
403
421
|
* @since 5.2.0
|
|
404
422
|
* @platform iOS
|
|
405
423
|
* @permissions
|
|
@@ -411,24 +429,30 @@ export interface CapacitorCalendarPlugin {
|
|
|
411
429
|
* @param {string} options.title The title of the calendar to create.
|
|
412
430
|
* @param {string} options.color The color of the calendar to create.
|
|
413
431
|
* The color should be a HEX string. (Optional)
|
|
432
|
+
* @param {string} options.sourceId The id of the source of the calendar.
|
|
433
|
+
* If not provided, the source of the default calendar will be used. It is
|
|
434
|
+
* recommended to use fetchAllCalendarSources method to fetch the id of the
|
|
435
|
+
* desired source type.
|
|
414
436
|
* @returns {Promise<{ result: string }>} The id of the created calendar.
|
|
415
437
|
* @example
|
|
416
438
|
* { result } = await CapacitorCalendar.createCalendar({
|
|
417
439
|
* title: 'New Calendar',
|
|
418
440
|
* color: '#1d00fc',
|
|
441
|
+
* sourceId: 'local-source-id',
|
|
419
442
|
* });
|
|
420
443
|
* console.log(result); // 'CALENDAR_ID'
|
|
421
444
|
*/
|
|
422
445
|
createCalendar(options: {
|
|
423
446
|
title: string;
|
|
424
447
|
color?: string;
|
|
448
|
+
sourceId?: string;
|
|
425
449
|
}): Promise<{
|
|
426
450
|
result: string;
|
|
427
451
|
}>;
|
|
428
452
|
/**
|
|
429
453
|
* Deletes a calendar by id
|
|
430
454
|
*
|
|
431
|
-
* @
|
|
455
|
+
* @async
|
|
432
456
|
* @since 5.2.0
|
|
433
457
|
* @platform iOS
|
|
434
458
|
* @permissions
|
|
@@ -447,7 +471,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
447
471
|
/**
|
|
448
472
|
* Retrieves the list of reminders present in the given date range.
|
|
449
473
|
*
|
|
450
|
-
* @
|
|
474
|
+
* @async
|
|
451
475
|
* @since 5.3.0
|
|
452
476
|
* @platform iOS
|
|
453
477
|
* @permissions
|
|
@@ -473,7 +497,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
473
497
|
/**
|
|
474
498
|
* Deletes reminders given their IDs.
|
|
475
499
|
*
|
|
476
|
-
* @
|
|
500
|
+
* @async
|
|
477
501
|
* @since 5.3.0
|
|
478
502
|
* @platform iOS
|
|
479
503
|
* @permissions
|
|
@@ -504,7 +528,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
504
528
|
/**
|
|
505
529
|
* Requests write access for the calendar. If its already granted, it will directly return the state.
|
|
506
530
|
*
|
|
507
|
-
* @
|
|
531
|
+
* @async
|
|
508
532
|
* @since 5.4.0
|
|
509
533
|
* @platform iOS, Android
|
|
510
534
|
* @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the write access permission.
|
|
@@ -517,7 +541,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
517
541
|
/**
|
|
518
542
|
* Requests read access for the calendar. If its already granted, it will directly return the state.
|
|
519
543
|
*
|
|
520
|
-
* @
|
|
544
|
+
* @async
|
|
521
545
|
* @since 5.4.0
|
|
522
546
|
* @platform Android
|
|
523
547
|
* @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the read access permission.
|
|
@@ -530,7 +554,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
530
554
|
/**
|
|
531
555
|
* Requests read and write access for the calendar. If its already granted, it will directly return the state.
|
|
532
556
|
*
|
|
533
|
-
* @
|
|
557
|
+
* @async
|
|
534
558
|
* @since 5.4.0
|
|
535
559
|
* @platform iOS, Android
|
|
536
560
|
* @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.
|
|
@@ -543,7 +567,7 @@ export interface CapacitorCalendarPlugin {
|
|
|
543
567
|
/**
|
|
544
568
|
* Requests read and write access for the reminders. If its already granted, it will directly return the state.
|
|
545
569
|
*
|
|
546
|
-
* @
|
|
570
|
+
* @async
|
|
547
571
|
* @since 5.4.0
|
|
548
572
|
* @platform iOS
|
|
549
573
|
* @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.
|
|
@@ -553,4 +577,128 @@ export interface CapacitorCalendarPlugin {
|
|
|
553
577
|
requestFullRemindersAccess(): Promise<{
|
|
554
578
|
result: PermissionState;
|
|
555
579
|
}>;
|
|
580
|
+
/**
|
|
581
|
+
* Opens a native prompt to modify an event given its id.
|
|
582
|
+
*
|
|
583
|
+
* @async
|
|
584
|
+
* @since 5.6.0
|
|
585
|
+
* @platform iOS, Android
|
|
586
|
+
* @permissions
|
|
587
|
+
* <h3>Runtime Permissions:</h3>
|
|
588
|
+
* <ul>
|
|
589
|
+
* <li><strong>iOS:</strong> writeCalendar, readCalendar</li>
|
|
590
|
+
* <li><strong>Android:</strong> writeCalendar, readCalendar</li>
|
|
591
|
+
* </ul>
|
|
592
|
+
* @param {Object} options The options for modifying an event.
|
|
593
|
+
* @param {string} options.id The id of the event to be modified.
|
|
594
|
+
* @param {object} options.update The set of event properties to be modified. (Optional)
|
|
595
|
+
* If a property is not supported, it will be ignored. Setting alerts with prompt
|
|
596
|
+
* is only supported on iOS.
|
|
597
|
+
* @returns {Promise<{ result: string[] }>} On iOS, the promise resolves with an array containing
|
|
598
|
+
* the initial event id if the modifications were saved and empty if it was cancelled. However, on
|
|
599
|
+
* Android the array will be empty either way.
|
|
600
|
+
* @throws {Error} throws an error if an event for the given id is not found.
|
|
601
|
+
* @example
|
|
602
|
+
* const { result } = await CapacitorCalendar.modifyEventWithPrompt({
|
|
603
|
+
* id: 'EVENT_ID_ONE',
|
|
604
|
+
* update: {
|
|
605
|
+
* title: 'newTitle',
|
|
606
|
+
* startDate: Date.now(),
|
|
607
|
+
* },
|
|
608
|
+
* });
|
|
609
|
+
*
|
|
610
|
+
* console.log(result); // ['EVENT_ID_ONE'] or [] if on Android
|
|
611
|
+
*/
|
|
612
|
+
modifyEventWithPrompt(options: {
|
|
613
|
+
id: string;
|
|
614
|
+
update?: {
|
|
615
|
+
title?: string;
|
|
616
|
+
calendarId?: string;
|
|
617
|
+
location?: string;
|
|
618
|
+
startDate?: number;
|
|
619
|
+
endDate?: number;
|
|
620
|
+
isAllDay?: boolean;
|
|
621
|
+
alertOffsetInMinutes?: number | number[];
|
|
622
|
+
url?: string;
|
|
623
|
+
notes?: string;
|
|
624
|
+
};
|
|
625
|
+
}): Promise<{
|
|
626
|
+
result: string[];
|
|
627
|
+
}>;
|
|
628
|
+
/**
|
|
629
|
+
* Modifies an event given its id and update details.
|
|
630
|
+
*
|
|
631
|
+
* @async
|
|
632
|
+
* @since 5.6.0
|
|
633
|
+
* @platform iOS, Android
|
|
634
|
+
* @permissions
|
|
635
|
+
* <h3>Runtime Permissions:</h3>
|
|
636
|
+
* <ul>
|
|
637
|
+
* <li><strong>iOS:</strong> writeCalendar, readCalendar</li>
|
|
638
|
+
* <li><strong>Android:</strong> writeCalendar, readCalendar</li>
|
|
639
|
+
* </ul>
|
|
640
|
+
* @param {Object} options The options for updating an event.
|
|
641
|
+
* @param {string} options.id The id of the event to be modified.
|
|
642
|
+
* @param {EventSpan} options.span The scope of the modifications.
|
|
643
|
+
* Only supported on iOS. (Optional)
|
|
644
|
+
* @param {Object} options.update The set of event properties to be modified.
|
|
645
|
+
* If a property is not supported, it will be ignored. Modifying the reminder of an
|
|
646
|
+
* event is currently not supported on Android.
|
|
647
|
+
* @returns {Promise<void>} A promise that resolves when the update operation is complete.
|
|
648
|
+
* @throws {Error} throws an error if an event for the given id is not found.
|
|
649
|
+
* @example
|
|
650
|
+
* const { result } = await CapacitorCalendar.modifyEvent({
|
|
651
|
+
* id: 'EVENT_ID_ONE',
|
|
652
|
+
* span: EventSpan.THIS_SPAN,
|
|
653
|
+
* update: {
|
|
654
|
+
* title: 'newTitle',
|
|
655
|
+
* startDate: Date.now(),
|
|
656
|
+
* },
|
|
657
|
+
* });
|
|
658
|
+
*/
|
|
659
|
+
modifyEvent(options: {
|
|
660
|
+
id: string;
|
|
661
|
+
span?: EventSpan;
|
|
662
|
+
update: {
|
|
663
|
+
title?: string;
|
|
664
|
+
calendarId?: string;
|
|
665
|
+
location?: string;
|
|
666
|
+
startDate?: number;
|
|
667
|
+
endDate?: number;
|
|
668
|
+
isAllDay?: boolean;
|
|
669
|
+
alertOffsetInMinutes?: number | number[];
|
|
670
|
+
url?: string;
|
|
671
|
+
notes?: string;
|
|
672
|
+
};
|
|
673
|
+
}): Promise<void>;
|
|
674
|
+
/**
|
|
675
|
+
* Retrieves a list of calendar sources.
|
|
676
|
+
*
|
|
677
|
+
* @async
|
|
678
|
+
* @since 6.6.0
|
|
679
|
+
* @platform iOS
|
|
680
|
+
* @returns {Promise<{ result: CalendarSource[] }>} A promise that resolves with an array of
|
|
681
|
+
* calendar sources.
|
|
682
|
+
* @example
|
|
683
|
+
* const { result } = await fetchAllCalendarSources();
|
|
684
|
+
* console.log(result); // [{ id: '1', type: '0', title: 'calDav' }, { id: '2', type: '2', title: '3' }]
|
|
685
|
+
*/
|
|
686
|
+
fetchAllCalendarSources(): Promise<{
|
|
687
|
+
result: CalendarSource[];
|
|
688
|
+
}>;
|
|
689
|
+
/**
|
|
690
|
+
* Retrieves a list of reminders sources.
|
|
691
|
+
*
|
|
692
|
+
* @async
|
|
693
|
+
* @since 6.6.0
|
|
694
|
+
* @platform iOS
|
|
695
|
+
* @returns {Promise<{ result: CalendarSource[] }>} A promise that resolves with an array of
|
|
696
|
+
* reminders sources.
|
|
697
|
+
* @example
|
|
698
|
+
* const { result } = await fetchAllRemindersSources();
|
|
699
|
+
* console.log(result); // [{ id: '1', type: '0', title: 'calDav' }, { id: '2', type: '2', title: '3' }]
|
|
700
|
+
*/
|
|
701
|
+
fetchAllRemindersSources(): Promise<{
|
|
702
|
+
result: CalendarSource[];
|
|
703
|
+
}>;
|
|
556
704
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CalendarChooserDisplayStyle } from './schemas/enums/calendar-chooser-display-style';\nimport { CalendarChooserSelectionStyle } from './schemas/enums/calendar-chooser-selection-style';\nimport { PluginPermission } from './schemas/enums/plugin-permission';\nimport type { PermissionState } from '@capacitor/core';\nimport type { Calendar } from './schemas/interfaces/calendar';\nimport type { RemindersList } from './schemas/interfaces/reminders-list';\nimport type { PluginPermissionsMap } from './schemas/interfaces/plugin-permissions-map';\nimport type { ReminderRecurrenceRule } from './schemas/interfaces/reminder-recurrence-rule';\nimport type { CalendarEvent } from './schemas/interfaces/calendar-event';\nimport type { Reminder } from './schemas/interfaces/reminder';\n\nexport interface CapacitorCalendarPlugin {\n /**\n * Checks the current authorization status of a specific permission.\n *\n * @method checkPermission\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the current status of the requested permission.\n * @example\n * const { result } = await this.checkPermission({ alias: 'readCalendar' });\n */\n checkPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Checks the current authorization status of all the required permissions for the plugin.\n *\n * @method checkAllPermissions\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} A promise that resolves with an object containing all the permissions and their status.\n * @example\n * const permissionsStatus = await this.checkAllPermissions();\n */\n checkAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Requests authorization to a specific permission, if not already granted.\n * If the permission is already granted, it will directly return the status.\n *\n * @method requestPermission\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the new permission status after the request is made.\n * @example\n * const { result } = await this.requestPermission({ alias: 'readCalendar' });\n */\n requestPermission(options: { alias: PluginPermission }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests authorization to all the required permissions for the plugin, if they have not already been granted.\n *\n * @method requestAllPermissions\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} A promise that resolves with the new permission statuses after the request is made.\n * @example\n * const permissionResults = await this.requestAllPermissions();\n */\n requestAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Creates an event in the calendar by using the native calendar.\n * On iOS opens a native sheet and on Android opens an intent.\n *\n * @method createEventWithPrompt\n * @since 0.1.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options - Options for creating the event.\n * @param {string} options.title - The title of the event.\n * @param {string} options.calendarId - The id of the destination calendar. (Optional)\n * @param {string} [options.location] - The location of the event. (Optional)\n * @param {number} [options.startDate] - The start date and time of the event. (Optional)\n * @param {number} [options.endDate] - The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] - Ignored on Android. If a number >= 0 is provided,\n * an alert will be set for the event this many minutes *before* the event.\n * Negative values are ignored. (Optional)\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @example\n * if (capacitor.getPlatform() === 'android') {\n * await this.requestPermission({ alias: 'readCalendar' });\n * { result } = result = await this.createEventWithPrompt({\n * title: 'Title',\n * alertOffsetInMinutes: 5,\n * });\n * } else {\n * { result } = result = await this.createEventWithPrompt({\n * title: 'Title',\n * alertOffsetInMinutes: 5,\n * });\n * }\n */\n createEventWithPrompt(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number;\n }): Promise<{ result: string[] }>;\n\n /**\n * Presents a prompt to the user to select calendars. This method is available only on iOS.\n *\n * @method selectCalendarsWithPrompt\n * @since 0.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options - Options for customizing the display and selection styles of the calendar chooser.\n * @param {CalendarChooserDisplayStyle} options.displayStyle - To show all or only writeable calendars.\n * @param {CalendarChooserSelectionStyle} [options.selectionStyle] - To be able to select multiple calendars or only one.\n * @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,\n * where each calendar object contains an ID and a title.\n * @example\n * if (capacitor.getPlatform() === 'ios') {\n * const { result } = await selectCalendarsWithPrompt();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }]\n * }\n */\n selectCalendarsWithPrompt(options: {\n displayStyle: CalendarChooserDisplayStyle;\n selectionStyle: CalendarChooserSelectionStyle;\n }): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves a list of calendars available on the device.\n *\n * @async\n * @method listCalendars\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.\n * Each calendar object in the array contains an ID and a title.\n * @example\n * const { result } = await listCalendars();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }, { id: '2', title: 'Personal Calendar' }]\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves the default calendar set on the device.\n *\n * @method getDefaultCalendar\n * @since 0.3.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @returns {Promise<{ result: Calendar | null }>} A promise that resolves with the default calendar set on the device.\n * The returned calendar object contains an ID and a title. Returns null if there is no default calendar found.\n * @example\n * const { result } = await getDefaultCalendar();\n * console.log(result); // { id: '1', title: 'Default Calendar' }\n */\n getDefaultCalendar(): Promise<{ result: Calendar | null }>;\n\n /**\n * Creates an event with the provided options.\n *\n * @method createEvent\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options - Options for creating the event.\n * @param {string} options.title - The title of the event.\n * @param {string} options.calendarId - The id of the destination calendar. (Optional)\n * @param {string} [options.location] - The location of the event. (Optional)\n * @param {number} [options.startDate] - The start date and time of the event. (Optional)\n * @param {number} [options.endDate] - The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] - Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] - If a number >= 0 is provided, an alert will be set for the event this many\n * minutes *before* the event. Negative values are ignored. (Optional)\n * @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: now,\n * endDate: now + 2 * 60 * 60 * 1000,\n * isAllDay: false,\n * alertOffsetInMinutes: 5,\n * };\n * const { result } = await createEvent(eventOptions);\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number;\n }): Promise<{ result: string }>;\n\n /**\n * Retrieves the default reminders list set on the device.\n *\n * @method getDefaultRemindersList\n * @platform iOS\n * @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.\n * The returned reminders list object contains an ID and a title.\n * @example\n * const { result } = await getDefaultRemindersList();\n * console.log(result); // { id: '1', title: 'Default Reminders List' }\n */\n getDefaultRemindersList(): Promise<{ result: RemindersList }>;\n\n /**\n * Retrieves all available reminders lists on the device.\n *\n * @async\n * @method getRemindersLists\n * @platform iOS\n * @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.\n * Each reminders list object in the array contains an ID and a title.\n * @example\n * const { result } = await getRemindersLists();\n * console.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]\n */\n getRemindersLists(): Promise<{ result: RemindersList[] }>;\n\n /**\n * Creates a reminder with the provided options.\n *\n * @method createReminder\n * @since 0.5.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options - Options for creating the reminder.\n * @param {string} options.title - The title of the reminder.\n * @param {string} options.listId - The id of the destination reminders list. (Optional)\n * @param {number} [options.priority] - The priority of the reminder. A number between one and nine where nine\n * has the least priority and 0 means no priority at all. Values outside of this range will be rounded to the\n * nearest border. (Optional)\n * @param {boolean} [options.isCompleted] - Whether the reminder is completed already or not. (Optional)\n * @param {number} [options.startDate] - The start date of the reminder. (Optional)\n * @param {number} [options.dueDate] - The due date of the reminder. (Optional)\n * @param {number} [options.completionDate] - The date at which the reminder was completed. (Optional)\n * @param {string} [options.notes] - Additional notes about the reminder. (Optional)\n * @param {string} [options.url] - A URL to save under the reminder. (Optional)\n * @param {string} [options.location] - A location to save under the reminder. (Optional)\n * @param {string} [options.recurrence] - The rules for the recurrence of the reminder. (Optional)\n * @returns {Promise<{ result: string }>} A Promise that resolves with the id of the created reminder\n * @example\n * const now = Date.now();\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n * const reminderOptions = {\n * title: 'Buy cucumber',\n * listId: 'ABC12',\n * priority: 5,\n * isCompleted: false,\n * startDateComponents: now,\n * notes: 'Also buy tomatoes',\n * url: 'https://capacitor-calendar.pages.dev/',\n * location: 'My Local Supermarket',\n * recurrence: rules\n * };\n * const { result } = await createReminder(reminderOptions);\n * console.log(result); // 'ID_1'\n */\n createReminder(options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ result: string }>;\n\n /**\n * Opens the calendar app. Since the user leaves your app, use this method with caution.\n * It will open the calendar on today's date if no date is provided.\n *\n * @method openCalendar\n * @platform iOS, Android\n * @param {object} options - Options for opening the calendar.\n * @param {number} options.date - The date at which the calendar should be opened. (Optional)\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openCalendar({ date: Date.now() });\n */\n openCalendar(options: { date?: number }): Promise<void>;\n\n /**\n * Opens the reminders app. Since the user leaves your app, use this method with caution.\n *\n * @method openReminders\n * @platform iOS\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openReminders();\n */\n openReminders(): Promise<void>;\n\n /**\n * Retrieves the list of calendar events present in the given date range.\n *\n * @method listEventsInRange\n * @since 0.10.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * @param {number} options.startDate The start of the date range.\n * @param {number} options.endDate The end of the date range.\n * @returns {Promise<{ result: CalendarEvent[] }>} A Promise that resolves with the list of events.\n * @example\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * startDate: Date.now(),\n * endDate: Date.now() + 6 * 7 * 24 * 60 * 60 * 1000, // 6 weeks from now\n * })\n */\n listEventsInRange(options: { startDate: number; endDate: number }): Promise<{ result: CalendarEvent[] }>;\n\n /**\n * Deletes events from the calendar given their IDs.\n *\n * @method deleteEventsById\n * @since 0.11.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options Options for defining event IDs.\n * @param {number} options.ids An array of event IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * A promise that resolves to an object with two properties:\n * - deleted: string[] - An array of IDs that were successfully deleted.\n * - failed: string[] - An array of IDs that could not be deleted.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteEventsById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteEventsById(options: { ids: string[] }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Creates a calendar\n *\n * @method createCalendar\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for creating a calendar.\n * @param {string} options.title The title of the calendar to create.\n * @param {string} options.color The color of the calendar to create.\n * The color should be a HEX string. (Optional)\n * @returns {Promise<{ result: string }>} The id of the created calendar.\n * @example\n * { result } = await CapacitorCalendar.createCalendar({\n * title: 'New Calendar',\n * color: '#1d00fc',\n * });\n * console.log(result); // 'CALENDAR_ID'\n */\n createCalendar(options: { title: string; color?: string }): Promise<{ result: string }>;\n\n /**\n * Deletes a calendar by id\n *\n * @method deleteCalendar\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for deleting a calendar.\n * @param {string} options.id The id of the calendar to delete.\n * @example\n * await CapacitorCalendar.deleteCalendar({ id: 'ID_1' });\n */\n deleteCalendar(options: { id: string }): Promise<void>;\n\n /**\n * Retrieves the list of reminders present in the given date range.\n *\n * @method getRemindersFromLists\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readReminders</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * It Will fetch all reminders from all available lists if not provided. (Optional)\n * @param {string[]} options.listIds An array of reminder list ids.\n * @returns {Promise<{ result: Reminder[] }>} A Promise that resolves with the list of reminders.\n * @example\n * const now = Date.now();\n * const { result } = await CapacitorCalendar.getRemindersFromLists({\n * listIds: ['LIST_ID_1', 'LIST_ID_2'],\n * });\n */\n getRemindersFromLists(options?: { listIds: string[] }): Promise<{ result: Reminder[] }>;\n\n /**\n * Deletes reminders given their IDs.\n *\n * @method deleteRemindersById\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options Options for defining reminder IDs.\n * @param {number} options.ids An array of reminder IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * A promise that resolves to an object with two properties:\n * - deleted: string[] - An array of IDs that were successfully deleted.\n * - failed: string[] - An array of IDs that could not be deleted.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteRemindersById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteRemindersById(options: { ids: string[] }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Requests write access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestWriteOnlyCalendarAccess\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the write access permission.\n * @example\n * const { result } = await this.requestWriteOnlyCalendarAccess();\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestReadOnlyCalendarAccess\n * @since 5.4.0\n * @platform Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the read access permission.\n * @example\n * const { result } = await this.requestReadOnlyCalendarAccess();\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the calendar. If its already granted, it will directly return the state.\n *\n * @method requestFullCalendarAccess\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullCalendarAccess();\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the reminders. If its already granted, it will directly return the state.\n *\n * @method requestFullRemindersAccess\n * @since 5.4.0\n * @platform iOS\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullRemindersAccess();\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CalendarChooserDisplayStyle } from \"./schemas/enums/calendar-chooser-display-style\";\nimport { CalendarChooserSelectionStyle } from \"./schemas/enums/calendar-chooser-selection-style\";\nimport { PluginPermission } from \"./schemas/enums/plugin-permission\";\nimport { EventSpan } from \"./schemas/enums/event-span\";\nimport type { PermissionState } from \"@capacitor/core\";\nimport type { Calendar } from \"./schemas/interfaces/calendar\";\nimport type { RemindersList } from \"./schemas/interfaces/reminders-list\";\nimport type { PluginPermissionsMap } from \"./schemas/interfaces/plugin-permissions-map\";\nimport type { ReminderRecurrenceRule } from \"./schemas/interfaces/reminder-recurrence-rule\";\nimport type { CalendarEvent } from \"./schemas/interfaces/calendar-event\";\nimport type { Reminder } from \"./schemas/interfaces/reminder\";\nimport type { CalendarSource } from \"./schemas/interfaces/calendar-source\";\n\nexport interface CapacitorCalendarPlugin {\n /**\n * Checks the current authorization status of a specific permission.\n *\n * @async\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the current status of the requested permission.\n * @example\n * const { result } = await this.checkPermission({ alias: 'readCalendar' });\n */\n checkPermission(options: {\n alias: PluginPermission;\n }): Promise<{ result: PermissionState }>;\n\n /**\n * Checks the current authorization status of all the required permissions for the plugin.\n *\n * @async\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} A promise that resolves with an object containing all the permissions and their status.\n * @example\n * const permissionsStatus = await this.checkAllPermissions();\n */\n checkAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Requests authorization to a specific permission, if not already granted.\n * If the permission is already granted, it will directly return the status.\n *\n * @async\n * @since 0.1.0\n * @platform iOS, Android\n * @param options An object with the name of the permission\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the new permission status after the request is made.\n * @example\n * const { result } = await this.requestPermission({ alias: 'readCalendar' });\n */\n requestPermission(options: {\n alias: PluginPermission;\n }): Promise<{ result: PermissionState }>;\n\n /**\n * Requests authorization to all the required permissions for the plugin, if they have not already been granted.\n *\n * @async\n * @since 0.1.0\n * @platform iOS, Android\n * @returns {Promise<PluginPermissionsMap>} A promise that resolves with the new permission statuses after the request is made.\n * @example\n * const permissionResults = await this.requestAllPermissions();\n */\n requestAllPermissions(): Promise<PluginPermissionsMap>;\n\n /**\n * Creates an event in the calendar by using the native calendar.\n * On iOS opens a native sheet and on Android opens an intent.\n *\n * @async\n * @since 0.1.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options Options for creating the event.\n * @param {string} options.title The title of the event.\n * @param {string} options.calendarId The id of the destination calendar. (Optional)\n * @param {string} [options.location] The location of the event. (Optional)\n * @param {number} [options.startDate] The start date and time of the event. (Optional)\n * @param {number} [options.endDate] The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many\n * minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.\n * On iOS only the first two valid elements of the array are taken into account.\n * The parameter is not supported on Android. Negative values are ignored. (Optional)\n * @param {string} [options.url] The URL of the event. (Optional)\n * @param {string} [options.notes] The notes of the event. (Optional)\n * @returns {Promise<{ result: string[] }>} A promise that resolves with an array of the ids of created events.\n * @example\n * if (capacitor.getPlatform() === 'android') {\n * await this.requestPermission({ alias: 'readCalendar' });\n * { result } = result = await this.createEventWithPrompt({\n * title: 'Title',\n * alertOffsetInMinutes: [5, 30],\n * url: 'https://capacitor-calendar.pages.dev',\n * notes: 'A CapacitorJS plugin',\n * });\n * } else {\n * { result } = result = await this.createEventWithPrompt({\n * title: 'Title',\n * alertOffsetInMinutes: [0, 1440],\n * url: 'https://capacitor-calendar.pages.dev',\n * notes: 'A CapacitorJS plugin'\n * });\n * }\n */\n createEventWithPrompt(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n }): Promise<{ result: string[] }>;\n\n /**\n * Presents a prompt to the user to select calendars. This method is available only on iOS.\n *\n * @async\n * @since 0.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options - Options for customizing the display and selection styles of the calendar chooser.\n * @param {CalendarChooserDisplayStyle} options.displayStyle - To show all or only writeable calendars.\n * @param {CalendarChooserSelectionStyle} [options.selectionStyle] - To be able to select multiple calendars or only one.\n * @returns { Promise<{ result: Calendar[] }> } A promise that resolves with an array of selected calendars,\n * where each calendar object contains an ID and a title.\n * @example\n * if (capacitor.getPlatform() === 'ios') {\n * const { result } = await selectCalendarsWithPrompt();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }]\n * }\n */\n selectCalendarsWithPrompt(options: {\n displayStyle: CalendarChooserDisplayStyle;\n selectionStyle: CalendarChooserSelectionStyle;\n }): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves a list of calendars available on the device.\n *\n * @async\n * @platform iOS, Android\n * @returns {Promise<{ result: Calendar[] }>} A promise that resolves with an array of calendars available on the device.\n * Each calendar object in the array contains an ID and a title.\n * @example\n * const { result } = await listCalendars();\n * console.log(result); // [{ id: '1', title: 'Work Calendar' }, { id: '2', title: 'Personal Calendar' }]\n */\n listCalendars(): Promise<{ result: Calendar[] }>;\n\n /**\n * Retrieves the default calendar set on the device.\n *\n * @async\n * @since 0.3.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @returns {Promise<{ result: Calendar | null }>} A promise that resolves with the default calendar set on the device.\n * The returned calendar object contains an ID and a title. Returns null if there is no default calendar found.\n * @example\n * const { result } = await getDefaultCalendar();\n * console.log(result); // { id: '1', title: 'Default Calendar' }\n */\n getDefaultCalendar(): Promise<{ result: Calendar | null }>;\n\n /**\n * Creates an event with the provided options.\n *\n * @async\n * @since 0.4.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for creating the event.\n * @param {string} options.title The title of the event.\n * @param {string} options.calendarId The id of the destination calendar. (Optional)\n * @param {string} [options.location] The location of the event. (Optional)\n * @param {number} [options.startDate] The start date and time of the event. (Optional)\n * @param {number} [options.endDate] The end date and time of the event. (Optional)\n * @param {boolean} [options.isAllDay] Weather the event is for the entire day or not. (Optional)\n * @param {number} [options.alertOffsetInMinutes] If a number >= 0 is provided, an alert will be set for the event this many\n * minutes *before* the event. If an array of number >= 0 are provided, it will add multiple alerts.\n * On iOS only the first two valid elements of the array are taken into account.\n * Negative values are ignored. (Optional)\n * @param {string} [options.url] The URL of the event. (Optional)\n * @param {string} [options.notes] The notes of the event. (Optional)\n * @returns {Promise<{ result: string }>} A promise that resolves with the id of the created event.\n * @example\n * const now = Date.now();\n * const eventOptions = {\n * title: 'Team Meeting',\n * location: 'Conference Room A',\n * startDate: now,\n * endDate: now + 2 * 60 * 60 * 1000,\n * isAllDay: false,\n * alertOffsetInMinutes: 5,\n * url: 'https://capacitor-calendar.pages.dev',\n * notes: 'A CapacitorJS plugin'\n * };\n * const { result } = await createEvent(eventOptions);\n */\n createEvent(options: {\n title: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n }): Promise<{ result: string }>;\n\n /**\n * Retrieves the default reminders list set on the device.\n *\n * @async\n * @platform iOS\n * @returns {Promise<{ result: RemindersList }>} A promise that resolves with the default reminder list set on the device.\n * The returned reminders list object contains an ID and a title.\n * @example\n * const { result } = await getDefaultRemindersList();\n * console.log(result); // { id: '1', title: 'Default Reminders List' }\n */\n getDefaultRemindersList(): Promise<{ result: RemindersList }>;\n\n /**\n * Retrieves all available reminders lists on the device.\n *\n * @async\n * @platform iOS\n * @returns {Promise<{ result: RemindersList[] }>} A promise that resolves with an array of reminders lists available on the device.\n * Each reminders list object in the array contains an ID and a title.\n * @example\n * const { result } = await getRemindersLists();\n * console.log(result); // [{ id: '1', title: 'Groceries' }, { id: '2', title: 'Subscriptions' }]\n */\n getRemindersLists(): Promise<{ result: RemindersList[] }>;\n\n /**\n * Creates a reminder with the provided options.\n *\n * @async\n * @since 0.5.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options - Options for creating the reminder.\n * @param {string} options.title - The title of the reminder.\n * @param {string} options.listId - The id of the destination reminders list. (Optional)\n * @param {number} [options.priority] - The priority of the reminder. A number between one and nine where nine\n * has the least priority and 0 means no priority at all. Values outside of this range will be rounded to the\n * nearest border. (Optional)\n * @param {boolean} [options.isCompleted] - Whether the reminder is completed already or not. (Optional)\n * @param {number} [options.startDate] - The start date of the reminder. (Optional)\n * @param {number} [options.dueDate] - The due date of the reminder. (Optional)\n * @param {number} [options.completionDate] - The date at which the reminder was completed. (Optional)\n * @param {string} [options.notes] - Additional notes about the reminder. (Optional)\n * @param {string} [options.url] - A URL to save under the reminder. (Optional)\n * @param {string} [options.location] - A location to save under the reminder. (Optional)\n * @param {string} [options.recurrence] - The rules for the recurrence of the reminder. (Optional)\n * @returns {Promise<{ result: string }>} A Promise that resolves with the id of the created reminder\n * @example\n * const now = Date.now();\n * const rules: ReminderRecurrenceRule = {\n * frequency: ReminderRecurrenceFrequency.MONTHLY,\n * interval: 10,\n * end: Date.now()\n * }\n * const reminderOptions = {\n * title: 'Buy cucumber',\n * listId: 'ABC12',\n * priority: 5,\n * isCompleted: false,\n * startDateComponents: now,\n * notes: 'Also buy tomatoes',\n * url: 'https://capacitor-calendar.pages.dev/',\n * location: 'My Local Supermarket',\n * recurrence: rules\n * };\n * const { result } = await createReminder(reminderOptions);\n * console.log(result); // 'ID_1'\n */\n createReminder(options: {\n title: string;\n listId?: string;\n priority?: number;\n isCompleted?: boolean;\n startDate?: number;\n dueDate?: number;\n completionDate?: number;\n notes?: string;\n url?: string;\n location?: string;\n recurrence?: ReminderRecurrenceRule;\n }): Promise<{ result: string }>;\n\n /**\n * Opens the calendar app. Since the user leaves your app, use this method with caution.\n * It will open the calendar on today's date if no date is provided.\n *\n * @async\n * @platform iOS, Android\n * @param {object} options - Options for opening the calendar.\n * @param {number} options.date - The date at which the calendar should be opened. (Optional)\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openCalendar({ date: Date.now() });\n */\n openCalendar(options: { date?: number }): Promise<void>;\n\n /**\n * Opens the reminders app. Since the user leaves your app, use this method with caution.\n *\n * @async\n * @platform iOS\n * @returns {Promise<void>}\n * @example\n * void CapacitorCalendar.openReminders();\n */\n openReminders(): Promise<void>;\n\n /**\n * Retrieves the list of calendar events present in the given date range.\n *\n * @async\n * @since 0.10.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar</li>\n * <li><strong>Android:</strong> readCalendar</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * @param {number} options.startDate The start of the date range.\n * @param {number} options.endDate The end of the date range.\n * @returns {Promise<{ result: CalendarEvent[] }>} A Promise that resolves with the list of events.\n * @example\n * const { result } = await CapacitorCalendar.listEventsInRange({\n * startDate: Date.now(),\n * endDate: Date.now() + 6 * 7 * 24 * 60 * 60 * 1000, // 6 weeks from now\n * })\n */\n listEventsInRange(options: {\n startDate: number;\n endDate: number;\n }): Promise<{ result: CalendarEvent[] }>;\n\n /**\n * Deletes events from the calendar given their IDs.\n *\n * @async\n * @since 0.11.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar</li>\n * <li><strong>Android:</strong> writeCalendar</li>\n * </ul>\n * @param {object} options Options for defining event IDs.\n * @param {number} options.ids An array of event IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * A promise that resolves to an object with two properties:\n * - deleted: string[] - An array of IDs that were successfully deleted.\n * - failed: string[] - An array of IDs that could not be deleted.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteEventsById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteEventsById(options: {\n ids: string[];\n }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Creates a calendar\n *\n * @async\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for creating a calendar.\n * @param {string} options.title The title of the calendar to create.\n * @param {string} options.color The color of the calendar to create.\n * The color should be a HEX string. (Optional)\n * @param {string} options.sourceId The id of the source of the calendar.\n * If not provided, the source of the default calendar will be used. It is\n * recommended to use fetchAllCalendarSources method to fetch the id of the\n * desired source type.\n * @returns {Promise<{ result: string }>} The id of the created calendar.\n * @example\n * { result } = await CapacitorCalendar.createCalendar({\n * title: 'New Calendar',\n * color: '#1d00fc',\n * sourceId: 'local-source-id',\n * });\n * console.log(result); // 'CALENDAR_ID'\n */\n createCalendar(options: {\n title: string;\n color?: string;\n sourceId?: string;\n }): Promise<{ result: string }>;\n\n /**\n * Deletes a calendar by id\n *\n * @async\n * @since 5.2.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readCalendar, writeCalendar</li>\n * </ul>\n * @param {object} options Options for deleting a calendar.\n * @param {string} options.id The id of the calendar to delete.\n * @example\n * await CapacitorCalendar.deleteCalendar({ id: 'ID_1' });\n */\n deleteCalendar(options: { id: string }): Promise<void>;\n\n /**\n * Retrieves the list of reminders present in the given date range.\n *\n * @async\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> readReminders</li>\n * </ul>\n * @param {object} options Options for defining the date range.\n * It Will fetch all reminders from all available lists if not provided. (Optional)\n * @param {string[]} options.listIds An array of reminder list ids.\n * @returns {Promise<{ result: Reminder[] }>} A Promise that resolves with the list of reminders.\n * @example\n * const now = Date.now();\n * const { result } = await CapacitorCalendar.getRemindersFromLists({\n * listIds: ['LIST_ID_1', 'LIST_ID_2'],\n * });\n */\n getRemindersFromLists(options?: {\n listIds: string[];\n }): Promise<{ result: Reminder[] }>;\n\n /**\n * Deletes reminders given their IDs.\n *\n * @async\n * @since 5.3.0\n * @platform iOS\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeReminders</li>\n * </ul>\n * @param {object} options Options for defining reminder IDs.\n * @param {number} options.ids An array of reminder IDs to be deleted.\n * @returns {Promise<{ deleted: string[], failed: string[] }>}\n * A promise that resolves to an object with two properties:\n * - deleted: string[] - An array of IDs that were successfully deleted.\n * - failed: string[] - An array of IDs that could not be deleted.\n * @example\n * const idsToDelete = ['ID_1', 'ID_2', 'ID_DOES_NOT_EXIST'];\n * const { result } = await CapacitorCalendar.deleteRemindersById(idsToDelete)\n * console.log(result.deleted) // ['ID_1', 'ID_2']\n * console.log(result.failed) // ['ID_DOES_NOT_EXIST']\n */\n deleteRemindersById(options: {\n ids: string[];\n }): Promise<{ result: { deleted: string[]; failed: string[] } }>;\n\n /**\n * Requests write access for the calendar. If its already granted, it will directly return the state.\n *\n * @async\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the write access permission.\n * @example\n * const { result } = await this.requestWriteOnlyCalendarAccess();\n */\n requestWriteOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read access for the calendar. If its already granted, it will directly return the state.\n *\n * @async\n * @since 5.4.0\n * @platform Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of the read access permission.\n * @example\n * const { result } = await this.requestReadOnlyCalendarAccess();\n */\n requestReadOnlyCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the calendar. If its already granted, it will directly return the state.\n *\n * @async\n * @since 5.4.0\n * @platform iOS, Android\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullCalendarAccess();\n */\n requestFullCalendarAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Requests read and write access for the reminders. If its already granted, it will directly return the state.\n *\n * @async\n * @since 5.4.0\n * @platform iOS\n * @returns {Promise<{ result: PermissionState }>} A promise that resolves with the state of read and write access permission.\n * @example\n * const { result } = await this.requestFullRemindersAccess();\n */\n requestFullRemindersAccess(): Promise<{ result: PermissionState }>;\n\n /**\n * Opens a native prompt to modify an event given its id.\n *\n * @async\n * @since 5.6.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar, readCalendar</li>\n * <li><strong>Android:</strong> writeCalendar, readCalendar</li>\n * </ul>\n * @param {Object} options The options for modifying an event.\n * @param {string} options.id The id of the event to be modified.\n * @param {object} options.update The set of event properties to be modified. (Optional)\n * If a property is not supported, it will be ignored. Setting alerts with prompt\n * is only supported on iOS.\n * @returns {Promise<{ result: string[] }>} On iOS, the promise resolves with an array containing\n * the initial event id if the modifications were saved and empty if it was cancelled. However, on\n * Android the array will be empty either way.\n * @throws {Error} throws an error if an event for the given id is not found.\n * @example\n * const { result } = await CapacitorCalendar.modifyEventWithPrompt({\n * id: 'EVENT_ID_ONE',\n * update: {\n * title: 'newTitle',\n * startDate: Date.now(),\n * },\n * });\n *\n * console.log(result); // ['EVENT_ID_ONE'] or [] if on Android\n */\n modifyEventWithPrompt(options: {\n id: string;\n update?: {\n title?: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n };\n }): Promise<{ result: string[] }>;\n\n /**\n * Modifies an event given its id and update details.\n *\n * @async\n * @since 5.6.0\n * @platform iOS, Android\n * @permissions\n * <h3>Runtime Permissions:</h3>\n * <ul>\n * <li><strong>iOS:</strong> writeCalendar, readCalendar</li>\n * <li><strong>Android:</strong> writeCalendar, readCalendar</li>\n * </ul>\n * @param {Object} options The options for updating an event.\n * @param {string} options.id The id of the event to be modified.\n * @param {EventSpan} options.span The scope of the modifications.\n * Only supported on iOS. (Optional)\n * @param {Object} options.update The set of event properties to be modified.\n * If a property is not supported, it will be ignored. Modifying the reminder of an\n * event is currently not supported on Android.\n * @returns {Promise<void>} A promise that resolves when the update operation is complete.\n * @throws {Error} throws an error if an event for the given id is not found.\n * @example\n * const { result } = await CapacitorCalendar.modifyEvent({\n * id: 'EVENT_ID_ONE',\n * span: EventSpan.THIS_SPAN,\n * update: {\n * title: 'newTitle',\n * startDate: Date.now(),\n * },\n * });\n */\n modifyEvent(options: {\n id: string;\n span?: EventSpan;\n update: {\n title?: string;\n calendarId?: string;\n location?: string;\n startDate?: number;\n endDate?: number;\n isAllDay?: boolean;\n alertOffsetInMinutes?: number | number[];\n url?: string;\n notes?: string;\n };\n }): Promise<void>;\n\n /**\n * Retrieves a list of calendar sources.\n *\n * @async\n * @since 6.6.0\n * @platform iOS\n * @returns {Promise<{ result: CalendarSource[] }>} A promise that resolves with an array of\n * calendar sources.\n * @example\n * const { result } = await fetchAllCalendarSources();\n * console.log(result); // [{ id: '1', type: '0', title: 'calDav' }, { id: '2', type: '2', title: '3' }]\n */\n fetchAllCalendarSources(): Promise<{ result: CalendarSource[] }>;\n\n /**\n * Retrieves a list of reminders sources.\n *\n * @async\n * @since 6.6.0\n * @platform iOS\n * @returns {Promise<{ result: CalendarSource[] }>} A promise that resolves with an array of\n * reminders sources.\n * @example\n * const { result } = await fetchAllRemindersSources();\n * console.log(result); // [{ id: '1', type: '0', title: 'calDav' }, { id: '2', type: '2', title: '3' }]\n */\n fetchAllRemindersSources(): Promise<{ result: CalendarSource[] }>;\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { CalendarChooserDisplayStyle } from
|
|
2
|
-
import { CalendarChooserSelectionStyle } from
|
|
3
|
-
import { PluginPermission } from
|
|
4
|
-
import { ReminderRecurrenceFrequency } from
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
1
|
+
import { CalendarChooserDisplayStyle } from "./schemas/enums/calendar-chooser-display-style";
|
|
2
|
+
import { CalendarChooserSelectionStyle } from "./schemas/enums/calendar-chooser-selection-style";
|
|
3
|
+
import { PluginPermission } from "./schemas/enums/plugin-permission";
|
|
4
|
+
import { ReminderRecurrenceFrequency } from "./schemas/enums/reminder-recurrence-frequency";
|
|
5
|
+
import { EventSpan } from "./schemas/enums/event-span";
|
|
6
|
+
import { CalendarSourceType } from "./schemas/enums/calendar-source-type";
|
|
7
|
+
import { CalendarType } from "./schemas/enums/calendar-type";
|
|
8
|
+
import type { CapacitorCalendarPlugin } from "./definitions";
|
|
9
|
+
import type { Calendar } from "./schemas/interfaces/calendar";
|
|
10
|
+
import type { RemindersList } from "./schemas/interfaces/reminders-list";
|
|
11
|
+
import type { PluginPermissionsMap } from "./schemas/interfaces/plugin-permissions-map";
|
|
12
|
+
import type { ReminderRecurrenceRule } from "./schemas/interfaces/reminder-recurrence-rule";
|
|
13
|
+
import type { CalendarEvent } from "./schemas/interfaces/calendar-event";
|
|
14
|
+
import type { Reminder } from "./schemas/interfaces/reminder";
|
|
15
|
+
import type { CalendarSource } from "./schemas/interfaces/calendar-source";
|
|
12
16
|
declare const CapacitorCalendar: CapacitorCalendarPlugin;
|
|
13
|
-
export * from
|
|
14
|
-
export type { Calendar, RemindersList, ReminderRecurrenceRule };
|
|
15
|
-
export { CalendarChooserSelectionStyle, CalendarChooserDisplayStyle, PluginPermission, PluginPermissionsMap, ReminderRecurrenceFrequency, CalendarEvent, Reminder, CapacitorCalendar, };
|
|
17
|
+
export * from "./definitions";
|
|
18
|
+
export type { Calendar, RemindersList, ReminderRecurrenceRule, CalendarSource };
|
|
19
|
+
export { CalendarChooserSelectionStyle, CalendarChooserDisplayStyle, PluginPermission, PluginPermissionsMap, ReminderRecurrenceFrequency, CalendarEvent, Reminder, EventSpan, CalendarSourceType, CalendarType, CapacitorCalendar, };
|