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