diff --git a/api/@ohos.commonEventManager.d.ts b/api/@ohos.commonEventManager.d.ts index c381a1b79f003551585d57abdfda85988700bf7f..effcd09c8a27d035f3c335d58e1a5e296542c93f 100644 --- a/api/@ohos.commonEventManager.d.ts +++ b/api/@ohos.commonEventManager.d.ts @@ -2647,6 +2647,16 @@ declare namespace commonEventManager { * @arkts 1.1&1.2 */ COMMON_EVENT_SCREEN_SHARE = 'usual.event.SCREEN_SHARE', + + /** + * This common event means that the root info of cloud disk has been updated. + * This is a protected common event that can only be sent by system. + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since 20 + * @arkts 1.1&1.2 + */ + COMMON_EVENT_CLOUD_DISK_ROOT_CHANGED = 'usual.event.CLOUD_DISK_ROOT_CHANGED', } /** diff --git a/api/@ohos.file.cloudDiskManager.d.ts b/api/@ohos.file.cloudDiskManager.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..825447004f8ffb41661ea4db348386470e17fefa --- /dev/null +++ b/api/@ohos.file.cloudDiskManager.d.ts @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2025 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 CoreFileKit + */ + +/** + * Provides cloud disk manager APIs. + * + * @namespace cloudDiskManager + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ +declare namespace cloudDiskManager { + /** + * Enumerates the state of th cloud disk. + * + * @enum {number} + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + enum State { + /** + * Indicates the inactive state. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + INACTIVE = 0, + + /** + * Indicates the active state. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + ACTIVE = 1 + } + + /** + * Defines the syncFolder of the cloud disk for current bundle. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + interface SyncFolder { + /** + * The path of the syncFolder. + * + * @type { string } + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + path: string; + + /** + * The state of the syncFolder. + * + * @type { State } + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + state?: State; + + /** + * The displayNameResId of the syncFolder. + * + * @type { number } + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + displayNameResId?: number; + + /** + * The displayName of the syncFolder. + * + * @type { string } + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + displayName?: string; + } + + /** + * Defines the syncFolderExt of the cloudDisk for all bundles. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @systemapi hide this for inner system use + * @since 21 + */ + interface SyncFolderExt extends SyncFolder { + + /** + * The bundleName of the syncFolderExt. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @systemapi hide this for inner system use + * @since 21 + */ + bundleName: string; + } + + /** + * Provides module of cloud disk management for current bundle. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + class SyncFolderManager { + /** + * A constructor used to create a SyncFolderManger object. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + constructor(); + + /** + * Register a sync folder. + * + * @param {SyncFolder} syncFolder - Indicates the syncFolder info to register. + * @return { Primise } Returns {@code true} if the sync folder is registered successfully; returns {@code false} otherwise. + * @throws { BusinessError } 14500001 - Invalid input parameter. + * @throws { BusinessError } 14500002 - Sync root persistence failed. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500004 - Sync root limit reached. + * @throws { BusinessError } 14500005 - Sync root conflict with this application. + * @throws { BusinessError } 14500006 - Sync root conflict with other applications. + * @throws { BusinessError } 14500007 - Failed to create sync root. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + register(syncFolder: SyncFolder): Promise; + + /** + * Unregister the sync folder by uri. + * + * @param {string} uri - Indicates the uri of syncFolder. + * @return { Primise } Returns {@code true} if the sync folder is registered successfully; returns {@code false} otherwise. + * @throws { BusinessError } 14500001 - Invalid input parameter. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500009 - Failed to remove sync root. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + unregister(uri: string): Promise; + + /** + * Active the sync folder by uri. + * + * @param {string} uri - Indicates the uri of syncFolder. + * @return { Primise } Returns {@code true} if the sync folder is actived successfully; returns {@code false} otherwise. + * @throws { BusinessError } 14500001 - Invalid input parameter. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500008 - Sync root does not exist. + * @throws { BusinessError } 14500010 - Failed to persist sync root properties. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + active(uri: string): Promise; + + /** + * Deactive the sync folder by uri. + * + * @param {string} uri - Indicates the uri of syncFolder. + * @return { Primise } Returns {@code true} if the sync folder is inactived successfully; returns {@code false} otherwise. + * @throws { BusinessError } 14500001 - Invalid input parameter. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500008 - Sync root does not exist. + * @throws { BusinessError } 14500010 - Failed to persist sync root properties. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + deactive(uri: string): Promise; + + /** + * Update the display name of syncFolder. + * + * @param { string } uri - Indicates the uri of syncFolder. + * @param { string } displayName - Indicates the display name of syncFolder. + * @return { Promise } Returns {@code true} if update successfully; returns {@code false} otherwise. + * @throws { BusinessError } 14500001 - Invalid input parameter. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500010 - Failed to persist sync root properties. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + updateDisplayName(uri: string, displayName: string): Promise; + + /** + * Get sync folders for current bundle. + * + * @return { Primise> } Returns the syncFolder list for current bundle. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @since 21 + */ + getSyncFolders(): Promise>; + } + + /** + * Provides module of accessing cloud disk for all bundles. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @systemapi hide this for inner system use + * @sinc21 + */ + class SyncFolderAccess { + /** + * A constructor used to create a SyncFolderAccess object. + * + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @systemapi hide this for inner system use + * @since 21 + */ + constructor(); + + /** + * Get all sync folders for all bundles. + * + * @return { Primise> } Returns the syncFolderExt list for all bundles. + * @throws { BusinessError } 14500003 - IPC communication failed. + * @throws { BusinessError } 14500011 - Internal error. + * @throws { BusinessError } 14500012 - System management disabled. + * @syscap SystemCapability.FileManagement.CloudDiskManager + * @systemapi hide this for inner system use + * @since 21 + */ + getAllSyncFolders(): Promise>; + } +} + +export default cloudDiskManager;