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