• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 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 FormKit
19 */
20
21import type { AsyncCallback } from './@ohos.base';
22import type Want from './@ohos.app.ability.Want';
23
24/**
25 * Interface of formAgent.
26 *
27 * @namespace formAgent
28 * @syscap SystemCapability.Ability.Form
29 * @systemapi
30 * @since 11
31 */
32declare namespace formAgent {
33
34  /**
35   * Request to publish a form to the form host.
36   *
37   * @permission ohos.permission.AGENT_REQUIRE_FORM
38   * @param { Want } want - The want of the form to publish.
39   * @param { AsyncCallback<string> } callback - The callback is used to return the form id.
40   * @throws { BusinessError } 202 - The application is not a system application.
41   * @throws { BusinessError } 401 - Parameter error. Possible causes:
42   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
43   * @throws { BusinessError } 16500050 - An IPC connection error happened.
44   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
45   * @throws { BusinessError } 16501000 - An internal functional error occurred.
46   * @syscap SystemCapability.Ability.Form
47   * @systemapi
48   * @since 11
49   */
50  /**
51   * Request to publish a form to the form host.
52   *
53   * @permission ohos.permission.AGENT_REQUIRE_FORM
54   * @param { Want } want - The want of the form to publish.
55   * @param { AsyncCallback<string> } callback - The callback is used to return the form id.
56   * @throws { BusinessError } 202 - The application is not a system application.
57   * @throws { BusinessError } 401 - Parameter error. Possible causes:
58   *     1.Mandatory parameters are left unspecified;2.Incorrect parameter types; 3.Parameter verification failed.
59   * @throws { BusinessError } 16500050 - IPC connection error.
60   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
61   * @throws { BusinessError } 16501000 - An internal functional error occurred.
62   * @throws { BusinessError } 16501008 - Waiting for the form addition to the desktop timed out.
63   * @syscap SystemCapability.Ability.Form
64   * @systemapi
65   * @since 12
66   */
67  function requestPublishForm(want: Want, callback: AsyncCallback<string>): void;
68
69  /**
70   * Request to publish a form to the form host.
71   *
72   * @permission ohos.permission.AGENT_REQUIRE_FORM
73   * @param { Want } want - The want of the form to publish.
74   * @returns { Promise<string> } Returns the form id.
75   * @throws { BusinessError } 202 - The application is not a system application.
76   * @throws { BusinessError } 401 - Parameter error. Possible causes:
77   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
78   * @throws { BusinessError } 16500050 - An IPC connection error happened.
79   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
80   * @throws { BusinessError } 16501000 - An internal functional error occurred.
81   * @syscap SystemCapability.Ability.Form
82   * @systemapi
83   * @since 11
84   */
85  /**
86   * Request to publish a form to the form host.
87   *
88   * @permission ohos.permission.AGENT_REQUIRE_FORM
89   * @param { Want } want - The want of the form to publish.
90   * @returns { Promise<string> } Returns the form id.
91   * @throws { BusinessError } 202 - The application is not a system application.
92   * @throws { BusinessError } 401 - Parameter error. Possible causes:
93   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
94   * @throws { BusinessError } 16500050 - IPC connection error.
95   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
96   * @throws { BusinessError } 16501000 - An internal functional error occurred.
97   * @throws { BusinessError } 16501008 - Waiting for the form addition to the desktop timed out.
98   * @syscap SystemCapability.Ability.Form
99   * @systemapi
100   * @since 12
101   */
102  function requestPublishForm(want: Want): Promise<string>;
103}
104export default formAgent;
105