161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit FormKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want';
2361847f8eSopenharmony_ci
2461847f8eSopenharmony_ci/**
2561847f8eSopenharmony_ci * Interface of formAgent.
2661847f8eSopenharmony_ci *
2761847f8eSopenharmony_ci * @namespace formAgent
2861847f8eSopenharmony_ci * @syscap SystemCapability.Ability.Form
2961847f8eSopenharmony_ci * @systemapi
3061847f8eSopenharmony_ci * @since 11
3161847f8eSopenharmony_ci */
3261847f8eSopenharmony_cideclare namespace formAgent {
3361847f8eSopenharmony_ci
3461847f8eSopenharmony_ci  /**
3561847f8eSopenharmony_ci   * Request to publish a form to the form host.
3661847f8eSopenharmony_ci   *
3761847f8eSopenharmony_ci   * @permission ohos.permission.AGENT_REQUIRE_FORM
3861847f8eSopenharmony_ci   * @param { Want } want - The want of the form to publish.
3961847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - The callback is used to return the form id.
4061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - The application is not a system application.
4161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes:
4261847f8eSopenharmony_ci   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
4361847f8eSopenharmony_ci   * @throws { BusinessError } 16500050 - An IPC connection error happened.
4461847f8eSopenharmony_ci   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
4561847f8eSopenharmony_ci   * @throws { BusinessError } 16501000 - An internal functional error occurred.
4661847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.Form
4761847f8eSopenharmony_ci   * @systemapi
4861847f8eSopenharmony_ci   * @since 11
4961847f8eSopenharmony_ci   */
5061847f8eSopenharmony_ci  /**
5161847f8eSopenharmony_ci   * Request to publish a form to the form host.
5261847f8eSopenharmony_ci   *
5361847f8eSopenharmony_ci   * @permission ohos.permission.AGENT_REQUIRE_FORM
5461847f8eSopenharmony_ci   * @param { Want } want - The want of the form to publish.
5561847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - The callback is used to return the form id.
5661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - The application is not a system application.
5761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes:
5861847f8eSopenharmony_ci   *     1.Mandatory parameters are left unspecified;2.Incorrect parameter types; 3.Parameter verification failed.
5961847f8eSopenharmony_ci   * @throws { BusinessError } 16500050 - IPC connection error.
6061847f8eSopenharmony_ci   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
6161847f8eSopenharmony_ci   * @throws { BusinessError } 16501000 - An internal functional error occurred.
6261847f8eSopenharmony_ci   * @throws { BusinessError } 16501008 - Waiting for the form addition to the desktop timed out.
6361847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.Form
6461847f8eSopenharmony_ci   * @systemapi
6561847f8eSopenharmony_ci   * @since 12
6661847f8eSopenharmony_ci   */
6761847f8eSopenharmony_ci  function requestPublishForm(want: Want, callback: AsyncCallback<string>): void;
6861847f8eSopenharmony_ci
6961847f8eSopenharmony_ci  /**
7061847f8eSopenharmony_ci   * Request to publish a form to the form host.
7161847f8eSopenharmony_ci   *
7261847f8eSopenharmony_ci   * @permission ohos.permission.AGENT_REQUIRE_FORM
7361847f8eSopenharmony_ci   * @param { Want } want - The want of the form to publish.
7461847f8eSopenharmony_ci   * @returns { Promise<string> } Returns the form id.
7561847f8eSopenharmony_ci   * @throws { BusinessError } 202 - The application is not a system application.
7661847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes:
7761847f8eSopenharmony_ci   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
7861847f8eSopenharmony_ci   * @throws { BusinessError } 16500050 - An IPC connection error happened.
7961847f8eSopenharmony_ci   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
8061847f8eSopenharmony_ci   * @throws { BusinessError } 16501000 - An internal functional error occurred.
8161847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.Form
8261847f8eSopenharmony_ci   * @systemapi
8361847f8eSopenharmony_ci   * @since 11
8461847f8eSopenharmony_ci   */
8561847f8eSopenharmony_ci  /**
8661847f8eSopenharmony_ci   * Request to publish a form to the form host.
8761847f8eSopenharmony_ci   *
8861847f8eSopenharmony_ci   * @permission ohos.permission.AGENT_REQUIRE_FORM
8961847f8eSopenharmony_ci   * @param { Want } want - The want of the form to publish.
9061847f8eSopenharmony_ci   * @returns { Promise<string> } Returns the form id.
9161847f8eSopenharmony_ci   * @throws { BusinessError } 202 - The application is not a system application.
9261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes:
9361847f8eSopenharmony_ci   *     1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed.
9461847f8eSopenharmony_ci   * @throws { BusinessError } 16500050 - IPC connection error.
9561847f8eSopenharmony_ci   * @throws { BusinessError } 16500100 - Failed to obtain the configuration information.
9661847f8eSopenharmony_ci   * @throws { BusinessError } 16501000 - An internal functional error occurred.
9761847f8eSopenharmony_ci   * @throws { BusinessError } 16501008 - Waiting for the form addition to the desktop timed out.
9861847f8eSopenharmony_ci   * @syscap SystemCapability.Ability.Form
9961847f8eSopenharmony_ci   * @systemapi
10061847f8eSopenharmony_ci   * @since 12
10161847f8eSopenharmony_ci   */
10261847f8eSopenharmony_ci  function requestPublishForm(want: Want): Promise<string>;
10361847f8eSopenharmony_ci}
10461847f8eSopenharmony_ciexport default formAgent;
105