1/* 2 * Copyright (c) 2022 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 16import { AsyncCallback } from './basic'; 17import { ElementName } from './bundleManager/ElementName'; 18import { RemoteAbilityInfo as _RemoteAbilityInfo } from './bundleManager/RemoteAbilityInfo'; 19 20/** 21 * DistributedBundle manager. 22 * @namespace distributedBundleManager 23 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 24 * @systemapi 25 * @since 9 26 */ 27declare namespace distributedBundleManager { 28 /** 29 * Obtains information about the ability info of the remote device. 30 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 31 * @param { ElementName } elementName - Indicates the elementName. 32 * @param { AsyncCallback<RemoteAbilityInfo> } callback - The callback of getting the ability info of the remote device. 33 * @throws { BusinessError } 201 - Permission denied. 34 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 35 * @throws { BusinessError } 401 - The parameter check failed. 36 * @throws { BusinessError } 801 - Capability not supported. 37 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 38 * @throws { BusinessError } 17700003 - The specified ability name is not found. 39 * @throws { BusinessError } 17700007 - The specified device ID is not found. 40 * @throws { BusinessError } 17700027 - The distributed service is not running. 41 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 42 * @systemapi 43 * @since 9 44 */ 45 function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback<RemoteAbilityInfo>): void; 46 47 /** 48 * Obtains information about the ability info of the remote device. 49 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 50 * @param { ElementName } elementName - Indicates the elementName. 51 * @returns { Promise<RemoteAbilityInfo> } Returns the ability info of the remote device. 52 * @throws { BusinessError } 201 - Permission denied. 53 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 54 * @throws { BusinessError } 401 - The parameter check failed. 55 * @throws { BusinessError } 801 - Capability not supported. 56 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 57 * @throws { BusinessError } 17700003 - The specified ability name is not found. 58 * @throws { BusinessError } 17700007 - The specified device ID is not found. 59 * @throws { BusinessError } 17700027 - The distributed service is not running. 60 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 61 * @systemapi 62 * @since 9 63 */ 64 function getRemoteAbilityInfo(elementName: ElementName): Promise<RemoteAbilityInfo>; 65 66 /** 67 * Obtains information about the abilities info of the remote device. 68 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 69 * @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten. 70 * @param { AsyncCallback<Array<RemoteAbilityInfo>> } callback - the callback of getting the abilities info of the remote device. 71 * @throws { BusinessError } 201 - Permission denied. 72 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 73 * @throws { BusinessError } 401 - The parameter check failed. 74 * @throws { BusinessError } 801 - Capability not supported. 75 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 76 * @throws { BusinessError } 17700003 - The specified ability name is not found. 77 * @throws { BusinessError } 17700007 - The specified device ID is not found. 78 * @throws { BusinessError } 17700027 - The distributed service is not running. 79 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 80 * @systemapi 81 * @since 9 82 */ 83 function getRemoteAbilityInfo(elementNames: Array<ElementName>, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void; 84 85 /** 86 * Obtains information about the abilities info of the remote device. 87 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 88 * @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten. 89 * @returns { Promise<Array<RemoteAbilityInfo>> } The result of getting the abilities info of the remote device. 90 * @throws { BusinessError } 201 - Permission denied. 91 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 92 * @throws { BusinessError } 401 - The parameter check failed. 93 * @throws { BusinessError } 801 - Capability not supported. 94 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 95 * @throws { BusinessError } 17700003 - The specified ability name is not found. 96 * @throws { BusinessError } 17700007 - The specified device ID is not found. 97 * @throws { BusinessError } 17700027 - The distributed service is not running. 98 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 99 * @systemapi 100 * @since 9 101 */ 102 function getRemoteAbilityInfo(elementNames: Array<ElementName>): Promise<Array<RemoteAbilityInfo>>; 103 104 /** 105 * Obtains information about the ability info of the remote device. 106 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 107 * @param { ElementName } elementName - Indicates the elementName. 108 * @param { string } locale - Indicates the locale info 109 * @param { AsyncCallback<RemoteAbilityInfo> } callback - The callback of getting the ability info of the remote device. 110 * @throws { BusinessError } 201 - Permission denied. 111 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 112 * @throws { BusinessError } 401 - The parameter check failed. 113 * @throws { BusinessError } 801 - Capability not supported. 114 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 115 * @throws { BusinessError } 17700003 - The specified ability name is not found. 116 * @throws { BusinessError } 17700007 - The specified device ID is not found. 117 * @throws { BusinessError } 17700027 - The distributed service is not running. 118 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 119 * @systemapi 120 * @since 9 121 */ 122 function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback<RemoteAbilityInfo>): void; 123 124 /** 125 * Obtains information about the ability info of the remote device. 126 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 127 * @param { ElementName } elementName - Indicates the elementName. 128 * @param { string } locale - Indicates the locale info 129 * @returns { Promise<Array<RemoteAbilityInfo>> } The result of getting the ability info of the remote device. 130 * @throws { BusinessError } 201 - Permission denied. 131 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 132 * @throws { BusinessError } 401 - The parameter check failed. 133 * @throws { BusinessError } 801 - Capability not supported. 134 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 135 * @throws { BusinessError } 17700003 - The specified ability name is not found. 136 * @throws { BusinessError } 17700007 - The specified device ID is not found. 137 * @throws { BusinessError } 17700027 - The distributed service is not running. 138 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 139 * @systemapi 140 * @since 9 141 */ 142 function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise<RemoteAbilityInfo>; 143 144 /** 145 * Obtains information about the ability info of the remote device. 146 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 147 * @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten. 148 * @param { string } locale - Indicates the locale info 149 * @param { AsyncCallback } callback - Returns the abilities info of the remote device. 150 * @throws { BusinessError } 201 - Permission denied. 151 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 152 * @throws { BusinessError } 401 - The parameter check failed. 153 * @throws { BusinessError } 801 - Capability not supported. 154 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 155 * @throws { BusinessError } 17700003 - The specified ability name is not found. 156 * @throws { BusinessError } 17700007 - The specified device ID is not found. 157 * @throws { BusinessError } 17700027 - The distributed service is not running. 158 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 159 * @systemapi 160 * @since 9 161 */ 162 function getRemoteAbilityInfo(elementNames: Array<ElementName>, locale: string, callback: AsyncCallback<Array<RemoteAbilityInfo>>): void; 163 164 /** 165 * Obtains information about the abilities info of the remote device. 166 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 167 * @param { Array<ElementName> } elementNames - Indicates the elementNames, Maximum array length ten. 168 * @param { string } locale - Indicates the locale info 169 * @returns { Promise<Array<RemoteAbilityInfo>> } Returns the abilities info of the remote device. 170 * @throws { BusinessError } 201 - Permission denied. 171 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 172 * @throws { BusinessError } 401 - The parameter check failed. 173 * @throws { BusinessError } 801 - Capability not supported. 174 * @throws { BusinessError } 17700001 - The specified bundle name is not found. 175 * @throws { BusinessError } 17700003 - The specified ability name is not found. 176 * @throws { BusinessError } 17700007 - The specified device ID is not found. 177 * @throws { BusinessError } 17700027 - The distributed service is not running. 178 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 179 * @systemapi 180 * @since 9 181 */ 182 function getRemoteAbilityInfo(elementNames: Array<ElementName>, locale: string): Promise<Array<RemoteAbilityInfo>>; 183 184 /** 185 * Contains basic remote ability information. 186 * @syscap SystemCapability.BundleManager.DistributedBundleFramework 187 * @systemapi 188 * @since 9 189 */ 190 export type RemoteAbilityInfo = _RemoteAbilityInfo; 191} 192 193export default distributedBundleManager; 194