• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit CalendarKit
19 */
20
21import { AsyncCallback } from './@ohos.base';
22import type Context from './application/Context';
23
24/**
25 * This provides calendar data access abilities.
26 * @namespace calendarManager
27 * @syscap SystemCapability.Applications.CalendarData
28 * @since 10
29 */
30/**
31 * This provides calendar data access abilities.
32 * @namespace calendarManager
33 * @syscap SystemCapability.Applications.CalendarData
34 * @atomicservice
35 * @since 11
36 */
37declare namespace calendarManager {
38  /**
39   * Returns an instance of CalendarManager
40   *
41   * @param { Context } context - Hap context information
42   * @returns { CalendarManager } Instance of CalendarManager
43   * @syscap SystemCapability.Applications.CalendarData
44   * @StageModelOnly
45   * @since 10
46   */
47  /**
48   * Returns an instance of CalendarManager
49   *
50   * @param { Context } context - Hap context information
51   * @returns { CalendarManager } Instance of CalendarManager
52   * @syscap SystemCapability.Applications.CalendarData
53   * @StageModelOnly
54   * @atomicservice
55   * @since 11
56   */
57  function getCalendarManager(context: Context) : CalendarManager;
58
59  /**
60   * Defines the CalendarManager class and provides functions to access the calendar data.
61   *
62   * @typedef CalendarManager
63   * @syscap SystemCapability.Applications.CalendarData
64   * @since 10
65   */
66  /**
67   * Defines the CalendarManager class and provides functions to access the calendar data.
68   *
69   * @typedef CalendarManager
70   * @syscap SystemCapability.Applications.CalendarData
71   * @atomicservice
72   * @since 11
73   */
74  export interface CalendarManager {
75    /**
76     * Create calendar instance.
77     * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR
78     * @param { CalendarAccount } calendarAccount - calendar account to create calendar
79     * @returns { Promise<Calendar> } the promise with calendar corresponding to account
80     * @throws { BusinessError } 201 - Permission denied.
81     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
82     * @throws { BusinessError } 801 - Capability not supported.
83     * @syscap SystemCapability.Applications.CalendarData
84     * @since 10
85     */
86    createCalendar(calendarAccount: CalendarAccount): Promise<Calendar>;
87
88    /**
89     * Create calendar instance.
90     *
91     * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR
92     * @param { CalendarAccount } calendarAccount - calendar account to create calendar
93     * @param { AsyncCallback<Calendar> } callback - the callback of createCalendar
94     * @throws { BusinessError } 201 - Permission denied.
95     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
96     * @throws { BusinessError } 801 - Capability not supported.
97     * @syscap SystemCapability.Applications.CalendarData
98     * @since 10
99     */
100    createCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback<Calendar>): void;
101
102    /**
103     * Delete calendar instance.
104     *
105     * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR
106     * @param { Calendar } calendar - calendar to be deleted
107     * @returns { Promise<void> } the promise returned by the function.
108     * @throws { BusinessError } 201 - Permission denied.
109     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
110     * @throws { BusinessError } 801 - Capability not supported.
111     * @syscap SystemCapability.Applications.CalendarData
112     * @since 10
113     */
114    deleteCalendar(calendar: Calendar): Promise<void>;
115
116    /**
117     * Delete calendar instance.
118     *
119     * @permission ohos.permission.WRITE_CALENDAR or ohos.permission.WRITE_WHOLE_CALENDAR
120     * @param { Calendar } calendar - calendar to be deleted
121     * @param { AsyncCallback<void> } callback - the callback of deleteCalendar
122     * @throws { BusinessError } 201 - Permission denied.
123     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
124     * @throws { BusinessError } 801 - Capability not supported.
125     * @syscap SystemCapability.Applications.CalendarData
126     * @since 10
127     */
128    deleteCalendar(calendar: Calendar, callback: AsyncCallback<void>): void;
129
130    /**
131     * Get calendar instance from database.
132     *
133     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
134     * @param { CalendarAccount } [calendarAccount] - specify calendar account to retrieve
135     * @returns { Promise<Calendar> } the promise returned by the function.
136     * @throws { BusinessError } 201 - Permission denied.
137     * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
138     * @throws { BusinessError } 801 - Capability not supported.
139     * @syscap SystemCapability.Applications.CalendarData
140     * @since 10
141     */
142    /**
143     * Get calendar instance from database.
144     *
145     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
146     * @param { CalendarAccount } [calendarAccount] - specify calendar account to retrieve
147     * @returns { Promise<Calendar> } the promise returned by the function.
148     * @throws { BusinessError } 201 - Permission denied.
149     * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
150     * @throws { BusinessError } 801 - Capability not supported.
151     * @syscap SystemCapability.Applications.CalendarData
152     * @atomicservice
153     * @since 11
154     */
155    getCalendar(calendarAccount?: CalendarAccount): Promise<Calendar>;
156
157    /**
158     * Get calendar instance from database by specified account.
159     *
160     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
161     * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve
162     * @param { AsyncCallback<Calendar> } callback - the callback of getCalendar
163     * @throws { BusinessError } 201 - Permission denied.
164     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
165     * @throws { BusinessError } 801 - Capability not supported.
166     * @syscap SystemCapability.Applications.CalendarData
167     * @since 10
168     */
169    /**
170     * Get calendar instance from database by specified account.
171     *
172     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
173     * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve
174     * @param { AsyncCallback<Calendar> } callback - the callback of getCalendar
175     * @throws { BusinessError } 201 - Permission denied.
176     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
177     * @throws { BusinessError } 801 - Capability not supported.
178     * @syscap SystemCapability.Applications.CalendarData
179     * @atomicservice
180     * @since 11
181     */
182    getCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback<Calendar>): void;
183
184    /**
185     * Get default calendar instance from database.
186     *
187     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
188     * @param { AsyncCallback<Calendar> } callback - the callback of getCalendar with default calendar instance
189     * @throws { BusinessError } 201 - Permission denied.
190     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
191     * @throws { BusinessError } 801 - Capability not supported.
192     * @syscap SystemCapability.Applications.CalendarData
193     * @since 10
194     */
195    /**
196     * Get default calendar instance from database.
197     *
198     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
199     * @param { AsyncCallback<Calendar> } callback - the callback of getCalendar with default calendar instance
200     * @throws { BusinessError } 201 - Permission denied.
201     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
202     * @throws { BusinessError } 801 - Capability not supported.
203     * @syscap SystemCapability.Applications.CalendarData
204     * @atomicservice
205     * @since 11
206     */
207    getCalendar(callback: AsyncCallback<Calendar>): void;
208
209    /**
210     * Get all calendar instance.
211     *
212     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
213     * @returns { Promise<Calendar[]> } the promise returned by the function.
214     * @throws { BusinessError } 201 - Permission denied.
215     * @throws { BusinessError } 401 - Parameter error. Possible causes: Incorrect parameter types.
216     * @throws { BusinessError } 801 - Capability not supported.
217     * @syscap SystemCapability.Applications.CalendarData
218     * @since 10
219     */
220    getAllCalendars(): Promise<Calendar[]>;
221
222    /**
223     * Get all calendar instance.
224     *
225     * @permission ohos.permission.READ_CALENDAR or ohos.permission.READ_WHOLE_CALENDAR
226     * @param {AsyncCallback<Calendar[]>} callback - the callback of getAllCalendars
227     * @throws { BusinessError } 201 - Permission denied.
228     * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.
229     * @throws { BusinessError } 801 - Capability not supported.
230     * @syscap SystemCapability.Applications.CalendarData
231     * @since 10
232     */
233    getAllCalendars(callback: AsyncCallback<Calendar[]>): void;
234
235    /**
236     * Create a single event,invoking this interface will open the event creation page.
237     *
238     * @param { Event } event - Indicates the information about a single event.
239     * @returns { Promise<number> } the promise with event id.
240     * @syscap SystemCapability.Applications.CalendarData
241     * @atomicservice
242     * @since 12
243     */
244    editEvent(event: Event): Promise<number>;
245  }
246
247  /**
248   * Describes a calendar instance.
249   * @typedef Calendar
250   * @syscap SystemCapability.Applications.CalendarData
251   * @since 10
252   */
253  /**
254   * Describes a calendar instance.
255   * @typedef Calendar
256   * @syscap SystemCapability.Applications.CalendarData
257   * @atomicservice
258   * @since 11
259   */
260  export interface Calendar {
261    /**
262     * Id of the calendar
263     * @type { number }
264     * @readonly
265     * @syscap SystemCapability.Applications.CalendarData
266     * @since 10
267     */
268    /**
269     * Id of the calendar
270     * @type { number }
271     * @readonly
272     * @syscap SystemCapability.Applications.CalendarData
273     * @atomicservice
274     * @since 11
275     */
276    readonly id: number
277
278    /**
279     * Add a single event.
280     * @param { Event } event - Indicates the information about a single event.
281     * @returns { Promise<number> } The event ID.
282     * @syscap SystemCapability.Applications.CalendarData
283     * @since 10
284     */
285    /**
286     * Add a single event.
287     * @param { Event } event - Indicates the information about a single event.
288     * @returns { Promise<number> } The event ID.
289     * @syscap SystemCapability.Applications.CalendarData
290     * @atomicservice
291     * @since 11
292     */
293    addEvent(event: Event): Promise<number>;
294
295    /**
296     * Add a single event.
297     * @param { Event } event - a single event to add.
298     * @param { AsyncCallback<number> } callback - callback of addEvent.
299     * @syscap SystemCapability.Applications.CalendarData
300     * @since 10
301     */
302    /**
303     * Add a single event.
304     * @param { Event } event - a single event to add.
305     * @param { AsyncCallback<number> } callback - callback of addEvent.
306     * @syscap SystemCapability.Applications.CalendarData
307     * @atomicservice
308     * @since 11
309     */
310    addEvent(event: Event, callback: AsyncCallback<number>): void;
311
312    /**
313     * Add multiple events.
314     * @param { Event[] } events - multiple events to add.
315     * @returns { Promise<void> } The promise returned by function.
316     * @syscap SystemCapability.Applications.CalendarData
317     * @since 10
318     */
319    addEvents(events: Event[]): Promise<void>;
320
321    /**
322     * Add multiple events.
323     * @param { Event[] } events - Indicates the information about multiple events.
324     * @param { AsyncCallback<void> } callback - The callback of addEvents
325     * @syscap SystemCapability.Applications.CalendarData
326     * @since 10
327     */
328    addEvents(events: Event[], callback: AsyncCallback<void>): void;
329
330    /**
331     * Delete a single event.
332     * @param { number } id - Indicates the ID of an event.
333     * @returns { Promise<void> } The promise returned by function.
334     * @syscap SystemCapability.Applications.CalendarData
335     * @since 10
336     */
337    deleteEvent(id: number): Promise<void>;
338
339    /**
340     * Delete a single event.
341     * @param { number } id - Indicates the ID of an event.
342     * @param {AsyncCallback<void>} callback - The callback of deleteEvent.
343     * @syscap SystemCapability.Applications.CalendarData
344     * @since 10
345     */
346    deleteEvent(id: number, callback: AsyncCallback<void>): void;
347
348    /**
349     * Delete multiple events.
350     * @param { number[] } ids - The id array of multiple events.
351     * @returns { Promise<void> } The promise returned by function.
352     * @syscap SystemCapability.Applications.CalendarData
353     * @since 10
354     */
355    deleteEvents(ids: number[]): Promise<void>;
356
357    /**
358     * Delete multiple events.
359     * @param { number[] } ids - Indicates the IDs of multiple events.
360     * @param {AsyncCallback<void>} callback - The callback of deleteEvents.
361     * @syscap SystemCapability.Applications.CalendarData
362     * @since 10
363     */
364    deleteEvents(ids: number[], callback: AsyncCallback<void>): void;
365
366    /**
367     * Update a single event.
368     * @param { Event } event - Indicates the information about a single event.
369     * @returns { Promise<void> } The promise returned by function.
370     * @syscap SystemCapability.Applications.CalendarData
371     * @since 10
372     */
373    updateEvent(event: Event): Promise<void>;
374
375    /**
376     * Update a single event.
377     * @param { Event } event - Indicates the information about a single event.
378     * @param { AsyncCallback<void> } callback - The callback of updateEvent.
379     * @syscap SystemCapability.Applications.CalendarData
380     * @since 10
381     */
382    updateEvent(event: Event, callback: AsyncCallback<void>): void;
383
384    /**
385     * Query events based on filter conditions.
386     * @param { EventFilter } [eventFilter] - Indicates the filtering conditions of events.
387     * @param { (keyof Event)[] } [eventKey] - Expected column to be returned.
388     * @returns { Promise<Event[]> } Information about events that match the filter conditions.
389     * @syscap SystemCapability.Applications.CalendarData
390     * @since 10
391     */
392    getEvents(eventFilter?: EventFilter, eventKey?: (keyof Event)[]): Promise<Event[]>;
393
394    /**
395     * Query events based on filter conditions.
396     * @param { EventFilter } eventFilter - Indicates the filtering conditions of events.
397     * @param { (keyof Event)[] } eventKey - Expected column to be returned.
398     * @param { AsyncCallback<Event[]> } callback - The callback of getEvents.
399     * @syscap SystemCapability.Applications.CalendarData
400     * @since 10
401     */
402    getEvents(eventFilter: EventFilter, eventKey: (keyof Event)[], callback: AsyncCallback<Event[]>):void;
403
404    /**
405     * Query all events with all column from current calendar instance.
406     * @param { AsyncCallback<Event[]> } callback - The callback of getEvents with all events.
407     * @syscap SystemCapability.Applications.CalendarData
408     * @since 10
409     */
410    getEvents(callback: AsyncCallback<Event[]>):void;
411
412    /**
413     * Get calendar configure.
414     * @returns { CalendarConfig } configure of current calendar.
415     * @syscap SystemCapability.Applications.CalendarData
416     * @since 10
417     */
418    getConfig(): CalendarConfig;
419
420    /**
421     * Set calendar configure.
422     * @param { CalendarConfig } config - calendar config to set
423     * @returns { Promise<void> } The promise returned by function.
424     * @syscap SystemCapability.Applications.CalendarData
425     * @since 10
426     */
427    setConfig(config: CalendarConfig): Promise<void>;
428
429    /**
430     * Set calendar configure.
431     * @param { CalendarConfig } config - calendar config to set
432     * @param { AsyncCallback<void> } callback - callback of setConfig
433     * @syscap SystemCapability.Applications.CalendarData
434     * @since 10
435     */
436    setConfig(config: CalendarConfig, callback: AsyncCallback<void>): void;
437
438    /**
439     * Get calendar account.
440     * @returns { CalendarAccount } calendar account of current calendar.
441     * @syscap SystemCapability.Applications.CalendarData
442     * @since 10
443     */
444    getAccount(): CalendarAccount;
445
446    /**
447     * Query event instances based on the conditions.
448     * @param { number } start - start time of query range
449     * @param { number } end - end time of query range
450     * @param { number[] } [ids] - Indicates the IDs of multiple events
451     * @param { (keyof Event)[] } [eventKey] - Expected column to be returned
452     * @returns { Promise<Event[]> } Information about events that match the condition
453     * @syscap SystemCapability.Applications.CalendarData
454     * @atomicservice
455     * @since 18
456     */
457    queryEventInstances(start: number, end: number, ids?: number[], eventKey?: (keyof Event)[]): Promise<Event[]>;
458  }
459
460  /**
461   * Describes a calendar account.
462   * @typedef CalendarAccount
463   * @syscap SystemCapability.Applications.CalendarData
464   * @since 10
465   */
466  /**
467   * Describes a calendar account.
468   * @typedef CalendarAccount
469   * @syscap SystemCapability.Applications.CalendarData
470   * @atomicservice
471   * @since 11
472   */
473  interface CalendarAccount {
474    /**
475     * Name of the calendar
476     * @type { string }
477     * @readonly
478     * @syscap SystemCapability.Applications.CalendarData
479     * @since 10
480     */
481    /**
482     * Name of the calendar
483     * @type { string }
484     * @readonly
485     * @syscap SystemCapability.Applications.CalendarData
486     * @atomicservice
487     * @since 11
488     */
489    readonly name: string;
490
491    /**
492     * Type of the calendar
493     * @type { CalendarType }
494     * @syscap SystemCapability.Applications.CalendarData
495     * @since 10
496     */
497    /**
498     * Type of the calendar
499     * @type { CalendarType }
500     * @syscap SystemCapability.Applications.CalendarData
501     * @atomicservice
502     * @since 11
503     */
504    type: CalendarType;
505
506    /**
507     * DisplayName of the calendar
508     * @type { ?string }
509     * @syscap SystemCapability.Applications.CalendarData
510     * @since 10
511     */
512    /**
513     * DisplayName of the calendar
514     * @type { ?string }
515     * @syscap SystemCapability.Applications.CalendarData
516     * @atomicservice
517     * @since 11
518     */
519    displayName?: string
520  }
521
522  /**
523   * Describes a calendar configuration.
524   * @typedef CalendarConfig
525   * @syscap SystemCapability.Applications.CalendarData
526   * @since 10
527   */
528  interface CalendarConfig {
529    /**
530     * Whether the calendar provides a reminder
531     * @type { ?boolean }
532     * @syscap SystemCapability.Applications.CalendarData
533     * @since 10
534     */
535    enableReminder?: boolean;
536
537    /**
538     * Color of the calendar
539     * @type { ?(number | string) }
540     * @syscap SystemCapability.Applications.CalendarData
541     * @since 10
542     */
543    color?: number | string;
544  }
545
546  /**
547   * Describes an event information.
548   * @typedef Event
549   * @syscap SystemCapability.Applications.CalendarData
550   * @since 10
551   */
552  /**
553   * Describes an event information.
554   * @typedef Event
555   * @syscap SystemCapability.Applications.CalendarData
556   * @atomicservice
557   * @since 11
558   */
559  interface Event {
560    /**
561     * Id of the event
562     * @type { ?number }
563     * @syscap SystemCapability.Applications.CalendarData
564     * @since 10
565     */
566    /**
567     * Id of the event
568     * @type { ?number }
569     * @syscap SystemCapability.Applications.CalendarData
570     * @atomicservice
571     * @since 11
572     */
573    id?: number;
574
575    /**
576     * Type of the event
577     * @type { EventType }
578     * @syscap SystemCapability.Applications.CalendarData
579     * @since 10
580     */
581    /**
582     * Type of the event
583     * @type { EventType }
584     * @syscap SystemCapability.Applications.CalendarData
585     * @atomicservice
586     * @since 11
587     */
588    type: EventType;
589
590    /**
591     * Title of the event
592     * @type { ?string }
593     * @syscap SystemCapability.Applications.CalendarData
594     * @since 10
595     */
596    /**
597     * Title of the event
598     * @type { ?string }
599     * @syscap SystemCapability.Applications.CalendarData
600     * @atomicservice
601     * @since 11
602     */
603    title?: string;
604
605    /**
606     * Location of the event
607     * @type { ?Location }
608     * @syscap SystemCapability.Applications.CalendarData
609     * @since 10
610     */
611    /**
612     * Location of the event
613     * @type { ?Location }
614     * @syscap SystemCapability.Applications.CalendarData
615     * @atomicservice
616     * @since 11
617     */
618    location?: Location;
619
620    /**
621     * start time of the event
622     * @type { number }
623     * @syscap SystemCapability.Applications.CalendarData
624     * @since 10
625     */
626    /**
627     * start time of the event
628     * @type { number }
629     * @syscap SystemCapability.Applications.CalendarData
630     * @atomicservice
631     * @since 11
632     */
633    startTime: number;
634
635    /**
636     * end time of the event
637     * @type { number }
638     * @syscap SystemCapability.Applications.CalendarData
639     * @since 10
640     */
641    /**
642     * end time of the event
643     * @type { number }
644     * @syscap SystemCapability.Applications.CalendarData
645     * @atomicservice
646     * @since 11
647     */
648    endTime: number;
649
650    /**
651     * Whether the event is allDay
652     * @type { ?boolean }
653     * @syscap SystemCapability.Applications.CalendarData
654     * @since 10
655     */
656    /**
657     * Whether the event is allDay
658     * @type { ?boolean }
659     * @syscap SystemCapability.Applications.CalendarData
660     * @atomicservice
661     * @since 11
662     */
663    isAllDay?: boolean;
664
665    /**
666     * Attendees of the event
667     * @type { ?Attendee[] }
668     * @syscap SystemCapability.Applications.CalendarData
669     * @since 10
670     */
671    /**
672     * Attendees of the event
673     * @type { ?Attendee[] }
674     * @syscap SystemCapability.Applications.CalendarData
675     * @atomicservice
676     * @since 11
677     */
678    attendee?: Attendee[];
679
680    /**
681     * TimeZone of the event
682     * @type { ?string }
683     * @syscap SystemCapability.Applications.CalendarData
684     * @since 10
685     */
686    /**
687     * TimeZone of the event
688     * @type { ?string }
689     * @syscap SystemCapability.Applications.CalendarData
690     * @atomicservice
691     * @since 11
692     */
693    timeZone?: string;
694
695    /**
696     * Reminder time of the event
697     * @type { ?number[] }
698     * @syscap SystemCapability.Applications.CalendarData
699     * @since 10
700     */
701    /**
702     * Reminder time of the event
703     * @type { ?number[] }
704     * @syscap SystemCapability.Applications.CalendarData
705     * @atomicservice
706     * @since 11
707     */
708    reminderTime?: number[];
709
710    /**
711     * RecurrenceRule of the event
712     * @type { ?RecurrenceRule }
713     * @syscap SystemCapability.Applications.CalendarData
714     * @since 10
715     */
716    /**
717     * RecurrenceRule of the event
718     * @type { ?RecurrenceRule }
719     * @syscap SystemCapability.Applications.CalendarData
720     * @atomicservice
721     * @since 11
722     */
723    recurrenceRule?: RecurrenceRule;
724
725    /**
726     * Description of the event
727     * @type { ?string }
728     * @syscap SystemCapability.Applications.CalendarData
729     * @since 10
730     */
731    /**
732     * Description of the event
733     * @type { ?string }
734     * @syscap SystemCapability.Applications.CalendarData
735     * @atomicservice
736     * @since 11
737     */
738    description?: string;
739
740    /**
741     * Service of the event
742     * @type { ?EventService }
743     * @syscap SystemCapability.Applications.CalendarData
744     * @since 10
745     */
746    /**
747     * Service of the event
748     * @type { ?EventService }
749     * @syscap SystemCapability.Applications.CalendarData
750     * @atomicservice
751     * @since 11
752     */
753    service?: EventService;
754
755    /**
756     * Unique identifier of the event
757     * @type { ?string }
758     * @syscap SystemCapability.Applications.CalendarData
759     * @atomicservice
760     * @since 12
761     */
762    identifier?: string;
763
764    /**
765     * Whether the event is lunar.
766     * @type { ?boolean }
767     * @syscap SystemCapability.Applications.CalendarData
768     * @atomicservice
769     * @since 12
770     */
771    isLunar?: boolean;
772
773    /**
774     * Start time of the event instance.
775     * @type { ?number }
776     * @syscap SystemCapability.Applications.CalendarData
777     * @atomicservice
778     * @since 18
779     */
780    instanceStartTime?: number;
781
782    /**
783     * End time of the event instance.
784     * @type { ?number }
785     * @syscap SystemCapability.Applications.CalendarData
786     * @atomicservice
787     * @since 18
788     */
789    instanceEndTime?: number;
790  }
791
792  /**
793   * Enum for all calendar type.
794   * @enum { string }
795   * @syscap SystemCapability.Applications.CalendarData
796   * @since 10
797   */
798  /**
799   * Enum for all calendar type.
800   * @enum { string }
801   * @syscap SystemCapability.Applications.CalendarData
802   * @atomicservice
803   * @since 11
804   */
805  enum CalendarType {
806    /**
807     * Local calendar
808     * @syscap SystemCapability.Applications.CalendarData
809     * @since 10
810     */
811    /**
812     * Local calendar
813     * @syscap SystemCapability.Applications.CalendarData
814     * @atomicservice
815     * @since 11
816     */
817    LOCAL = 'local',
818
819    /**
820     * Email calendar
821     * @syscap SystemCapability.Applications.CalendarData
822     * @since 10
823     */
824    /**
825     * Email calendar
826     * @syscap SystemCapability.Applications.CalendarData
827     * @atomicservice
828     * @since 11
829     */
830    EMAIL = 'email',
831
832    /**
833     * Birthday calendar
834     * @syscap SystemCapability.Applications.CalendarData
835     * @since 10
836     */
837    /**
838     * Birthday calendar
839     * @syscap SystemCapability.Applications.CalendarData
840     * @atomicservice
841     * @since 11
842     */
843    BIRTHDAY = 'birthday',
844
845    /**
846     * CalDAV calendar
847     * @syscap SystemCapability.Applications.CalendarData
848     * @since 10
849     */
850    /**
851     * CalDAV calendar
852     * @syscap SystemCapability.Applications.CalendarData
853     * @atomicservice
854     * @since 11
855     */
856    CALDAV = 'caldav',
857
858    /**
859     * Subscribed calendar
860     * @syscap SystemCapability.Applications.CalendarData
861     * @since 10
862     */
863    /**
864     * Subscribed calendar
865     * @syscap SystemCapability.Applications.CalendarData
866     * @atomicservice
867     * @since 11
868     */
869    SUBSCRIBED = 'subscribed'
870  }
871
872  /**
873   * Location of an event.
874   * @typedef Location
875   * @syscap SystemCapability.Applications.CalendarData
876   * @since 10
877   */
878  /**
879   * Location of an event.
880   * @typedef Location
881   * @syscap SystemCapability.Applications.CalendarData
882   * @atomicservice
883   * @since 11
884   */
885  interface Location {
886    /**
887     * Location of the event
888     * @type { ?string }
889     * @syscap SystemCapability.Applications.CalendarData
890     * @since 10
891     */
892    /**
893     * Location of the event
894     * @type { ?string }
895     * @syscap SystemCapability.Applications.CalendarData
896     * @atomicservice
897     * @since 11
898     */
899    location?: string;
900
901    /**
902     * Longitude of the location
903     * @type { ?number }
904     * @syscap SystemCapability.Applications.CalendarData
905     * @since 10
906     */
907    /**
908     * Longitude of the location
909     * @type { ?number }
910     * @syscap SystemCapability.Applications.CalendarData
911     * @atomicservice
912     * @since 11
913     */
914    longitude?: number;
915
916    /**
917     * Latitude of the location
918     * @type { ?number }
919     * @syscap SystemCapability.Applications.CalendarData
920     * @since 10
921     */
922    /**
923     * Latitude of the location
924     * @type { ?number }
925     * @syscap SystemCapability.Applications.CalendarData
926     * @atomicservice
927     * @since 11
928     */
929    latitude?: number;
930  }
931
932  /**
933   * Provides the abilities to retrive event filter.
934   * @syscap SystemCapability.Applications.CalendarData
935   * @since 10
936   */
937  class EventFilter {
938    /**
939     * Filter events by event id.
940     * @param {number[]} ids id array to retrieve
941     * @returns { EventFilter } Returns the EventFilter with ids.
942     * @syscap SystemCapability.Applications.CalendarData
943     * @since 10
944     */
945    static filterById(ids: number[]): EventFilter;
946
947    /**
948     * Filter events by event start time and end time.
949     * @param { number } start - start time of query range
950     * @param { number } end - end time of query range
951     * @returns { EventFilter } Returns the EventFilter with time range.
952     * @syscap SystemCapability.Applications.CalendarData
953     * @since 10
954     */
955    static filterByTime(start: number, end: number): EventFilter;
956
957    /**
958     * Filter events by event title.
959     * @param { string } title - event title to query
960     * @returns {EventFilter } Returns the EventFilter with title.
961     * @syscap SystemCapability.Applications.CalendarData
962     * @since 10
963     */
964    static filterByTitle(title: string): EventFilter;
965  }
966
967  /**
968   * Enum for supported events type.
969   * @enum { number }
970   * @syscap SystemCapability.Applications.CalendarData
971   * @since 10
972   */
973  /**
974   * Enum for supported events type.
975   * @enum { number }
976   * @syscap SystemCapability.Applications.CalendarData
977   * @atomicservice
978   * @since 11
979   */
980  enum EventType {
981    /**
982     * normal event.
983     * @syscap SystemCapability.Applications.CalendarData
984     * @since 10
985     */
986    /**
987     * normal event.
988     * @syscap SystemCapability.Applications.CalendarData
989     * @atomicservice
990     * @since 11
991     */
992    NORMAL = 0,
993
994    /**
995     * important event.
996     * @syscap SystemCapability.Applications.CalendarData
997     * @since 10
998     */
999    /**
1000     * important event.
1001     * @syscap SystemCapability.Applications.CalendarData
1002     * @atomicservice
1003     * @since 11
1004     */
1005    IMPORTANT = 1,
1006  }
1007
1008  /**
1009   * Defines the recurrence rule of event
1010   * @typedef RecurrenceRule
1011   * @syscap SystemCapability.Applications.CalendarData
1012   * @since 10
1013   */
1014  /**
1015   * Defines the recurrence rule of event
1016   * @typedef RecurrenceRule
1017   * @syscap SystemCapability.Applications.CalendarData
1018   * @atomicservice
1019   * @since 11
1020   */
1021  export interface RecurrenceRule {
1022    /**
1023     * RecurrenceFrequency of recurrence event.
1024     * @type { RecurrenceFrequency }
1025     * @syscap SystemCapability.Applications.CalendarData
1026     * @since 10
1027     */
1028    /**
1029     * RecurrenceFrequency of recurrence event.
1030     * @type { RecurrenceFrequency }
1031     * @syscap SystemCapability.Applications.CalendarData
1032     * @atomicservice
1033     * @since 11
1034     */
1035    recurrenceFrequency: RecurrenceFrequency;
1036
1037    /**
1038     * Expiration time of recurrence event.
1039     * @type { ?number }
1040     * @syscap SystemCapability.Applications.CalendarData
1041     * @since 10
1042     */
1043    /**
1044     * Expiration time of recurrence event.
1045     * @type { ?number }
1046     * @syscap SystemCapability.Applications.CalendarData
1047     * @atomicservice
1048     * @since 11
1049     */
1050    expire?: number;
1051
1052    /**
1053     * Repetition count of recurrence event.
1054     * @type { ?number }
1055     * @syscap SystemCapability.Applications.CalendarData
1056     * @atomicservice
1057     * @since 12
1058     */
1059    count?: number;
1060
1061    /**
1062     * Repeat interval of recurrence event.
1063     * @type { ?number }
1064     * @syscap SystemCapability.Applications.CalendarData
1065     * @atomicservice
1066     * @since 12
1067     */
1068    interval?: number;
1069
1070    /**
1071     * Excluded dates of recurrence event.
1072     * @type { ?number[] }
1073     * @syscap SystemCapability.Applications.CalendarData
1074     * @atomicservice
1075     * @since 12
1076     */
1077    excludedDates?: number[];
1078
1079    /**
1080     * The days of the week associated with the recurrence event.
1081     * @type { ?number[] }
1082     * @syscap SystemCapability.Applications.CalendarData
1083     * @atomicservice
1084     * @since 12
1085     */
1086    daysOfWeek?: number[];
1087
1088    /**
1089     * The days of the month associated with the recurrence event.
1090     * @type { ?number[] }
1091     * @syscap SystemCapability.Applications.CalendarData
1092     * @atomicservice
1093     * @since 12
1094     */
1095    daysOfMonth?: number[];
1096
1097    /**
1098     * The days of the year associated with the recurrence event.
1099     * @type { ?number[] }
1100     * @syscap SystemCapability.Applications.CalendarData
1101     * @atomicservice
1102     * @since 12
1103     */
1104    daysOfYear?: number[];
1105
1106    /**
1107     * The weeks of the month associated with the recurrence event.
1108     * @type { ?number[] }
1109     * @syscap SystemCapability.Applications.CalendarData
1110     * @atomicservice
1111     * @since 12
1112     */
1113    weeksOfMonth?: number[];
1114
1115    /**
1116     * The weeks of the year associated with the recurrence event.
1117     * @type { ?number[] }
1118     * @syscap SystemCapability.Applications.CalendarData
1119     * @atomicservice
1120     * @since 12
1121     */
1122    weeksOfYear?: number[];
1123
1124    /**
1125     * The months of the year associated with the recurrence event.
1126     * @type { ?number[] }
1127     * @syscap SystemCapability.Applications.CalendarData
1128     * @atomicservice
1129     * @since 12
1130     */
1131    monthsOfYear?: number[];
1132  }
1133
1134  /**
1135   * Enum for the recurrence type by different period
1136   * @enum { number }
1137   * @syscap SystemCapability.Applications.CalendarData
1138   * @since 10
1139   */
1140  /**
1141   * Enum for the recurrence type by different period
1142   * @enum { number }
1143   * @syscap SystemCapability.Applications.CalendarData
1144   * @atomicservice
1145   * @since 11
1146   */
1147  export enum RecurrenceFrequency {
1148    /**
1149     * The event repeats every year.
1150     * @syscap SystemCapability.Applications.CalendarData
1151     * @since 10
1152     */
1153    /**
1154     * The event repeats every year.
1155     * @syscap SystemCapability.Applications.CalendarData
1156     * @atomicservice
1157     * @since 11
1158     */
1159    YEARLY = 0,
1160
1161    /**
1162     * The event repeats every month.
1163     * @syscap SystemCapability.Applications.CalendarData
1164     * @since 10
1165     */
1166    /**
1167     * The event repeats every month.
1168     * @syscap SystemCapability.Applications.CalendarData
1169     * @atomicservice
1170     * @since 11
1171     */
1172    MONTHLY = 1,
1173
1174    /**
1175     * The event repeats every week.
1176     * @syscap SystemCapability.Applications.CalendarData
1177     * @since 10
1178     */
1179    /**
1180     * The event repeats every week.
1181     * @syscap SystemCapability.Applications.CalendarData
1182     * @atomicservice
1183     * @since 11
1184     */
1185    WEEKLY = 2,
1186
1187    /**
1188     * The event repeats every day.
1189     * @syscap SystemCapability.Applications.CalendarData
1190     * @since 10
1191     */
1192    /**
1193     * The event repeats every day.
1194     * @syscap SystemCapability.Applications.CalendarData
1195     * @atomicservice
1196     * @since 11
1197     */
1198    DAILY = 3,
1199  }
1200
1201  /**
1202   * Defines the attendee information
1203   * @typedef Attendee
1204   * @syscap SystemCapability.Applications.CalendarData
1205   * @since 10
1206   */
1207  /**
1208   * Defines the attendee information
1209   * @typedef Attendee
1210   * @syscap SystemCapability.Applications.CalendarData
1211   * @atomicservice
1212   * @since 11
1213   */
1214  export interface Attendee {
1215    /**
1216     * Name of the Attendee.
1217     * @type { string }
1218     * @syscap SystemCapability.Applications.CalendarData
1219     * @since 10
1220     */
1221    /**
1222     * Name of the Attendee.
1223     * @type { string }
1224     * @syscap SystemCapability.Applications.CalendarData
1225     * @atomicservice
1226     * @since 11
1227     */
1228    name: string;
1229
1230    /**
1231     * Email of the Attendee.
1232     * @type { string }
1233     * @syscap SystemCapability.Applications.CalendarData
1234     * @since 10
1235     */
1236    /**
1237     * Email of the Attendee.
1238     * @type { string }
1239     * @syscap SystemCapability.Applications.CalendarData
1240     * @atomicservice
1241     * @since 11
1242     */
1243    email: string;
1244
1245    /**
1246     * Role of the Attendee.
1247     * @type { ?AttendeeRole }
1248     * @syscap SystemCapability.Applications.CalendarData
1249     * @atomicservice
1250     * @since 12
1251     */
1252    role?: AttendeeRole;
1253
1254    /**
1255     * Type of the Attendee.
1256     * @type { ?AttendeeType }
1257     * @syscap SystemCapability.Applications.CalendarData
1258     * @atomicservice
1259     * @since 18
1260     */
1261    type?: AttendeeType;
1262
1263    /**
1264     * Status of the Attendee.
1265     * @type { ?AttendeeStatus }
1266     * @syscap SystemCapability.Applications.CalendarData
1267     * @atomicservice
1268     * @since 18
1269     */
1270    status?: AttendeeStatus;
1271  }
1272
1273  /**
1274   * Enum for the attendee role
1275   * @enum { string }
1276   * @syscap SystemCapability.Applications.CalendarData
1277   * @atomicservice
1278   * @since 12
1279   */
1280  export enum AttendeeRole {
1281    /**
1282     * The organizer of a meeting.
1283     * @syscap SystemCapability.Applications.CalendarData
1284     * @atomicservice
1285     * @since 12
1286     */
1287    ORGANIZER = 'organizer',
1288
1289    /**
1290     * The participant of a meeting.
1291     * @syscap SystemCapability.Applications.CalendarData
1292     * @atomicservice
1293     * @since 12
1294     */
1295    PARTICIPANT = 'participant'
1296  }
1297
1298  /**
1299   * Enum for the attendee type
1300   * @enum { number }
1301   * @syscap SystemCapability.Applications.CalendarData
1302   * @atomicservice
1303   * @since 18
1304   */
1305  export enum AttendeeType {
1306    /**
1307     * A mailbox user who is a required attendee to the meeting.
1308     * @syscap SystemCapability.Applications.CalendarData
1309     * @atomicservice
1310     * @since 18
1311     */
1312    REQUIRED = 1,
1313
1314    /**
1315     * A mailbox user who is an optional attendee to the meeting.
1316     * @syscap SystemCapability.Applications.CalendarData
1317     * @atomicservice
1318     * @since 18
1319     */
1320    OPTIONAL = 2,
1321
1322    /**
1323     * A resource such as a TV or projector that is scheduled for use in the meeting.
1324     * @syscap SystemCapability.Applications.CalendarData
1325     * @atomicservice
1326     * @since 18
1327     */
1328    RESOURCE = 3
1329  }
1330
1331  /**
1332   * Enum for the attendee states
1333   * @enum { number }
1334   * @syscap SystemCapability.Applications.CalendarData
1335   * @atomicservice
1336   * @since 18
1337   */
1338  export enum AttendeeStatus {
1339    /**
1340     * The acceptance status of the participant is unknown.
1341     * @syscap SystemCapability.Applications.CalendarData
1342     * @atomicservice
1343     * @since 18
1344     */
1345    UNKNOWN = 0,
1346
1347    /**
1348     * The acceptance status of the participant is tentative.
1349     * @syscap SystemCapability.Applications.CalendarData
1350     * @atomicservice
1351     * @since 18
1352     */
1353    TENTATIVE = 1,
1354
1355    /**
1356     * The acceptance status of the participant is accepted.
1357     * @syscap SystemCapability.Applications.CalendarData
1358     * @atomicservice
1359     * @since 18
1360     */
1361    ACCEPTED = 2,
1362
1363    /**
1364     * The acceptance status of the participant is declined.
1365     * @syscap SystemCapability.Applications.CalendarData
1366     * @atomicservice
1367     * @since 18
1368     */
1369    DECLINED = 3,
1370
1371    /**
1372     * The acceptance status of the participant is unresponsive.
1373     * @syscap SystemCapability.Applications.CalendarData
1374     * @atomicservice
1375     * @since 18
1376     */
1377    UNRESPONSIVE = 4,
1378  }
1379
1380  /**
1381   * Defines event service information
1382   * @typedef EventService
1383   * @syscap SystemCapability.Applications.CalendarData
1384   * @since 10
1385   */
1386  /**
1387   * Defines event service information
1388   * @typedef EventService
1389   * @syscap SystemCapability.Applications.CalendarData
1390   * @atomicservice
1391   * @since 11
1392   */
1393  export interface EventService {
1394    /**
1395     * Type of the EventService.
1396     * @type { ServiceType }
1397     * @syscap SystemCapability.Applications.CalendarData
1398     * @since 10
1399     */
1400    /**
1401     * Type of the EventService.
1402     * @type { ServiceType }
1403     * @syscap SystemCapability.Applications.CalendarData
1404     * @atomicservice
1405     * @since 11
1406     */
1407    type: ServiceType;
1408
1409    /**
1410     * Uri of the EventService.
1411     * @type { string }
1412     * @syscap SystemCapability.Applications.CalendarData
1413     * @since 10
1414     */
1415    /**
1416     * Uri of the EventService.
1417     * @type { string }
1418     * @syscap SystemCapability.Applications.CalendarData
1419     * @atomicservice
1420     * @since 11
1421     */
1422    uri: string;
1423
1424    /**
1425     * Description of the EventService.
1426     * @type { ?string }
1427     * @syscap SystemCapability.Applications.CalendarData
1428     * @since 10
1429     */
1430    /**
1431     * Description of the EventService.
1432     * @type { ?string }
1433     * @syscap SystemCapability.Applications.CalendarData
1434     * @atomicservice
1435     * @since 11
1436     */
1437    description?: string;
1438  }
1439
1440  /**
1441   * Defines event service type
1442   * @enum { string }
1443   * @syscap SystemCapability.Applications.CalendarData
1444   * @since 10
1445   */
1446  /**
1447   * Defines event service type
1448   * @enum { string }
1449   * @syscap SystemCapability.Applications.CalendarData
1450   * @atomicservice
1451   * @since 11
1452   */
1453  export enum ServiceType {
1454    /**
1455     * Meeting event.
1456     * @syscap SystemCapability.Applications.CalendarData
1457     * @since 10
1458     */
1459    /**
1460     * Meeting event.
1461     * @syscap SystemCapability.Applications.CalendarData
1462     * @atomicservice
1463     * @since 11
1464     */
1465    MEETING = 'Meeting',
1466
1467    /**
1468     * Watch drama event.
1469     * @syscap SystemCapability.Applications.CalendarData
1470     * @since 10
1471     */
1472    /**
1473     * Watch drama event.
1474     * @syscap SystemCapability.Applications.CalendarData
1475     * @atomicservice
1476     * @since 11
1477     */
1478    WATCHING = 'Watching',
1479
1480    /**
1481     * Repayment event.
1482     * @syscap SystemCapability.Applications.CalendarData
1483     * @since 10
1484     */
1485    /**
1486     * Repayment event.
1487     * @syscap SystemCapability.Applications.CalendarData
1488     * @atomicservice
1489     * @since 11
1490     */
1491    REPAYMENT = 'Repayment',
1492
1493    /**
1494     * Live event.
1495     * @syscap SystemCapability.Applications.CalendarData
1496     * @since 10
1497     */
1498    /**
1499     * Live event.
1500     * @syscap SystemCapability.Applications.CalendarData
1501     * @atomicservice
1502     * @since 11
1503     */
1504    LIVE = 'Live',
1505
1506    /**
1507     * Shopping event.
1508     * @syscap SystemCapability.Applications.CalendarData
1509     * @since 10
1510     */
1511    /**
1512     * Shopping event.
1513     * @syscap SystemCapability.Applications.CalendarData
1514     * @atomicservice
1515     * @since 11
1516     */
1517    SHOPPING = 'Shopping',
1518
1519    /**
1520     * trip event.
1521     * @syscap SystemCapability.Applications.CalendarData
1522     * @since 10
1523     */
1524    /**
1525     * trip event.
1526     * @syscap SystemCapability.Applications.CalendarData
1527     * @atomicservice
1528     * @since 11
1529     */
1530    TRIP = 'Trip',
1531
1532    /**
1533     * Class event.
1534     * @syscap SystemCapability.Applications.CalendarData
1535     * @since 10
1536     */
1537    /**
1538     * Class event.
1539     * @syscap SystemCapability.Applications.CalendarData
1540     * @atomicservice
1541     * @since 11
1542     */
1543    CLASS = 'Class',
1544
1545    /**
1546     * Sports game event.
1547     * @syscap SystemCapability.Applications.CalendarData
1548     * @since 10
1549     */
1550    /**
1551     * Sports game event.
1552     * @syscap SystemCapability.Applications.CalendarData
1553     * @atomicservice
1554     * @since 11
1555     */
1556    SPORTS_EVENTS = 'SportsEvents',
1557
1558    /**
1559     * Sports exercise event.
1560     * @syscap SystemCapability.Applications.CalendarData
1561     * @since 10
1562     */
1563    /**
1564     * Sports exercise event.
1565     * @syscap SystemCapability.Applications.CalendarData
1566     * @atomicservice
1567     * @since 11
1568     */
1569    SPORTS_EXERCISE = 'SportsExercise',
1570  }
1571}
1572
1573export default calendarManager;