diff --git "a/\350\277\220\345\212\250\350\241\250\345\272\224\347\224\250\345\274\200\345\217\221/\346\216\245\345\217\243/interface/@ohos.calendarManager.d.ts" "b/\350\277\220\345\212\250\350\241\250\345\272\224\347\224\250\345\274\200\345\217\221/\346\216\245\345\217\243/interface/@ohos.calendarManager.d.ts" new file mode 100644 index 0000000000000000000000000000000000000000..3da5bf227fabc8fb5f4ca1c609780e2716e29c4f --- /dev/null +++ "b/\350\277\220\345\212\250\350\241\250\345\272\224\347\224\250\345\274\200\345\217\221/\346\216\245\345\217\243/interface/@ohos.calendarManager.d.ts" @@ -0,0 +1,711 @@ +/* + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * @file + * @kit CalendarKit + */ +import { AsyncCallback } from './@ohos.base'; +/** + * This provides calendar data access abilities. + * @namespace calendarManager + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ +/** + * This provides calendar data access abilities. + * @namespace calendarManager + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ +declare namespace calendarManager { + /** + * Defines the CalendarManager class and provides functions to access the calendar data. + * + * @typedef CalendarManager + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Defines the CalendarManager class and provides functions to access the calendar data. + * + * @typedef CalendarManager + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface CalendarManager { + /** + * Create calendar instance. + * + * @permission ohos.permission.WRITE_CALENDAR + * @param { CalendarAccount } calendarAccount - calendar account to create calendar + * @param { AsyncCallback } callback - the callback of createCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + createCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback): void; + /** + * Delete calendar instance. + * + * @permission ohos.permission.WRITE_CALENDAR + * @param { Calendar } calendar - calendar to be deleted + * @param { AsyncCallback } callback - the callback of deleteCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteCalendar(calendar: Calendar, callback: AsyncCallback): void; + /** + * Get calendar instance from database by specified account. + * + * @permission ohos.permission.READ_CALENDAR + * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve + * @param { AsyncCallback } callback - the callback of getCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Get calendar instance from database by specified account. + * + * @permission ohos.permission.READ_CALENDAR + * @param { CalendarAccount } calendarAccount - specify calendar account to retrieve + * @param { AsyncCallback } callback - the callback of getCalendar + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + getCalendar(calendarAccount: CalendarAccount, callback: AsyncCallback): void; + /** + * Get default calendar instance from database. + * + * @permission ohos.permission.READ_CALENDAR + * @param { AsyncCallback } callback - the callback of getCalendar with default calendar instance + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Get default calendar instance from database. + * + * @permission ohos.permission.READ_CALENDAR + * @param { AsyncCallback } callback - the callback of getCalendar with default calendar instance + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + getCalendar(callback: AsyncCallback): void; + /** + * Get all calendar instance. + * + * @permission ohos.permission.READ_CALENDAR + * @param {AsyncCallback} callback - the callback of getAllCalendars + * @throws { BusinessError } 201 - Permission denied. + * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types. + * @throws { BusinessError } 801 - Capability not supported. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getAllCalendars(callback: AsyncCallback): void; + } + /** + * Describes a calendar instance. + * @typedef Calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Describes a calendar instance. + * @typedef Calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + export interface Calendar { + /** + * Id of the calendar + * @type { number } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Id of the calendar + * @type { number } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + readonly id: number; + /** + * Add a single event. + * @param { Event } event - a single event to add. + * @param { AsyncCallback } callback - callback of addEvent. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Add a single event. + * @param { Event } event - a single event to add. + * @param { AsyncCallback } callback - callback of addEvent. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + addEvent(event: Event, callback: AsyncCallback): void; + /** + * Add multiple events. + * @param { Event[] } events - Indicates the information about multiple events. + * @param { AsyncCallback } callback - The callback of addEvents + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + addEvents(events: Event[], callback: AsyncCallback): void; + /** + * Delete a single event. + * @param { number } id - Indicates the ID of an event. + * @param {AsyncCallback} callback - The callback of deleteEvent. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteEvent(id: number, callback: AsyncCallback): void; + /** + * Delete multiple events. + * @param { number[] } ids - Indicates the IDs of multiple events. + * @param {AsyncCallback} callback - The callback of deleteEvents. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + deleteEvents(ids: number[], callback: AsyncCallback): void; + /** + * Update a single event. + * @param { Event } event - Indicates the information about a single event. + * @param { AsyncCallback } callback - The callback of updateEvent. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + updateEvent(event: Event, callback: AsyncCallback): void; + /** + * Query the event with EventId from current calendar instance. + * @param { AsyncCallback } callback - The callback of getEvent with the event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getEvent(eventId: number, callback: AsyncCallback): void; + /** + * Query all events with all column from current calendar instance. + * @param { AsyncCallback } callback - The callback of getEvents with all events. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getEvents(callback: AsyncCallback): void; + /** + * Get calendar configure. + * @returns { CalendarConfig } configure of current calendar. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getConfig(): CalendarConfig; + /** + * Set calendar configure. + * @param { CalendarConfig } config - calendar config to set + * @param { AsyncCallback } callback - callback of setConfig + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + setConfig(config: CalendarConfig, callback: AsyncCallback): void; + /** + * Get calendar account. + * @returns { CalendarAccount } calendar account of current calendar. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + getAccount(): CalendarAccount; + } + /** + * Describes a calendar account. + * @typedef CalendarAccount + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Describes a calendar account. + * @typedef CalendarAccount + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + interface CalendarAccount { + /** + * Name of the calendar + * @type { string } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Name of the calendar + * @type { string } + * @readonly + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + readonly name: string; + /** + * Type of the calendar + * @type { CalendarType } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Type of the calendar + * @type { CalendarType } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + type: CalendarType; + /** + * DisplayName of the calendar + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * DisplayName of the calendar + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + displayName?: string; + } + /** + * Describes a calendar configuration. + * @typedef CalendarConfig + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + interface CalendarConfig { + /** + * Whether the calendar provides a reminder + * @type { ?boolean } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + enableReminder?: boolean; + /** + * Color of the calendar + * @type { ?(number | string) } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + color?: number | string; + } + /** + * Describes an event information. + * @typedef Event + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Describes an event information. + * @typedef Event + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + interface Event { + /** + * Id of the event + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Id of the event + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + id?: number; + /** + * Type of the event + * @type { EventType } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Type of the event + * @type { EventType } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + type: EventType; + /** + * Title of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Title of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + title?: string; + /** + * Location of the event + * @type { ?Location } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Location of the event + * @type { ?Location } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + location?: Location; + /** + * start time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * start time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + startTime: number; + /** + * end time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * end time of the event + * @type { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + endTime: number; + /** + * Whether the event is allDay + * @type { ?boolean } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Whether the event is allDay + * @type { ?boolean } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + isAllDay?: boolean; + /** + * Attendees of the event + * @type { ?Attendee[] } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Attendees of the event + * @type { ?Attendee[] } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + // attendee?: Attendee[]; + /** + * TimeZone of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * TimeZone of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + timeZone?: string; + /** + * Reminder time of the event + * @type { ?number[] } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Reminder time of the event + * @type { ?number[] } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + reminderTime?: number[]; + /** + * recurrenceFrequency of the event + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * recurrenceFrequency of the event + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + recurrenceFrequency?: number; + /** + * Description of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Description of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + eventContent?: string; + } + /** + * Enum for all calendar type. + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Enum for all calendar type. + * @enum { string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + enum CalendarType { + /** + * Local calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Local calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + LOCAL = 'local', + /** + * Email calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Email calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + EMAIL = 'email', + /** + * Birthday calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Birthday calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + BIRTHDAY = 'birthday', + /** + * CalDAV calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * CalDAV calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + CALDAV = 'caldav', + /** + * Subscribed calendar + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Subscribed calendar + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + SUBSCRIBED = 'subscribed' + } + /** + * Location of an event. + * @typedef Location + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Location of an event. + * @typedef Location + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + interface Location { + /** + * Location of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Location of the event + * @type { ?string } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + location?: string; + /** + * Longitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Longitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + longitude?: number; + /** + * Latitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Latitude of the location + * @type { ?number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + latitude?: number; + } + /** + * Enum for supported events type. + * @enum { number } + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * Enum for supported events type. + * @enum { number } + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + enum EventType { + /** + * normal event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * normal event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + NORMAL = 'Normal', + /** + * important event. + * @syscap SystemCapability.Applications.CalendarData + * @since 10 + */ + /** + * important event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + IMPORTANT = 'Important', + /** + * Date event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + DATE = 'Date', + /** + * Meeting event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + MEETING = 'Meeting', + /** + * Commemoration event. + * @syscap SystemCapability.Applications.CalendarData + * @atomicservice + * @since 11 + */ + COMMEMORATION = 'Commemoration' + } +} +export default calendarManager; \ No newline at end of file