diff --git a/api/@ohos.storageStatistics.d.ts b/api/@ohos.file.storageStatistics.d.ts similarity index 43% rename from api/@ohos.storageStatistics.d.ts rename to api/@ohos.file.storageStatistics.d.ts index a609359df47a9cf57876a07b431fef55e19a323b..bf659c55a9ffe65b39c6d886247e5bc740ed35f1 100644 --- a/api/@ohos.storageStatistics.d.ts +++ b/api/@ohos.file.storageStatistics.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. +* Copyright (C) 2022 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 @@ -20,15 +20,21 @@ import {AsyncCallback, Callback} from "./basic"; * * @since 8 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics - * @systemapi */ declare namespace storageStatistics { /** * Get the totalSize of volume. * * @since 8 + * @param volumeUuid the uuid of the volume * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback): void; @@ -37,8 +43,15 @@ declare namespace storageStatistics { * Get the free size Of volume. * * @since 8 + * @param volumeUuid the uuid of the volume * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback): void; @@ -49,30 +62,56 @@ declare namespace storageStatistics { * * @since 9 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics - * @systemapi */ export interface BundleStats { + /** + * The size of application installation data. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + */ appSize: number; + + /** + * The size of application cache data. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + */ cacheSize: number; + + /** + * The size of application local data, distributed data and database data. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + */ dataSize: number; } /** * Get the bundlestat * * @since 9 + * @param packageName the name of the application * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getBundleStats(packageName: string, callback: AsyncCallback): void; function getBundleStats(packageName: string): Promise; /** - * Get the AppStorageStats + * Get the Current BundleStats * * @since 9 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900032 - Unknown error. */ function getCurrentBundleStats(callback: AsyncCallback): void; function getCurrentBundleStats(): Promise; @@ -83,6 +122,11 @@ declare namespace storageStatistics { * @since 9 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getSystemSize(callback: AsyncCallback): void; @@ -96,11 +140,52 @@ declare namespace storageStatistics { * @systemapi */ export interface StorageStats { + /** + * The total size of device. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @systemapi + */ total: number; + + /** + * The size of audio file. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @systemapi + */ audio: number; + + /** + * The size of video file. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @systemapi + */ video: number; + + /** + * The size of image file. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @systemapi + */ image: number; + + /** + * The size of other file. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @systemapi + */ file: number; + + /** + * The size of application. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @systemapi + */ app: number; } @@ -110,11 +195,33 @@ declare namespace storageStatistics { * @since 9 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ - function getUserStorageStats(userId?: number): Promise; + function getUserStorageStats(): Promise; function getUserStorageStats(callback: AsyncCallback): void; - function getUserStorageStats(userId: number, callback: AsyncCallback): void; + + /** + * Get the UserStorageStats + * + * @since 9 + * @param userId the id of the user + * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics + * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600009 - User if out of range. + * @throws { BusinessError } 13900032 - Unknown error. + * @systemapi + */ + function getUserStorageStats(userId: number): Promise; + function getUserStorageStats(userId: number, callback: AsyncCallback): void; /** * Get the totalsize @@ -122,6 +229,11 @@ declare namespace storageStatistics { * @since 9 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getTotalSize(callback: AsyncCallback): void; @@ -133,6 +245,11 @@ declare namespace storageStatistics { * @since 9 * @syscap SystemCapability.FileManagement.StorageService.SpatialStatistics * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getFreeSize(callback: AsyncCallback): void; diff --git a/api/@ohos.volumeManager.d.ts b/api/@ohos.file.volumeManager.d.ts similarity index 38% rename from api/@ohos.volumeManager.d.ts rename to api/@ohos.file.volumeManager.d.ts index cb7196cd6df64faee1cb64bc82fbc7290bbe702b..498aeeb2c78745db9a458a7f70d4f66c33bbd7d7 100644 --- a/api/@ohos.volumeManager.d.ts +++ b/api/@ohos.file.volumeManager.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (C) 2021 Huawei Device Co., Ltd. +* Copyright (C) 2022 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 @@ -32,13 +32,60 @@ declare namespace volumeManager { * @systemapi */ export interface Volume { - id: string; - uuid: string; - diskId: string; - description: string; - removable: boolean; - state: number; - path: string; + /** + * Volume ID. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + * @systemapi + */ + id: string; + + /** + * Universally unique identifier of volume. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + * @systemapi + */ + uuid: string; + + /** + * The ID of disk that volume belongs to. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + * @systemapi + */ + diskId: string; + + /** + * The label of the volume. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + * @systemapi + */ + description: string; + + /** + * The volume is removable or not. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + * @systemapi + */ + removable: boolean; + + /** + * The mount state of the volume. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + * @systemapi + */ + state: number; + + /** + * The mount path of the volume. + * @since 9 + * @syscap SystemCapability.FileManagement.StorageService.Volume + */ + path: string; } /** * Get All Volumes @@ -47,6 +94,11 @@ declare namespace volumeManager { * @returns Returns the information of all volumes * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getAllVolumes(callback: AsyncCallback>): void; @@ -57,33 +109,57 @@ function getAllVolumes(): Promise>; * Mount * * @since 9 - * @param volumeId that indicates the volume + * @param volumeId the id of the volume * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.MOUNT_UNMOUNT_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600002 - Not supported filesystem. + * @throws { BusinessError } 13600003 - Failed to mount. + * @throws { BusinessError } 13600005 - Incorrect volume state. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ -function mount(volumeId: string, callback: AsyncCallback): void; -function mount(volumeId: string): Promise; +function mount(volumeId: string, callback: AsyncCallback): void; +function mount(volumeId: string): Promise; /** * UnMount * * @since 9 - * @param volumeId that indicates the volume + * @param volumeId the id of the volume * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.MOUNT_UNMOUNT_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600002 - Not supported filesystem. + * @throws { BusinessError } 13600004 - Failed to unmount. + * @throws { BusinessError } 13600005 - Incorrect volume state. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ -function unmount(volumeId: string, callback: AsyncCallback): void; -function unmount(volumeId: string): Promise; +function unmount(volumeId: string, callback: AsyncCallback): void; +function unmount(volumeId: string): Promise; /** * Get the volume by uuid. * * @since 9 - * @param uuid of volume + * @param uuid the uuid of volume * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getVolumeByUuid(uuid: string, callback: AsyncCallback): void; @@ -93,9 +169,15 @@ function getVolumeByUuid(uuid: string): Promise; * Get the volume by id. * * @since 9 - * @param volumeId that indicates the volume + * @param volumeId the id of volume * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.STORAGE_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function getVolumeById(volumeId: string, callback: AsyncCallback): void; @@ -105,10 +187,18 @@ function getVolumeById(volumeId: string): Promise; * Set the description of volume. * * @since 9 - * @param uuid of volume - * @param new description of volume + * @param uuid the uuid of volume + * @param description new description of volume * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.MOUNT_UNMOUNT_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600002 - Not supported filesystem. + * @throws { BusinessError } 13600005 - Incorrect volume state. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback): void; @@ -118,10 +208,18 @@ function setVolumeDescription(uuid: string, description: string): Promise; * Format. * * @since 9 - * @param volumeId that indicates the volume - * @param the file system type after formatting + * @param volumeId the id of the volume + * @param fsType the file system type after formatting * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.MOUNT_FORMAT_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600002 - Not supported filesystem. + * @throws { BusinessError } 13600005 - Incorrect volume state. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function format(volumeId: string, fsType: string, callback: AsyncCallback): void; @@ -132,10 +230,16 @@ function format(volumeId: string, fsType: string): Promise; * Partition. * * @since 9 - * @param diskId that indicates the disk + * @param diskId the id of the disk * @param type of partition such as private partition or public partition * @syscap SystemCapability.FileManagement.StorageService.Volume * @permission ohos.permission.MOUNT_FORMAT_MANAGER + * @throws { BusinessError } 201 - Permission verification failed. + * @throws { BusinessError } 202 - The caller is not a system application. + * @throws { BusinessError } 401 - The input parameter is invalid. + * @throws { BusinessError } 13600001 - IPC error. + * @throws { BusinessError } 13600008 - No such object. + * @throws { BusinessError } 13900032 - Unknown error. * @systemapi */ function partition(diskId: string, type: number, callback: AsyncCallback): void;