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 * @interface 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 * @interface 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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 - The parameter check failed. 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.WRITE_WHOLE_CALENDAR 213 * @returns { Promise<Calendar[]> } the promise returned by the function. 214 * @throws { BusinessError } 201 - Permission denied. 215 * @throws { BusinessError } 401 - The parameter check failed. 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 - The parameter check failed. 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 /** 237 * Describes a calendar instance. 238 * @interface Calendar 239 * @syscap SystemCapability.Applications.CalendarData 240 * @since 10 241 */ 242 /** 243 * Describes a calendar instance. 244 * @interface Calendar 245 * @syscap SystemCapability.Applications.CalendarData 246 * @atomicservice 247 * @since 11 248 */ 249 export interface Calendar { 250 /** 251 * Id of the calendar 252 * @type { number } 253 * @readonly 254 * @syscap SystemCapability.Applications.CalendarData 255 * @since 10 256 */ 257 /** 258 * Id of the calendar 259 * @type { number } 260 * @readonly 261 * @syscap SystemCapability.Applications.CalendarData 262 * @atomicservice 263 * @since 11 264 */ 265 readonly id: number 266 267 /** 268 * Add a single event. 269 * @param { Event } event - Indicates the information about a single event. 270 * @returns { Promise<number> } The event ID. 271 * @syscap SystemCapability.Applications.CalendarData 272 * @since 10 273 */ 274 /** 275 * Add a single event. 276 * @param { Event } event - Indicates the information about a single event. 277 * @returns { Promise<number> } The event ID. 278 * @syscap SystemCapability.Applications.CalendarData 279 * @atomicservice 280 * @since 11 281 */ 282 addEvent(event: Event): Promise<number>; 283 284 /** 285 * Add a single event. 286 * @param { Event } event - a single event to add. 287 * @param { AsyncCallback<number> } callback - callback of addEvent. 288 * @syscap SystemCapability.Applications.CalendarData 289 * @since 10 290 */ 291 /** 292 * Add a single event. 293 * @param { Event } event - a single event to add. 294 * @param { AsyncCallback<number> } callback - callback of addEvent. 295 * @syscap SystemCapability.Applications.CalendarData 296 * @atomicservice 297 * @since 11 298 */ 299 addEvent(event: Event, callback: AsyncCallback<number>): void; 300 301 /** 302 * Add multiple events. 303 * @param { Event[] } events - multiple events to add. 304 * @returns { Promise<void> } The promise returned by function. 305 * @syscap SystemCapability.Applications.CalendarData 306 * @since 10 307 */ 308 addEvents(events: Event[]): Promise<void>; 309 310 /** 311 * Add multiple events. 312 * @param { Event[] } events - Indicates the information about multiple events. 313 * @param { AsyncCallback<void> } callback - The callback of addEvents 314 * @syscap SystemCapability.Applications.CalendarData 315 * @since 10 316 */ 317 addEvents(events: Event[], callback: AsyncCallback<void>): void; 318 319 /** 320 * Delete a single event. 321 * @param { number } id - Indicates the ID of an event. 322 * @returns { Promise<void> } The promise returned by function. 323 * @syscap SystemCapability.Applications.CalendarData 324 * @since 10 325 */ 326 deleteEvent(id: number): Promise<void>; 327 328 /** 329 * Delete a single event. 330 * @param { number } id - Indicates the ID of an event. 331 * @param {AsyncCallback<void>} callback - The callback of deleteEvent. 332 * @syscap SystemCapability.Applications.CalendarData 333 * @since 10 334 */ 335 deleteEvent(id: number, callback: AsyncCallback<void>): void; 336 337 /** 338 * Delete multiple events. 339 * @param { number[] } ids - The id array of multiple events. 340 * @returns { Promise<void> } The promise returned by function. 341 * @syscap SystemCapability.Applications.CalendarData 342 * @since 10 343 */ 344 deleteEvents(ids: number[]): Promise<void>; 345 346 /** 347 * Delete multiple events. 348 * @param { number[] } ids - Indicates the IDs of multiple events. 349 * @param {AsyncCallback<void>} callback - The callback of deleteEvents. 350 * @syscap SystemCapability.Applications.CalendarData 351 * @since 10 352 */ 353 deleteEvents(ids: number[], callback: AsyncCallback<void>): void; 354 355 /** 356 * Update a single event. 357 * @param { Event } event - Indicates the information about a single event. 358 * @returns { Promise<void> } The promise returned by function. 359 * @syscap SystemCapability.Applications.CalendarData 360 * @since 10 361 */ 362 updateEvent(event: Event): Promise<void>; 363 364 /** 365 * Update a single event. 366 * @param { Event } event - Indicates the information about a single event. 367 * @param { AsyncCallback<void> } callback - The callback of updateEvent. 368 * @syscap SystemCapability.Applications.CalendarData 369 * @since 10 370 */ 371 updateEvent(event: Event, callback: AsyncCallback<void>): void; 372 373 /** 374 * Query events based on filter conditions. 375 * @param { EventFilter } eventFilter - Indicates the filtering conditions of events. 376 * @param { (keyof Event)[] } eventKey - Expected column to be returned. 377 * @returns { Promise<Event[]> } Information about events that match the filter conditions. 378 * @syscap SystemCapability.Applications.CalendarData 379 * @since 10 380 */ 381 getEvents(eventFilter?: EventFilter, eventKey?: (keyof Event)[]): Promise<Event[]>; 382 383 /** 384 * Query events based on filter conditions. 385 * @param { EventFilter } eventFilter - Indicates the filtering conditions of events. 386 * @param { (keyof Event)[] } eventKey - Expected column to be returned. 387 * @param { AsyncCallback<Event[]> } callback - The callback of getEvents. 388 * @syscap SystemCapability.Applications.CalendarData 389 * @since 10 390 */ 391 getEvents(eventFilter: EventFilter, eventKey: (keyof Event)[], callback: AsyncCallback<Event[]>):void; 392 393 /** 394 * Query all events with all column from current calendar instance. 395 * @param { AsyncCallback<Event[]> } callback - The callback of getEvents with all events. 396 * @syscap SystemCapability.Applications.CalendarData 397 * @since 10 398 */ 399 getEvents(callback: AsyncCallback<Event[]>):void; 400 401 /** 402 * Get calendar configure. 403 * @returns { CalendarConfig } configure of current calendar. 404 * @syscap SystemCapability.Applications.CalendarData 405 * @since 10 406 */ 407 getConfig(): CalendarConfig; 408 409 /** 410 * Set calendar configure. 411 * @param { CalendarConfig } config - calendar config to set 412 * @returns { Promise<void> } The promise returned by function. 413 * @syscap SystemCapability.Applications.CalendarData 414 * @since 10 415 */ 416 setConfig(config: CalendarConfig): Promise<void>; 417 418 /** 419 * Set calendar configure. 420 * @param { CalendarConfig } config - calendar config to set 421 * @param { AsyncCallback<void> } callback - callback of setConfig 422 * @syscap SystemCapability.Applications.CalendarData 423 * @since 10 424 */ 425 setConfig(config: CalendarConfig, callback: AsyncCallback<void>): void; 426 427 /** 428 * Get calendar account. 429 * @returns { CalendarAccount } calendar account of current calendar. 430 * @syscap SystemCapability.Applications.CalendarData 431 * @since 10 432 */ 433 getAccount(): CalendarAccount; 434 } 435 436 /** 437 * Describes a calendar account. 438 * @interface CalendarAccount 439 * @syscap SystemCapability.Applications.CalendarData 440 * @since 10 441 */ 442 /** 443 * Describes a calendar account. 444 * @interface CalendarAccount 445 * @syscap SystemCapability.Applications.CalendarData 446 * @atomicservice 447 * @since 11 448 */ 449 interface CalendarAccount { 450 /** 451 * Name of the calendar 452 * @type { string } 453 * @readonly 454 * @syscap SystemCapability.Applications.CalendarData 455 * @since 10 456 */ 457 /** 458 * Name of the calendar 459 * @type { string } 460 * @readonly 461 * @syscap SystemCapability.Applications.CalendarData 462 * @atomicservice 463 * @since 11 464 */ 465 readonly name: string; 466 467 /** 468 * Type of the calendar 469 * @type { CalendarType } 470 * @syscap SystemCapability.Applications.CalendarData 471 * @since 10 472 */ 473 /** 474 * Type of the calendar 475 * @type { CalendarType } 476 * @syscap SystemCapability.Applications.CalendarData 477 * @atomicservice 478 * @since 11 479 */ 480 type: CalendarType; 481 482 /** 483 * DisplayName of the calendar 484 * @type { ?string } 485 * @syscap SystemCapability.Applications.CalendarData 486 * @since 10 487 */ 488 /** 489 * DisplayName of the calendar 490 * @type { ?string } 491 * @syscap SystemCapability.Applications.CalendarData 492 * @atomicservice 493 * @since 11 494 */ 495 displayName?: string 496 } 497 498 /** 499 * Describes a calendar configuration. 500 * @interface CalendarConfig 501 * @syscap SystemCapability.Applications.CalendarData 502 * @since 10 503 */ 504 interface CalendarConfig { 505 /** 506 * Whether the calendar provides a reminder 507 * @type { ?boolean } 508 * @syscap SystemCapability.Applications.CalendarData 509 * @since 10 510 */ 511 enableReminder?: boolean; 512 513 /** 514 * Color of the calendar 515 * @type { ?(number | string) } 516 * @syscap SystemCapability.Applications.CalendarData 517 * @since 10 518 */ 519 color?: number | string; 520 } 521 522 /** 523 * Describes an event information. 524 * @interface Event 525 * @syscap SystemCapability.Applications.CalendarData 526 * @since 10 527 */ 528 /** 529 * Describes an event information. 530 * @interface Event 531 * @syscap SystemCapability.Applications.CalendarData 532 * @atomicservice 533 * @since 11 534 */ 535 interface Event { 536 /** 537 * Id of the event 538 * @type { ?number } 539 * @syscap SystemCapability.Applications.CalendarData 540 * @since 10 541 */ 542 /** 543 * Id of the event 544 * @type { ?number } 545 * @syscap SystemCapability.Applications.CalendarData 546 * @atomicservice 547 * @since 11 548 */ 549 id?: number; 550 551 /** 552 * Type of the event 553 * @type { EventType } 554 * @syscap SystemCapability.Applications.CalendarData 555 * @since 10 556 */ 557 /** 558 * Type of the event 559 * @type { EventType } 560 * @syscap SystemCapability.Applications.CalendarData 561 * @atomicservice 562 * @since 11 563 */ 564 type: EventType; 565 566 /** 567 * Title of the event 568 * @type { ?string } 569 * @syscap SystemCapability.Applications.CalendarData 570 * @since 10 571 */ 572 /** 573 * Title of the event 574 * @type { ?string } 575 * @syscap SystemCapability.Applications.CalendarData 576 * @atomicservice 577 * @since 11 578 */ 579 title?: string; 580 581 /** 582 * Location of the event 583 * @type { ?Location } 584 * @syscap SystemCapability.Applications.CalendarData 585 * @since 10 586 */ 587 /** 588 * Location of the event 589 * @type { ?Location } 590 * @syscap SystemCapability.Applications.CalendarData 591 * @atomicservice 592 * @since 11 593 */ 594 location?: Location; 595 596 /** 597 * start time of the event 598 * @type { number } 599 * @syscap SystemCapability.Applications.CalendarData 600 * @since 10 601 */ 602 /** 603 * start time of the event 604 * @type { number } 605 * @syscap SystemCapability.Applications.CalendarData 606 * @atomicservice 607 * @since 11 608 */ 609 startTime: number; 610 611 /** 612 * end time of the event 613 * @type { number } 614 * @syscap SystemCapability.Applications.CalendarData 615 * @since 10 616 */ 617 /** 618 * end time of the event 619 * @type { number } 620 * @syscap SystemCapability.Applications.CalendarData 621 * @atomicservice 622 * @since 11 623 */ 624 endTime: number; 625 626 /** 627 * Whether the event is allDay 628 * @type { ?boolean } 629 * @syscap SystemCapability.Applications.CalendarData 630 * @since 10 631 */ 632 /** 633 * Whether the event is allDay 634 * @type { ?boolean } 635 * @syscap SystemCapability.Applications.CalendarData 636 * @atomicservice 637 * @since 11 638 */ 639 isAllDay?: boolean; 640 641 /** 642 * Attendees of the event 643 * @type { ?Attendee[] } 644 * @syscap SystemCapability.Applications.CalendarData 645 * @since 10 646 */ 647 /** 648 * Attendees of the event 649 * @type { ?Attendee[] } 650 * @syscap SystemCapability.Applications.CalendarData 651 * @atomicservice 652 * @since 11 653 */ 654 attendee?: Attendee[]; 655 656 /** 657 * TimeZone of the event 658 * @type { ?string } 659 * @syscap SystemCapability.Applications.CalendarData 660 * @since 10 661 */ 662 /** 663 * TimeZone of the event 664 * @type { ?string } 665 * @syscap SystemCapability.Applications.CalendarData 666 * @atomicservice 667 * @since 11 668 */ 669 timeZone?: string; 670 671 /** 672 * Reminder time of the event 673 * @type { ?number[] } 674 * @syscap SystemCapability.Applications.CalendarData 675 * @since 10 676 */ 677 /** 678 * Reminder time of the event 679 * @type { ?number[] } 680 * @syscap SystemCapability.Applications.CalendarData 681 * @atomicservice 682 * @since 11 683 */ 684 reminderTime?: number[]; 685 686 /** 687 * RecurrenceRule of the event 688 * @type { ?RecurrenceRule } 689 * @syscap SystemCapability.Applications.CalendarData 690 * @since 10 691 */ 692 /** 693 * RecurrenceRule of the event 694 * @type { ?RecurrenceRule } 695 * @syscap SystemCapability.Applications.CalendarData 696 * @atomicservice 697 * @since 11 698 */ 699 recurrenceRule?: RecurrenceRule; 700 701 /** 702 * Description of the event 703 * @type { ?string } 704 * @syscap SystemCapability.Applications.CalendarData 705 * @since 10 706 */ 707 /** 708 * Description of the event 709 * @type { ?string } 710 * @syscap SystemCapability.Applications.CalendarData 711 * @atomicservice 712 * @since 11 713 */ 714 description?: string; 715 716 /** 717 * Service of the event 718 * @type { ?EventService } 719 * @syscap SystemCapability.Applications.CalendarData 720 * @since 10 721 */ 722 /** 723 * Service of the event 724 * @type { ?EventService } 725 * @syscap SystemCapability.Applications.CalendarData 726 * @atomicservice 727 * @since 11 728 */ 729 service?: EventService; 730 } 731 732 /** 733 * Enum for all calendar type. 734 * @enum { string } 735 * @syscap SystemCapability.Applications.CalendarData 736 * @since 10 737 */ 738 /** 739 * Enum for all calendar type. 740 * @enum { string } 741 * @syscap SystemCapability.Applications.CalendarData 742 * @atomicservice 743 * @since 11 744 */ 745 enum CalendarType { 746 /** 747 * Local calendar 748 * @syscap SystemCapability.Applications.CalendarData 749 * @since 10 750 */ 751 /** 752 * Local calendar 753 * @syscap SystemCapability.Applications.CalendarData 754 * @atomicservice 755 * @since 11 756 */ 757 LOCAL = 'local', 758 759 /** 760 * Email calendar 761 * @syscap SystemCapability.Applications.CalendarData 762 * @since 10 763 */ 764 /** 765 * Email calendar 766 * @syscap SystemCapability.Applications.CalendarData 767 * @atomicservice 768 * @since 11 769 */ 770 EMAIL = 'email', 771 772 /** 773 * Birthday calendar 774 * @syscap SystemCapability.Applications.CalendarData 775 * @since 10 776 */ 777 /** 778 * Birthday calendar 779 * @syscap SystemCapability.Applications.CalendarData 780 * @atomicservice 781 * @since 11 782 */ 783 BIRTHDAY = 'birthday', 784 785 /** 786 * CalDAV calendar 787 * @syscap SystemCapability.Applications.CalendarData 788 * @since 10 789 */ 790 /** 791 * CalDAV calendar 792 * @syscap SystemCapability.Applications.CalendarData 793 * @atomicservice 794 * @since 11 795 */ 796 CALDAV = 'caldav', 797 798 /** 799 * Subscribed calendar 800 * @syscap SystemCapability.Applications.CalendarData 801 * @since 10 802 */ 803 /** 804 * Subscribed calendar 805 * @syscap SystemCapability.Applications.CalendarData 806 * @atomicservice 807 * @since 11 808 */ 809 SUBSCRIBED = 'subscribed' 810 } 811 812 /** 813 * Location of an event. 814 * @interface Location 815 * @syscap SystemCapability.Applications.CalendarData 816 * @since 10 817 */ 818 /** 819 * Location of an event. 820 * @interface Location 821 * @syscap SystemCapability.Applications.CalendarData 822 * @atomicservice 823 * @since 11 824 */ 825 interface Location { 826 /** 827 * Location of the event 828 * @type { ?string } 829 * @syscap SystemCapability.Applications.CalendarData 830 * @since 10 831 */ 832 /** 833 * Location of the event 834 * @type { ?string } 835 * @syscap SystemCapability.Applications.CalendarData 836 * @atomicservice 837 * @since 11 838 */ 839 location?: string; 840 841 /** 842 * Longitude of the location 843 * @type { ?number } 844 * @syscap SystemCapability.Applications.CalendarData 845 * @since 10 846 */ 847 /** 848 * Longitude of the location 849 * @type { ?number } 850 * @syscap SystemCapability.Applications.CalendarData 851 * @atomicservice 852 * @since 11 853 */ 854 longitude?: number; 855 856 /** 857 * Latitude of the location 858 * @type { ?number } 859 * @syscap SystemCapability.Applications.CalendarData 860 * @since 10 861 */ 862 /** 863 * Latitude of the location 864 * @type { ?number } 865 * @syscap SystemCapability.Applications.CalendarData 866 * @atomicservice 867 * @since 11 868 */ 869 latitude?: number; 870 } 871 872 /** 873 * Provides the abilities to retrive event filter. 874 * @syscap SystemCapability.Applications.CalendarData 875 * @since 10 876 */ 877 class EventFilter { 878 /** 879 * Filter events by event id. 880 * @param {number[]} ids id array to retrieve 881 * @returns { EventFilter } Returns the EventFilter with ids. 882 * @syscap SystemCapability.Applications.CalendarData 883 * @since 10 884 */ 885 static filterById(ids: number[]): EventFilter; 886 887 /** 888 * Filter events by event start time and end time. 889 * @param { number } start - start time of query range 890 * @param { number } end - end time of query range 891 * @returns { EventFilter } Returns the EventFilter with time range. 892 * @syscap SystemCapability.Applications.CalendarData 893 * @since 10 894 */ 895 static filterByTime(start: number, end: number): EventFilter; 896 897 /** 898 * Filter events by event title. 899 * @param { string } title - event title to query 900 * @returns {EventFilter } Returns the EventFilter with title. 901 * @syscap SystemCapability.Applications.CalendarData 902 * @since 10 903 */ 904 static filterByTitle(title: string): EventFilter; 905 } 906 907 /** 908 * Enum for supported events type. 909 * @enum { number } 910 * @syscap SystemCapability.Applications.CalendarData 911 * @since 10 912 */ 913 /** 914 * Enum for supported events type. 915 * @enum { number } 916 * @syscap SystemCapability.Applications.CalendarData 917 * @atomicservice 918 * @since 11 919 */ 920 enum EventType { 921 /** 922 * normal event. 923 * @syscap SystemCapability.Applications.CalendarData 924 * @since 10 925 */ 926 /** 927 * normal event. 928 * @syscap SystemCapability.Applications.CalendarData 929 * @atomicservice 930 * @since 11 931 */ 932 NORMAL = 0, 933 934 /** 935 * important event. 936 * @syscap SystemCapability.Applications.CalendarData 937 * @since 10 938 */ 939 /** 940 * important event. 941 * @syscap SystemCapability.Applications.CalendarData 942 * @atomicservice 943 * @since 11 944 */ 945 IMPORTANT = 1, 946 } 947 948 /** 949 * Defines the recurrence rule of event 950 * @interface RecurrenceRule 951 * @syscap SystemCapability.Applications.CalendarData 952 * @since 10 953 */ 954 /** 955 * Defines the recurrence rule of event 956 * @interface RecurrenceRule 957 * @syscap SystemCapability.Applications.CalendarData 958 * @atomicservice 959 * @since 11 960 */ 961 export interface RecurrenceRule { 962 /** 963 * RecurrenceFrequency of recurrence event. 964 * @type { RecurrenceFrequency } 965 * @syscap SystemCapability.Applications.CalendarData 966 * @since 10 967 */ 968 /** 969 * RecurrenceFrequency of recurrence event. 970 * @type { RecurrenceFrequency } 971 * @syscap SystemCapability.Applications.CalendarData 972 * @atomicservice 973 * @since 11 974 */ 975 recurrenceFrequency: RecurrenceFrequency; 976 977 /** 978 * Expiration time of recurrence event. 979 * @type { ?number } 980 * @syscap SystemCapability.Applications.CalendarData 981 * @since 10 982 */ 983 /** 984 * Expiration time of recurrence event. 985 * @type { ?number } 986 * @syscap SystemCapability.Applications.CalendarData 987 * @atomicservice 988 * @since 11 989 */ 990 expire?: number; 991 } 992 993 /** 994 * Enum for the recurrence type by different period 995 * @enum { number } 996 * @syscap SystemCapability.Applications.CalendarData 997 * @since 10 998 */ 999 /** 1000 * Enum for the recurrence type by different period 1001 * @enum { number } 1002 * @syscap SystemCapability.Applications.CalendarData 1003 * @atomicservice 1004 * @since 11 1005 */ 1006 export enum RecurrenceFrequency { 1007 /** 1008 * The event repeats every year. 1009 * @syscap SystemCapability.Applications.CalendarData 1010 * @since 10 1011 */ 1012 /** 1013 * The event repeats every year. 1014 * @syscap SystemCapability.Applications.CalendarData 1015 * @atomicservice 1016 * @since 11 1017 */ 1018 YEARLY = 0, 1019 1020 /** 1021 * The event repeats every month. 1022 * @syscap SystemCapability.Applications.CalendarData 1023 * @since 10 1024 */ 1025 /** 1026 * The event repeats every month. 1027 * @syscap SystemCapability.Applications.CalendarData 1028 * @atomicservice 1029 * @since 11 1030 */ 1031 MONTHLY = 1, 1032 1033 /** 1034 * The event repeats every week. 1035 * @syscap SystemCapability.Applications.CalendarData 1036 * @since 10 1037 */ 1038 /** 1039 * The event repeats every week. 1040 * @syscap SystemCapability.Applications.CalendarData 1041 * @atomicservice 1042 * @since 11 1043 */ 1044 WEEKLY = 2, 1045 1046 /** 1047 * The event repeats every day. 1048 * @syscap SystemCapability.Applications.CalendarData 1049 * @since 10 1050 */ 1051 /** 1052 * The event repeats every day. 1053 * @syscap SystemCapability.Applications.CalendarData 1054 * @atomicservice 1055 * @since 11 1056 */ 1057 DAILY = 3, 1058 } 1059 1060 /** 1061 * Defines the attendee information 1062 * @interface Attendee 1063 * @syscap SystemCapability.Applications.CalendarData 1064 * @since 10 1065 */ 1066 /** 1067 * Defines the attendee information 1068 * @interface Attendee 1069 * @syscap SystemCapability.Applications.CalendarData 1070 * @atomicservice 1071 * @since 11 1072 */ 1073 export interface Attendee { 1074 /** 1075 * Name of the Attendee. 1076 * @type { string } 1077 * @syscap SystemCapability.Applications.CalendarData 1078 * @since 10 1079 */ 1080 /** 1081 * Name of the Attendee. 1082 * @type { string } 1083 * @syscap SystemCapability.Applications.CalendarData 1084 * @atomicservice 1085 * @since 11 1086 */ 1087 name: string; 1088 1089 /** 1090 * Email of the Attendee. 1091 * @type { string } 1092 * @syscap SystemCapability.Applications.CalendarData 1093 * @since 10 1094 */ 1095 /** 1096 * Email of the Attendee. 1097 * @type { string } 1098 * @syscap SystemCapability.Applications.CalendarData 1099 * @atomicservice 1100 * @since 11 1101 */ 1102 email: string; 1103 } 1104 1105 /** 1106 * Defines event service information 1107 * @interface EventService 1108 * @syscap SystemCapability.Applications.CalendarData 1109 * @since 10 1110 */ 1111 /** 1112 * Defines event service information 1113 * @interface EventService 1114 * @syscap SystemCapability.Applications.CalendarData 1115 * @atomicservice 1116 * @since 11 1117 */ 1118 export interface EventService { 1119 /** 1120 * Type of the EventService. 1121 * @type { ServiceType } 1122 * @syscap SystemCapability.Applications.CalendarData 1123 * @since 10 1124 */ 1125 /** 1126 * Type of the EventService. 1127 * @type { ServiceType } 1128 * @syscap SystemCapability.Applications.CalendarData 1129 * @atomicservice 1130 * @since 11 1131 */ 1132 type: ServiceType; 1133 1134 /** 1135 * Uri of the EventService. 1136 * @type { string } 1137 * @syscap SystemCapability.Applications.CalendarData 1138 * @since 10 1139 */ 1140 /** 1141 * Uri of the EventService. 1142 * @type { string } 1143 * @syscap SystemCapability.Applications.CalendarData 1144 * @atomicservice 1145 * @since 11 1146 */ 1147 uri: string; 1148 1149 /** 1150 * Description of the EventService. 1151 * @type { ?string } 1152 * @syscap SystemCapability.Applications.CalendarData 1153 * @since 10 1154 */ 1155 /** 1156 * Description of the EventService. 1157 * @type { ?string } 1158 * @syscap SystemCapability.Applications.CalendarData 1159 * @atomicservice 1160 * @since 11 1161 */ 1162 description?: string; 1163 } 1164 1165 /** 1166 * Defines event service type 1167 * @enum { string } 1168 * @syscap SystemCapability.Applications.CalendarData 1169 * @since 10 1170 */ 1171 /** 1172 * Defines event service type 1173 * @enum { string } 1174 * @syscap SystemCapability.Applications.CalendarData 1175 * @atomicservice 1176 * @since 11 1177 */ 1178 export enum ServiceType { 1179 /** 1180 * Meeting event. 1181 * @syscap SystemCapability.Applications.CalendarData 1182 * @since 10 1183 */ 1184 /** 1185 * Meeting event. 1186 * @syscap SystemCapability.Applications.CalendarData 1187 * @atomicservice 1188 * @since 11 1189 */ 1190 MEETING = 'Meeting', 1191 1192 /** 1193 * Watch drama event. 1194 * @syscap SystemCapability.Applications.CalendarData 1195 * @since 10 1196 */ 1197 /** 1198 * Watch drama event. 1199 * @syscap SystemCapability.Applications.CalendarData 1200 * @atomicservice 1201 * @since 11 1202 */ 1203 WATCHING = 'Watching', 1204 1205 /** 1206 * Repayment event. 1207 * @syscap SystemCapability.Applications.CalendarData 1208 * @since 10 1209 */ 1210 /** 1211 * Repayment event. 1212 * @syscap SystemCapability.Applications.CalendarData 1213 * @atomicservice 1214 * @since 11 1215 */ 1216 REPAYMENT = 'Repayment', 1217 1218 /** 1219 * Live event. 1220 * @syscap SystemCapability.Applications.CalendarData 1221 * @since 10 1222 */ 1223 /** 1224 * Live event. 1225 * @syscap SystemCapability.Applications.CalendarData 1226 * @atomicservice 1227 * @since 11 1228 */ 1229 LIVE = 'Live', 1230 1231 /** 1232 * Shopping event. 1233 * @syscap SystemCapability.Applications.CalendarData 1234 * @since 10 1235 */ 1236 /** 1237 * Shopping event. 1238 * @syscap SystemCapability.Applications.CalendarData 1239 * @atomicservice 1240 * @since 11 1241 */ 1242 SHOPPING = 'Shopping', 1243 1244 /** 1245 * trip event. 1246 * @syscap SystemCapability.Applications.CalendarData 1247 * @since 10 1248 */ 1249 /** 1250 * trip event. 1251 * @syscap SystemCapability.Applications.CalendarData 1252 * @atomicservice 1253 * @since 11 1254 */ 1255 TRIP = 'Trip', 1256 1257 /** 1258 * Class event. 1259 * @syscap SystemCapability.Applications.CalendarData 1260 * @since 10 1261 */ 1262 /** 1263 * Class event. 1264 * @syscap SystemCapability.Applications.CalendarData 1265 * @atomicservice 1266 * @since 11 1267 */ 1268 CLASS = 'Class', 1269 1270 /** 1271 * Sports game event. 1272 * @syscap SystemCapability.Applications.CalendarData 1273 * @since 10 1274 */ 1275 /** 1276 * Sports game event. 1277 * @syscap SystemCapability.Applications.CalendarData 1278 * @atomicservice 1279 * @since 11 1280 */ 1281 SPORTS_EVENTS = 'SportsEvents', 1282 1283 /** 1284 * Sports exercise event. 1285 * @syscap SystemCapability.Applications.CalendarData 1286 * @since 10 1287 */ 1288 /** 1289 * Sports exercise event. 1290 * @syscap SystemCapability.Applications.CalendarData 1291 * @atomicservice 1292 * @since 11 1293 */ 1294 SPORTS_EXERCISE = 'SportsExercise', 1295 } 1296} 1297 1298export default calendarManager;