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 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 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 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 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 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 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 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 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 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 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 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 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 /** 448 * Describes a calendar account. 449 * @typedef CalendarAccount 450 * @syscap SystemCapability.Applications.CalendarData 451 * @since 10 452 */ 453 /** 454 * Describes a calendar account. 455 * @typedef CalendarAccount 456 * @syscap SystemCapability.Applications.CalendarData 457 * @atomicservice 458 * @since 11 459 */ 460 interface CalendarAccount { 461 /** 462 * Name of the calendar 463 * @type { string } 464 * @readonly 465 * @syscap SystemCapability.Applications.CalendarData 466 * @since 10 467 */ 468 /** 469 * Name of the calendar 470 * @type { string } 471 * @readonly 472 * @syscap SystemCapability.Applications.CalendarData 473 * @atomicservice 474 * @since 11 475 */ 476 readonly name: string; 477 478 /** 479 * Type of the calendar 480 * @type { CalendarType } 481 * @syscap SystemCapability.Applications.CalendarData 482 * @since 10 483 */ 484 /** 485 * Type of the calendar 486 * @type { CalendarType } 487 * @syscap SystemCapability.Applications.CalendarData 488 * @atomicservice 489 * @since 11 490 */ 491 type: CalendarType; 492 493 /** 494 * DisplayName of the calendar 495 * @type { ?string } 496 * @syscap SystemCapability.Applications.CalendarData 497 * @since 10 498 */ 499 /** 500 * DisplayName of the calendar 501 * @type { ?string } 502 * @syscap SystemCapability.Applications.CalendarData 503 * @atomicservice 504 * @since 11 505 */ 506 displayName?: string 507 } 508 509 /** 510 * Describes a calendar configuration. 511 * @typedef CalendarConfig 512 * @syscap SystemCapability.Applications.CalendarData 513 * @since 10 514 */ 515 interface CalendarConfig { 516 /** 517 * Whether the calendar provides a reminder 518 * @type { ?boolean } 519 * @syscap SystemCapability.Applications.CalendarData 520 * @since 10 521 */ 522 enableReminder?: boolean; 523 524 /** 525 * Color of the calendar 526 * @type { ?(number | string) } 527 * @syscap SystemCapability.Applications.CalendarData 528 * @since 10 529 */ 530 color?: number | string; 531 } 532 533 /** 534 * Describes an event information. 535 * @typedef Event 536 * @syscap SystemCapability.Applications.CalendarData 537 * @since 10 538 */ 539 /** 540 * Describes an event information. 541 * @typedef Event 542 * @syscap SystemCapability.Applications.CalendarData 543 * @atomicservice 544 * @since 11 545 */ 546 interface Event { 547 /** 548 * Id of the event 549 * @type { ?number } 550 * @syscap SystemCapability.Applications.CalendarData 551 * @since 10 552 */ 553 /** 554 * Id of the event 555 * @type { ?number } 556 * @syscap SystemCapability.Applications.CalendarData 557 * @atomicservice 558 * @since 11 559 */ 560 id?: number; 561 562 /** 563 * Type of the event 564 * @type { EventType } 565 * @syscap SystemCapability.Applications.CalendarData 566 * @since 10 567 */ 568 /** 569 * Type of the event 570 * @type { EventType } 571 * @syscap SystemCapability.Applications.CalendarData 572 * @atomicservice 573 * @since 11 574 */ 575 type: EventType; 576 577 /** 578 * Title of the event 579 * @type { ?string } 580 * @syscap SystemCapability.Applications.CalendarData 581 * @since 10 582 */ 583 /** 584 * Title of the event 585 * @type { ?string } 586 * @syscap SystemCapability.Applications.CalendarData 587 * @atomicservice 588 * @since 11 589 */ 590 title?: string; 591 592 /** 593 * Location of the event 594 * @type { ?Location } 595 * @syscap SystemCapability.Applications.CalendarData 596 * @since 10 597 */ 598 /** 599 * Location of the event 600 * @type { ?Location } 601 * @syscap SystemCapability.Applications.CalendarData 602 * @atomicservice 603 * @since 11 604 */ 605 location?: Location; 606 607 /** 608 * start time of the event 609 * @type { number } 610 * @syscap SystemCapability.Applications.CalendarData 611 * @since 10 612 */ 613 /** 614 * start time of the event 615 * @type { number } 616 * @syscap SystemCapability.Applications.CalendarData 617 * @atomicservice 618 * @since 11 619 */ 620 startTime: number; 621 622 /** 623 * end time of the event 624 * @type { number } 625 * @syscap SystemCapability.Applications.CalendarData 626 * @since 10 627 */ 628 /** 629 * end time of the event 630 * @type { number } 631 * @syscap SystemCapability.Applications.CalendarData 632 * @atomicservice 633 * @since 11 634 */ 635 endTime: number; 636 637 /** 638 * Whether the event is allDay 639 * @type { ?boolean } 640 * @syscap SystemCapability.Applications.CalendarData 641 * @since 10 642 */ 643 /** 644 * Whether the event is allDay 645 * @type { ?boolean } 646 * @syscap SystemCapability.Applications.CalendarData 647 * @atomicservice 648 * @since 11 649 */ 650 isAllDay?: boolean; 651 652 /** 653 * Attendees of the event 654 * @type { ?Attendee[] } 655 * @syscap SystemCapability.Applications.CalendarData 656 * @since 10 657 */ 658 /** 659 * Attendees of the event 660 * @type { ?Attendee[] } 661 * @syscap SystemCapability.Applications.CalendarData 662 * @atomicservice 663 * @since 11 664 */ 665 attendee?: Attendee[]; 666 667 /** 668 * TimeZone of the event 669 * @type { ?string } 670 * @syscap SystemCapability.Applications.CalendarData 671 * @since 10 672 */ 673 /** 674 * TimeZone of the event 675 * @type { ?string } 676 * @syscap SystemCapability.Applications.CalendarData 677 * @atomicservice 678 * @since 11 679 */ 680 timeZone?: string; 681 682 /** 683 * Reminder time of the event 684 * @type { ?number[] } 685 * @syscap SystemCapability.Applications.CalendarData 686 * @since 10 687 */ 688 /** 689 * Reminder time of the event 690 * @type { ?number[] } 691 * @syscap SystemCapability.Applications.CalendarData 692 * @atomicservice 693 * @since 11 694 */ 695 reminderTime?: number[]; 696 697 /** 698 * RecurrenceRule of the event 699 * @type { ?RecurrenceRule } 700 * @syscap SystemCapability.Applications.CalendarData 701 * @since 10 702 */ 703 /** 704 * RecurrenceRule of the event 705 * @type { ?RecurrenceRule } 706 * @syscap SystemCapability.Applications.CalendarData 707 * @atomicservice 708 * @since 11 709 */ 710 recurrenceRule?: RecurrenceRule; 711 712 /** 713 * Description of the event 714 * @type { ?string } 715 * @syscap SystemCapability.Applications.CalendarData 716 * @since 10 717 */ 718 /** 719 * Description of the event 720 * @type { ?string } 721 * @syscap SystemCapability.Applications.CalendarData 722 * @atomicservice 723 * @since 11 724 */ 725 description?: string; 726 727 /** 728 * Service of the event 729 * @type { ?EventService } 730 * @syscap SystemCapability.Applications.CalendarData 731 * @since 10 732 */ 733 /** 734 * Service of the event 735 * @type { ?EventService } 736 * @syscap SystemCapability.Applications.CalendarData 737 * @atomicservice 738 * @since 11 739 */ 740 service?: EventService; 741 742 /** 743 * Unique identifier of the event 744 * @type { ?string } 745 * @syscap SystemCapability.Applications.CalendarData 746 * @atomicservice 747 * @since 12 748 */ 749 identifier?: string; 750 751 /** 752 * Whether the event is lunar. 753 * @type { ?boolean } 754 * @syscap SystemCapability.Applications.CalendarData 755 * @atomicservice 756 * @since 12 757 */ 758 isLunar?: boolean; 759 } 760 761 /** 762 * Enum for all calendar type. 763 * @enum { string } 764 * @syscap SystemCapability.Applications.CalendarData 765 * @since 10 766 */ 767 /** 768 * Enum for all calendar type. 769 * @enum { string } 770 * @syscap SystemCapability.Applications.CalendarData 771 * @atomicservice 772 * @since 11 773 */ 774 enum CalendarType { 775 /** 776 * Local calendar 777 * @syscap SystemCapability.Applications.CalendarData 778 * @since 10 779 */ 780 /** 781 * Local calendar 782 * @syscap SystemCapability.Applications.CalendarData 783 * @atomicservice 784 * @since 11 785 */ 786 LOCAL = 'local', 787 788 /** 789 * Email calendar 790 * @syscap SystemCapability.Applications.CalendarData 791 * @since 10 792 */ 793 /** 794 * Email calendar 795 * @syscap SystemCapability.Applications.CalendarData 796 * @atomicservice 797 * @since 11 798 */ 799 EMAIL = 'email', 800 801 /** 802 * Birthday calendar 803 * @syscap SystemCapability.Applications.CalendarData 804 * @since 10 805 */ 806 /** 807 * Birthday calendar 808 * @syscap SystemCapability.Applications.CalendarData 809 * @atomicservice 810 * @since 11 811 */ 812 BIRTHDAY = 'birthday', 813 814 /** 815 * CalDAV calendar 816 * @syscap SystemCapability.Applications.CalendarData 817 * @since 10 818 */ 819 /** 820 * CalDAV calendar 821 * @syscap SystemCapability.Applications.CalendarData 822 * @atomicservice 823 * @since 11 824 */ 825 CALDAV = 'caldav', 826 827 /** 828 * Subscribed calendar 829 * @syscap SystemCapability.Applications.CalendarData 830 * @since 10 831 */ 832 /** 833 * Subscribed calendar 834 * @syscap SystemCapability.Applications.CalendarData 835 * @atomicservice 836 * @since 11 837 */ 838 SUBSCRIBED = 'subscribed' 839 } 840 841 /** 842 * Location of an event. 843 * @typedef Location 844 * @syscap SystemCapability.Applications.CalendarData 845 * @since 10 846 */ 847 /** 848 * Location of an event. 849 * @typedef Location 850 * @syscap SystemCapability.Applications.CalendarData 851 * @atomicservice 852 * @since 11 853 */ 854 interface Location { 855 /** 856 * Location of the event 857 * @type { ?string } 858 * @syscap SystemCapability.Applications.CalendarData 859 * @since 10 860 */ 861 /** 862 * Location of the event 863 * @type { ?string } 864 * @syscap SystemCapability.Applications.CalendarData 865 * @atomicservice 866 * @since 11 867 */ 868 location?: string; 869 870 /** 871 * Longitude of the location 872 * @type { ?number } 873 * @syscap SystemCapability.Applications.CalendarData 874 * @since 10 875 */ 876 /** 877 * Longitude of the location 878 * @type { ?number } 879 * @syscap SystemCapability.Applications.CalendarData 880 * @atomicservice 881 * @since 11 882 */ 883 longitude?: number; 884 885 /** 886 * Latitude of the location 887 * @type { ?number } 888 * @syscap SystemCapability.Applications.CalendarData 889 * @since 10 890 */ 891 /** 892 * Latitude of the location 893 * @type { ?number } 894 * @syscap SystemCapability.Applications.CalendarData 895 * @atomicservice 896 * @since 11 897 */ 898 latitude?: number; 899 } 900 901 /** 902 * Provides the abilities to retrive event filter. 903 * @syscap SystemCapability.Applications.CalendarData 904 * @since 10 905 */ 906 class EventFilter { 907 /** 908 * Filter events by event id. 909 * @param {number[]} ids id array to retrieve 910 * @returns { EventFilter } Returns the EventFilter with ids. 911 * @syscap SystemCapability.Applications.CalendarData 912 * @since 10 913 */ 914 static filterById(ids: number[]): EventFilter; 915 916 /** 917 * Filter events by event start time and end time. 918 * @param { number } start - start time of query range 919 * @param { number } end - end time of query range 920 * @returns { EventFilter } Returns the EventFilter with time range. 921 * @syscap SystemCapability.Applications.CalendarData 922 * @since 10 923 */ 924 static filterByTime(start: number, end: number): EventFilter; 925 926 /** 927 * Filter events by event title. 928 * @param { string } title - event title to query 929 * @returns {EventFilter } Returns the EventFilter with title. 930 * @syscap SystemCapability.Applications.CalendarData 931 * @since 10 932 */ 933 static filterByTitle(title: string): EventFilter; 934 } 935 936 /** 937 * Enum for supported events type. 938 * @enum { number } 939 * @syscap SystemCapability.Applications.CalendarData 940 * @since 10 941 */ 942 /** 943 * Enum for supported events type. 944 * @enum { number } 945 * @syscap SystemCapability.Applications.CalendarData 946 * @atomicservice 947 * @since 11 948 */ 949 enum EventType { 950 /** 951 * normal event. 952 * @syscap SystemCapability.Applications.CalendarData 953 * @since 10 954 */ 955 /** 956 * normal event. 957 * @syscap SystemCapability.Applications.CalendarData 958 * @atomicservice 959 * @since 11 960 */ 961 NORMAL = 0, 962 963 /** 964 * important event. 965 * @syscap SystemCapability.Applications.CalendarData 966 * @since 10 967 */ 968 /** 969 * important event. 970 * @syscap SystemCapability.Applications.CalendarData 971 * @atomicservice 972 * @since 11 973 */ 974 IMPORTANT = 1, 975 } 976 977 /** 978 * Defines the recurrence rule of event 979 * @typedef RecurrenceRule 980 * @syscap SystemCapability.Applications.CalendarData 981 * @since 10 982 */ 983 /** 984 * Defines the recurrence rule of event 985 * @typedef RecurrenceRule 986 * @syscap SystemCapability.Applications.CalendarData 987 * @atomicservice 988 * @since 11 989 */ 990 export interface RecurrenceRule { 991 /** 992 * RecurrenceFrequency of recurrence event. 993 * @type { RecurrenceFrequency } 994 * @syscap SystemCapability.Applications.CalendarData 995 * @since 10 996 */ 997 /** 998 * RecurrenceFrequency of recurrence event. 999 * @type { RecurrenceFrequency } 1000 * @syscap SystemCapability.Applications.CalendarData 1001 * @atomicservice 1002 * @since 11 1003 */ 1004 recurrenceFrequency: RecurrenceFrequency; 1005 1006 /** 1007 * Expiration time of recurrence event. 1008 * @type { ?number } 1009 * @syscap SystemCapability.Applications.CalendarData 1010 * @since 10 1011 */ 1012 /** 1013 * Expiration time of recurrence event. 1014 * @type { ?number } 1015 * @syscap SystemCapability.Applications.CalendarData 1016 * @atomicservice 1017 * @since 11 1018 */ 1019 expire?: number; 1020 1021 /** 1022 * Repetition count of recurrence event. 1023 * @type { ?number } 1024 * @syscap SystemCapability.Applications.CalendarData 1025 * @atomicservice 1026 * @since 12 1027 */ 1028 count?: number; 1029 1030 /** 1031 * Repeat interval of recurrence event. 1032 * @type { ?number } 1033 * @syscap SystemCapability.Applications.CalendarData 1034 * @atomicservice 1035 * @since 12 1036 */ 1037 interval?: number; 1038 1039 /** 1040 * Excluded dates of recurrence event. 1041 * @type { ?number[] } 1042 * @syscap SystemCapability.Applications.CalendarData 1043 * @atomicservice 1044 * @since 12 1045 */ 1046 excludedDates?: number[]; 1047 1048 /** 1049 * The days of the week associated with the recurrence event. 1050 * @type { ?number[] } 1051 * @syscap SystemCapability.Applications.CalendarData 1052 * @atomicservice 1053 * @since 12 1054 */ 1055 daysOfWeek?: number[]; 1056 1057 /** 1058 * The days of the month associated with the recurrence event. 1059 * @type { ?number[] } 1060 * @syscap SystemCapability.Applications.CalendarData 1061 * @atomicservice 1062 * @since 12 1063 */ 1064 daysOfMonth?: number[]; 1065 1066 /** 1067 * The days of the year associated with the recurrence event. 1068 * @type { ?number[] } 1069 * @syscap SystemCapability.Applications.CalendarData 1070 * @atomicservice 1071 * @since 12 1072 */ 1073 daysOfYear?: number[]; 1074 1075 /** 1076 * The weeks of the month associated with the recurrence event. 1077 * @type { ?number[] } 1078 * @syscap SystemCapability.Applications.CalendarData 1079 * @atomicservice 1080 * @since 12 1081 */ 1082 weeksOfMonth?: number[]; 1083 1084 /** 1085 * The weeks of the year associated with the recurrence event. 1086 * @type { ?number[] } 1087 * @syscap SystemCapability.Applications.CalendarData 1088 * @atomicservice 1089 * @since 12 1090 */ 1091 weeksOfYear?: number[]; 1092 1093 /** 1094 * The months of the year associated with the recurrence event. 1095 * @type { ?number[] } 1096 * @syscap SystemCapability.Applications.CalendarData 1097 * @atomicservice 1098 * @since 12 1099 */ 1100 monthsOfYear?: number[]; 1101 } 1102 1103 /** 1104 * Enum for the recurrence type by different period 1105 * @enum { number } 1106 * @syscap SystemCapability.Applications.CalendarData 1107 * @since 10 1108 */ 1109 /** 1110 * Enum for the recurrence type by different period 1111 * @enum { number } 1112 * @syscap SystemCapability.Applications.CalendarData 1113 * @atomicservice 1114 * @since 11 1115 */ 1116 export enum RecurrenceFrequency { 1117 /** 1118 * The event repeats every year. 1119 * @syscap SystemCapability.Applications.CalendarData 1120 * @since 10 1121 */ 1122 /** 1123 * The event repeats every year. 1124 * @syscap SystemCapability.Applications.CalendarData 1125 * @atomicservice 1126 * @since 11 1127 */ 1128 YEARLY = 0, 1129 1130 /** 1131 * The event repeats every month. 1132 * @syscap SystemCapability.Applications.CalendarData 1133 * @since 10 1134 */ 1135 /** 1136 * The event repeats every month. 1137 * @syscap SystemCapability.Applications.CalendarData 1138 * @atomicservice 1139 * @since 11 1140 */ 1141 MONTHLY = 1, 1142 1143 /** 1144 * The event repeats every week. 1145 * @syscap SystemCapability.Applications.CalendarData 1146 * @since 10 1147 */ 1148 /** 1149 * The event repeats every week. 1150 * @syscap SystemCapability.Applications.CalendarData 1151 * @atomicservice 1152 * @since 11 1153 */ 1154 WEEKLY = 2, 1155 1156 /** 1157 * The event repeats every day. 1158 * @syscap SystemCapability.Applications.CalendarData 1159 * @since 10 1160 */ 1161 /** 1162 * The event repeats every day. 1163 * @syscap SystemCapability.Applications.CalendarData 1164 * @atomicservice 1165 * @since 11 1166 */ 1167 DAILY = 3, 1168 } 1169 1170 /** 1171 * Defines the attendee information 1172 * @typedef Attendee 1173 * @syscap SystemCapability.Applications.CalendarData 1174 * @since 10 1175 */ 1176 /** 1177 * Defines the attendee information 1178 * @typedef Attendee 1179 * @syscap SystemCapability.Applications.CalendarData 1180 * @atomicservice 1181 * @since 11 1182 */ 1183 export interface Attendee { 1184 /** 1185 * Name of the Attendee. 1186 * @type { string } 1187 * @syscap SystemCapability.Applications.CalendarData 1188 * @since 10 1189 */ 1190 /** 1191 * Name of the Attendee. 1192 * @type { string } 1193 * @syscap SystemCapability.Applications.CalendarData 1194 * @atomicservice 1195 * @since 11 1196 */ 1197 name: string; 1198 1199 /** 1200 * Email of the Attendee. 1201 * @type { string } 1202 * @syscap SystemCapability.Applications.CalendarData 1203 * @since 10 1204 */ 1205 /** 1206 * Email of the Attendee. 1207 * @type { string } 1208 * @syscap SystemCapability.Applications.CalendarData 1209 * @atomicservice 1210 * @since 11 1211 */ 1212 email: string; 1213 1214 /** 1215 * Role of the Attendee. 1216 * @type { ?AttendeeRole } 1217 * @syscap SystemCapability.Applications.CalendarData 1218 * @atomicservice 1219 * @since 12 1220 */ 1221 role?: AttendeeRole; 1222 } 1223 1224 /** 1225 * Enum for the attendee role 1226 * @enum { string } 1227 * @syscap SystemCapability.Applications.CalendarData 1228 * @atomicservice 1229 * @since 12 1230 */ 1231 export enum AttendeeRole { 1232 /** 1233 * The organizer of a meeting. 1234 * @syscap SystemCapability.Applications.CalendarData 1235 * @atomicservice 1236 * @since 12 1237 */ 1238 ORGANIZER = 'organizer', 1239 1240 /** 1241 * The participant of a meeting. 1242 * @syscap SystemCapability.Applications.CalendarData 1243 * @atomicservice 1244 * @since 12 1245 */ 1246 PARTICIPANT = 'participant' 1247 } 1248 1249 /** 1250 * Defines event service information 1251 * @typedef EventService 1252 * @syscap SystemCapability.Applications.CalendarData 1253 * @since 10 1254 */ 1255 /** 1256 * Defines event service information 1257 * @typedef EventService 1258 * @syscap SystemCapability.Applications.CalendarData 1259 * @atomicservice 1260 * @since 11 1261 */ 1262 export interface EventService { 1263 /** 1264 * Type of the EventService. 1265 * @type { ServiceType } 1266 * @syscap SystemCapability.Applications.CalendarData 1267 * @since 10 1268 */ 1269 /** 1270 * Type of the EventService. 1271 * @type { ServiceType } 1272 * @syscap SystemCapability.Applications.CalendarData 1273 * @atomicservice 1274 * @since 11 1275 */ 1276 type: ServiceType; 1277 1278 /** 1279 * Uri of the EventService. 1280 * @type { string } 1281 * @syscap SystemCapability.Applications.CalendarData 1282 * @since 10 1283 */ 1284 /** 1285 * Uri of the EventService. 1286 * @type { string } 1287 * @syscap SystemCapability.Applications.CalendarData 1288 * @atomicservice 1289 * @since 11 1290 */ 1291 uri: string; 1292 1293 /** 1294 * Description of the EventService. 1295 * @type { ?string } 1296 * @syscap SystemCapability.Applications.CalendarData 1297 * @since 10 1298 */ 1299 /** 1300 * Description of the EventService. 1301 * @type { ?string } 1302 * @syscap SystemCapability.Applications.CalendarData 1303 * @atomicservice 1304 * @since 11 1305 */ 1306 description?: string; 1307 } 1308 1309 /** 1310 * Defines event service type 1311 * @enum { string } 1312 * @syscap SystemCapability.Applications.CalendarData 1313 * @since 10 1314 */ 1315 /** 1316 * Defines event service type 1317 * @enum { string } 1318 * @syscap SystemCapability.Applications.CalendarData 1319 * @atomicservice 1320 * @since 11 1321 */ 1322 export enum ServiceType { 1323 /** 1324 * Meeting event. 1325 * @syscap SystemCapability.Applications.CalendarData 1326 * @since 10 1327 */ 1328 /** 1329 * Meeting event. 1330 * @syscap SystemCapability.Applications.CalendarData 1331 * @atomicservice 1332 * @since 11 1333 */ 1334 MEETING = 'Meeting', 1335 1336 /** 1337 * Watch drama event. 1338 * @syscap SystemCapability.Applications.CalendarData 1339 * @since 10 1340 */ 1341 /** 1342 * Watch drama event. 1343 * @syscap SystemCapability.Applications.CalendarData 1344 * @atomicservice 1345 * @since 11 1346 */ 1347 WATCHING = 'Watching', 1348 1349 /** 1350 * Repayment event. 1351 * @syscap SystemCapability.Applications.CalendarData 1352 * @since 10 1353 */ 1354 /** 1355 * Repayment event. 1356 * @syscap SystemCapability.Applications.CalendarData 1357 * @atomicservice 1358 * @since 11 1359 */ 1360 REPAYMENT = 'Repayment', 1361 1362 /** 1363 * Live event. 1364 * @syscap SystemCapability.Applications.CalendarData 1365 * @since 10 1366 */ 1367 /** 1368 * Live event. 1369 * @syscap SystemCapability.Applications.CalendarData 1370 * @atomicservice 1371 * @since 11 1372 */ 1373 LIVE = 'Live', 1374 1375 /** 1376 * Shopping event. 1377 * @syscap SystemCapability.Applications.CalendarData 1378 * @since 10 1379 */ 1380 /** 1381 * Shopping event. 1382 * @syscap SystemCapability.Applications.CalendarData 1383 * @atomicservice 1384 * @since 11 1385 */ 1386 SHOPPING = 'Shopping', 1387 1388 /** 1389 * trip event. 1390 * @syscap SystemCapability.Applications.CalendarData 1391 * @since 10 1392 */ 1393 /** 1394 * trip event. 1395 * @syscap SystemCapability.Applications.CalendarData 1396 * @atomicservice 1397 * @since 11 1398 */ 1399 TRIP = 'Trip', 1400 1401 /** 1402 * Class event. 1403 * @syscap SystemCapability.Applications.CalendarData 1404 * @since 10 1405 */ 1406 /** 1407 * Class event. 1408 * @syscap SystemCapability.Applications.CalendarData 1409 * @atomicservice 1410 * @since 11 1411 */ 1412 CLASS = 'Class', 1413 1414 /** 1415 * Sports game event. 1416 * @syscap SystemCapability.Applications.CalendarData 1417 * @since 10 1418 */ 1419 /** 1420 * Sports game event. 1421 * @syscap SystemCapability.Applications.CalendarData 1422 * @atomicservice 1423 * @since 11 1424 */ 1425 SPORTS_EVENTS = 'SportsEvents', 1426 1427 /** 1428 * Sports exercise event. 1429 * @syscap SystemCapability.Applications.CalendarData 1430 * @since 10 1431 */ 1432 /** 1433 * Sports exercise event. 1434 * @syscap SystemCapability.Applications.CalendarData 1435 * @atomicservice 1436 * @since 11 1437 */ 1438 SPORTS_EXERCISE = 'SportsExercise', 1439 } 1440} 1441 1442export default calendarManager;