1/* 2 * Copyright (c) 2022-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 { AsyncCallback } from './@ohos.base'; 22import { Callback } from './@ohos.base'; 23import Want from './@ohos.app.ability.Want'; 24import formInfo from './@ohos.app.form.formInfo'; 25 26/** 27 * Interface of formHost. 28 * 29 * @namespace formHost 30 * @syscap SystemCapability.Ability.Form 31 * @systemapi 32 * @since 9 33 */ 34declare namespace formHost { 35 /** 36 * Add a form. 37 * <p>You can use this method to create a theme form.</p> 38 * 39 * @permission ohos.permission.REQUIRE_FORM 40 * @param { Want } want - Indicates want of the form. 41 * @returns { Promise<formInfo.RunningFormInfo> } Return the form info. 42 * @throws { BusinessError } 201 - Permissions denied. 43 * @throws { BusinessError } 202 - The application is not a system application. 44 * @throws { BusinessError } 401 - Parameter error. Possible causes: 45 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 46 * @throws { BusinessError } 16500050 - IPC connection error. 47 * @throws { BusinessError } 16500060 - Service connection error. 48 * @throws { BusinessError } 16501000 - An internal functional error occurred. 49 * @syscap SystemCapability.Ability.Form 50 * @systemapi 51 * @stagemodelonly 52 * @since 12 53 */ 54 function addForm(want: Want): Promise<formInfo.RunningFormInfo>; 55 56 /** 57 * Deletes an obtained form by its ID. 58 * <p>After this method is called, the form won't be available for use by the application and the Form Manager 59 * Service no longer keeps the cache information about the form.</p> 60 * 61 * @permission ohos.permission.REQUIRE_FORM 62 * @param { string } formId - Indicates the form ID. 63 * @param { AsyncCallback<void> } callback - The callback of deleteForm. 64 * @throws { BusinessError } 201 - Permissions denied. 65 * @throws { BusinessError } 202 - The application is not a system application. 66 * @throws { BusinessError } 401 - Parameter error. Possible causes: 67 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 68 * @throws { BusinessError } 16500050 - IPC connection error. 69 * @throws { BusinessError } 16500060 - Service connection error. 70 * @throws { BusinessError } 16501000 - An internal functional error occurred. 71 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 72 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 73 * @syscap SystemCapability.Ability.Form 74 * @systemapi 75 * @since 9 76 */ 77 function deleteForm(formId: string, callback: AsyncCallback<void>): void; 78 79 /** 80 * Deletes an obtained form by its ID. 81 * <p>After this method is called, the form won't be available for use by the application and the Form Manager 82 * Service no longer keeps the cache information about the form.</p> 83 * 84 * @permission ohos.permission.REQUIRE_FORM 85 * @param { string } formId - Indicates the form ID. 86 * @returns { Promise<void> } The promise returned by the function. 87 * @throws { BusinessError } 201 - Permissions denied. 88 * @throws { BusinessError } 202 - The application is not a system application. 89 * @throws { BusinessError } 401 - Parameter error. Possible causes: 90 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 91 * @throws { BusinessError } 16500050 - IPC connection error. 92 * @throws { BusinessError } 16500060 - Service connection error. 93 * @throws { BusinessError } 16501000 - An internal functional error occurred. 94 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 95 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 96 * @syscap SystemCapability.Ability.Form 97 * @systemapi 98 * @since 9 99 */ 100 function deleteForm(formId: string): Promise<void>; 101 102 /** 103 * Releases an obtained form by its ID. 104 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 105 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 106 * the {@code formId}.</p> 107 * 108 * @permission ohos.permission.REQUIRE_FORM 109 * @param { string } formId - Indicates the form ID 110 * @param { AsyncCallback<void> } callback - The callback of releaseForm. 111 * @throws { BusinessError } 201 - Permissions denied. 112 * @throws { BusinessError } 202 - The application is not a system application. 113 * @throws { BusinessError } 401 - Parameter error. Possible causes: 114 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 115 * @throws { BusinessError } 16500050 - IPC connection error. 116 * @throws { BusinessError } 16500060 - Service connection error. 117 * @throws { BusinessError } 16501000 - An internal functional error occurred. 118 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 119 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 120 * @syscap SystemCapability.Ability.Form 121 * @systemapi 122 * @since 9 123 */ 124 function releaseForm(formId: string, callback: AsyncCallback<void>): void; 125 126 /** 127 * Releases an obtained form by its ID. 128 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 129 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 130 * the {@code formId}.</p> 131 * 132 * @permission ohos.permission.REQUIRE_FORM 133 * @param { string } formId - Indicates the form ID 134 * @param { boolean } isReleaseCache - Indicates whether release cache or not. 135 * @param { AsyncCallback<void> } callback - The callback of releaseForm. 136 * @throws { BusinessError } 201 - Permissions denied. 137 * @throws { BusinessError } 202 - The application is not a system application. 138 * @throws { BusinessError } 401 - Parameter error. Possible causes: 139 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 140 * @throws { BusinessError } 16500050 - IPC connection error. 141 * @throws { BusinessError } 16500060 - Service connection error. 142 * @throws { BusinessError } 16501000 - An internal functional error occurred. 143 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 144 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 145 * @syscap SystemCapability.Ability.Form 146 * @systemapi 147 * @since 9 148 */ 149 function releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback<void>): void; 150 151 /** 152 * Releases an obtained form by its ID. 153 * <p>After this method is called, the form won't be available for use by the application, but the Form Manager 154 * Service still keeps the cache information about the form, so that the application can quickly obtain it based on 155 * the {@code formId}.</p> 156 * 157 * @permission ohos.permission.REQUIRE_FORM 158 * @param { string } formId - Indicates the form ID 159 * @param { boolean } [isReleaseCache] - Indicates whether release cache or not. 160 * @returns { Promise<void> } The promise returned by the function. 161 * @throws { BusinessError } 201 - Permissions denied. 162 * @throws { BusinessError } 202 - The application is not a system application. 163 * @throws { BusinessError } 401 - Parameter error. Possible causes: 164 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 165 * @throws { BusinessError } 16500050 - IPC connection error. 166 * @throws { BusinessError } 16500060 - Service connection error. 167 * @throws { BusinessError } 16501000 - An internal functional error occurred. 168 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 169 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 170 * @syscap SystemCapability.Ability.Form 171 * @systemapi 172 * @since 9 173 */ 174 function releaseForm(formId: string, isReleaseCache?: boolean): Promise<void>; 175 176 /** 177 * Requests for form update. 178 * <p>This method must be called when the application has detected that a system setting item (such as the language, 179 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 180 * provider automatically updates the form data (if there is any update) through the form framework, with the update 181 * process being unperceivable by the application.</p> 182 * 183 * @permission ohos.permission.REQUIRE_FORM 184 * @param { string } formId - Indicates the ID of the form to update. 185 * @param { AsyncCallback<void> } callback - The callback of requestForm. 186 * @throws { BusinessError } 201 - Permissions denied. 187 * @throws { BusinessError } 202 - The application is not a system application. 188 * @throws { BusinessError } 401 - Parameter error. Possible causes: 189 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 190 * @throws { BusinessError } 16500050 - IPC connection error. 191 * @throws { BusinessError } 16500060 - Service connection error. 192 * @throws { BusinessError } 16501000 - An internal functional error occurred. 193 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 194 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 195 * @syscap SystemCapability.Ability.Form 196 * @systemapi 197 * @since 9 198 */ 199 function requestForm(formId: string, callback: AsyncCallback<void>): void; 200 201 /** 202 * Requests for form update. 203 * <p>This method must be called when the application has detected that a system setting item (such as the language, 204 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 205 * provider automatically updates the form data (if there is any update) through the form framework, with the update 206 * process being unperceivable by the application.</p> 207 * 208 * @permission ohos.permission.REQUIRE_FORM 209 * @param { string } formId - Indicates the ID of the form to update. 210 * @returns { Promise<void> } The promise returned by the function. 211 * @throws { BusinessError } 201 - Permissions denied. 212 * @throws { BusinessError } 202 - The application is not a system application. 213 * @throws { BusinessError } 401 - Parameter error. Possible causes: 214 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 215 * @throws { BusinessError } 16500050 - IPC connection error. 216 * @throws { BusinessError } 16500060 - Service connection error. 217 * @throws { BusinessError } 16501000 - An internal functional error occurred. 218 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 219 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 220 * @syscap SystemCapability.Ability.Form 221 * @systemapi 222 * @since 9 223 */ 224 function requestForm(formId: string): Promise<void>; 225 226 /** 227 * Requests for form update. 228 * <p>This method must be called when the application has detected that a system setting item (such as the language, 229 * resolution, or screen orientation) being listened for has changed. Upon receiving the update request, the form 230 * provider automatically updates the form data (if there is any update) through the form framework, with the update 231 * process being unperceivable by the application.</p> 232 * 233 * @permission ohos.permission.REQUIRE_FORM 234 * @param { string } formId - Indicates the ID of the form to update. 235 * @param { Record<string, Object> } [wantParams] - Indicates want params of the form to update. 236 * @returns { Promise<void> } The promise returned by the function. 237 * @throws { BusinessError } 201 - Permissions denied. 238 * @throws { BusinessError } 202 - The application is not a system application. 239 * @throws { BusinessError } 401 - Parameter error. Possible causes: 240 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 241 * @throws { BusinessError } 16500050 - IPC connection error. 242 * @throws { BusinessError } 16500060 - Service connection error. 243 * @throws { BusinessError } 16501000 - An internal functional error occurred. 244 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 245 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 246 * @syscap SystemCapability.Ability.Form 247 * @systemapi 248 * @since 12 249 */ 250 function requestFormWithParams(formId: string, wantParams?: Record<string, Object>): Promise<void>; 251 252 /** 253 * Converts a specified temporary form that has been obtained by the application into a normal form. 254 * 255 * @permission ohos.permission.REQUIRE_FORM 256 * @param { string } formId - Indicates the ID of the temporary form to convert. 257 * @param { AsyncCallback<void> } callback - The callback of castToNormalForm. 258 * @throws { BusinessError } 201 - Permissions denied. 259 * @throws { BusinessError } 202 - The application is not a system application. 260 * @throws { BusinessError } 401 - Parameter error. Possible causes: 261 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 262 * @throws { BusinessError } 16500050 - IPC connection error. 263 * @throws { BusinessError } 16501000 - An internal functional error occurred. 264 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 265 * @throws { BusinessError } 16501002 - The number of forms exceeds the maximum allowed. 266 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 267 * @syscap SystemCapability.Ability.Form 268 * @systemapi 269 * @since 9 270 */ 271 function castToNormalForm(formId: string, callback: AsyncCallback<void>): void; 272 273 /** 274 * Converts a specified temporary form that has been obtained by the application into a normal form. 275 * 276 * @permission ohos.permission.REQUIRE_FORM 277 * @param { string } formId - Indicates the ID of the temporary form to convert. 278 * @returns { Promise<void> } The promise returned by the function. 279 * @throws { BusinessError } 201 - Permissions denied. 280 * @throws { BusinessError } 202 - The application is not a system application. 281 * @throws { BusinessError } 401 - Parameter error. Possible causes: 282 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 283 * @throws { BusinessError } 16500050 - IPC connection error. 284 * @throws { BusinessError } 16501000 - An internal functional error occurred. 285 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 286 * @throws { BusinessError } 16501002 - The number of forms exceeds the maximum allowed. 287 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 288 * @syscap SystemCapability.Ability.Form 289 * @systemapi 290 * @since 9 291 */ 292 function castToNormalForm(formId: string): Promise<void>; 293 294 /** 295 * Sends a notification to the form framework to make the specified forms visible. 296 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 297 * the form visibility change event.</p> 298 * 299 * @permission ohos.permission.REQUIRE_FORM 300 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible. 301 * @param { AsyncCallback<void> } callback - The callback of notifyVisibleForms. 302 * @throws { BusinessError } 201 - Permissions denied. 303 * @throws { BusinessError } 202 - The application is not a system application. 304 * @throws { BusinessError } 401 - Parameter error. Possible causes: 305 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 306 * @throws { BusinessError } 16500050 - IPC connection error. 307 * @throws { BusinessError } 16500060 - Service connection error. 308 * @throws { BusinessError } 16501000 - An internal functional error occurred. 309 * @syscap SystemCapability.Ability.Form 310 * @systemapi 311 * @since 9 312 */ 313 function notifyVisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 314 315 /** 316 * Sends a notification to the form framework to make the specified forms visible. 317 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 318 * the form visibility change event.</p> 319 * 320 * @permission ohos.permission.REQUIRE_FORM 321 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made visible. 322 * @returns { Promise<void> } The promise returned by the function. 323 * @throws { BusinessError } 201 - Permissions denied. 324 * @throws { BusinessError } 202 - The application is not a system application. 325 * @throws { BusinessError } 401 - Parameter error. Possible causes: 326 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 327 * @throws { BusinessError } 16500050 - IPC connection error. 328 * @throws { BusinessError } 16500060 - Service connection error. 329 * @throws { BusinessError } 16501000 - An internal functional error occurred. 330 * @syscap SystemCapability.Ability.Form 331 * @systemapi 332 * @since 9 333 */ 334 function notifyVisibleForms(formIds: Array<string>): Promise<void>; 335 336 /** 337 * Sends a notification to the form framework to make the specified forms invisible. 338 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 339 * the form visibility change event.</p> 340 * 341 * @permission ohos.permission.REQUIRE_FORM 342 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 343 * @param { AsyncCallback<void> } callback - The callback of notifyInvisibleForms. 344 * @throws { BusinessError } 201 - Permissions denied. 345 * @throws { BusinessError } 202 - The application is not a system application. 346 * @throws { BusinessError } 401 - Parameter error. Possible causes: 347 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 348 * @throws { BusinessError } 16500050 - IPC connection error. 349 * @throws { BusinessError } 16500060 - Service connection error. 350 * @throws { BusinessError } 16501000 - An internal functional error occurred. 351 * @syscap SystemCapability.Ability.Form 352 * @systemapi 353 * @since 9 354 */ 355 function notifyInvisibleForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 356 357 /** 358 * Sends a notification to the form framework to make the specified forms invisible. 359 * <p>After this method is successfully called, onVisibilityChange will be called to notify the form provider of 360 * the form visibility change event.</p> 361 * 362 * @permission ohos.permission.REQUIRE_FORM 363 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 364 * @returns { Promise<void> } The promise returned by the function. 365 * @throws { BusinessError } 201 - Permissions denied. 366 * @throws { BusinessError } 202 - The application is not a system application. 367 * @throws { BusinessError } 401 - Parameter error. Possible causes: 368 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 369 * @throws { BusinessError } 16500050 - IPC connection error. 370 * @throws { BusinessError } 16500060 - Service connection error. 371 * @throws { BusinessError } 16501000 - An internal functional error occurred. 372 * @syscap SystemCapability.Ability.Form 373 * @systemapi 374 * @since 9 375 */ 376 function notifyInvisibleForms(formIds: Array<string>): Promise<void>; 377 378 /** 379 * Notify the form framework to make the specified forms updatable. 380 * <p>You can use this method to set form refresh state to true, the form can receive new 381 * update from service.</p> 382 * 383 * @permission ohos.permission.REQUIRE_FORM 384 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 385 * @param { AsyncCallback<void> } callback - The callback of enableFormsUpdate. 386 * @throws { BusinessError } 201 - Permissions denied. 387 * @throws { BusinessError } 202 - The application is not a system application. 388 * @throws { BusinessError } 401 - Parameter error. Possible causes: 389 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 390 * @throws { BusinessError } 16500050 - IPC connection error. 391 * @throws { BusinessError } 16500060 - Service connection error. 392 * @throws { BusinessError } 16501000 - An internal functional error occurred. 393 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 394 * @syscap SystemCapability.Ability.Form 395 * @systemapi 396 * @since 9 397 */ 398 function enableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void; 399 400 /** 401 * Notify the form framework to make the specified forms updatable. 402 * <p>You can use this method to set form refresh state to true, the form can receive new 403 * update from service.</p> 404 * 405 * @permission ohos.permission.REQUIRE_FORM 406 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 407 * @returns { Promise<void> } The promise returned by the function. 408 * @throws { BusinessError } 201 - Permissions denied. 409 * @throws { BusinessError } 202 - The application is not a system application. 410 * @throws { BusinessError } 401 - Parameter error. Possible causes: 411 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 412 * @throws { BusinessError } 16500050 - IPC connection error. 413 * @throws { BusinessError } 16500060 - Service connection error. 414 * @throws { BusinessError } 16501000 - An internal functional error occurred. 415 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 416 * @syscap SystemCapability.Ability.Form 417 * @systemapi 418 * @since 9 419 */ 420 function enableFormsUpdate(formIds: Array<string>): Promise<void>; 421 422 /** 423 * Notify the form framework to make the specified forms non-updatable. 424 * <p>You can use this method to set form refresh state to false, the form do not receive 425 * new update from service.</p> 426 * 427 * @permission ohos.permission.REQUIRE_FORM 428 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 429 * @param { AsyncCallback<void> } callback - The callback of disableFormsUpdate. 430 * @throws { BusinessError } 201 - Permissions denied. 431 * @throws { BusinessError } 202 - The application is not a system application. 432 * @throws { BusinessError } 401 - Parameter error. Possible causes: 433 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 434 * @throws { BusinessError } 16500050 - IPC connection error. 435 * @throws { BusinessError } 16500060 - Service connection error. 436 * @throws { BusinessError } 16501000 - An internal functional error occurred. 437 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 438 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 439 * @syscap SystemCapability.Ability.Form 440 * @systemapi 441 * @since 9 442 */ 443 function disableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void>): void; 444 445 /** 446 * Notify the form framework to make the specified forms non updatable. 447 * <p>You can use this method to set form refresh state to false, the form do not receive 448 * new update from service.</p> 449 * 450 * @permission ohos.permission.REQUIRE_FORM 451 * @param { Array<string> } formIds - Indicates the IDs of the forms to be made invisible. 452 * @returns { Promise<void> } The promise returned by the function. 453 * @throws { BusinessError } 201 - Permissions denied. 454 * @throws { BusinessError } 202 - The application is not a system application. 455 * @throws { BusinessError } 401 - Parameter error. Possible causes: 456 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 457 * @throws { BusinessError } 16500050 - IPC connection error. 458 * @throws { BusinessError } 16500060 - Service connection error. 459 * @throws { BusinessError } 16501000 - An internal functional error occurred. 460 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 461 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 462 * @syscap SystemCapability.Ability.Form 463 * @systemapi 464 * @since 9 465 */ 466 function disableFormsUpdate(formIds: Array<string>): Promise<void>; 467 468 /** 469 * Checks whether the system is ready. 470 * <p>You can use this method to obtain the system is ready.</p> 471 * 472 * @param { AsyncCallback<void> } callback - The callback of isSystemReady. 473 * @throws { BusinessError } 202 - The application is not a system application. 474 * @throws { BusinessError } 401 - Parameter error. Possible causes: 475 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 476 * @syscap SystemCapability.Ability.Form 477 * @systemapi 478 * @since 9 479 */ 480 function isSystemReady(callback: AsyncCallback<void>): void; 481 482 /** 483 * Checks whether the system is ready. 484 * <p>You can use this method to obtain the system is ready.</p> 485 * 486 * @returns { Promise<void> } The promise returned by the function. 487 * @throws { BusinessError } 202 - The application is not a system application. 488 * @syscap SystemCapability.Ability.Form 489 * @systemapi 490 * @since 9 491 */ 492 function isSystemReady(): Promise<void>; 493 494 /** 495 * Obtains the FormInfo objects provided by all applications on the device. 496 * 497 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 498 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 499 * @throws { BusinessError } 201 - Permissions denied. 500 * @throws { BusinessError } 202 - The application is not a system application. 501 * @throws { BusinessError } 401 - Parameter error. Possible causes: 502 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 503 * @throws { BusinessError } 16500050 - IPC connection error. 504 * @throws { BusinessError } 16500060 - Service connection error. 505 * @throws { BusinessError } 16501000 - An internal functional error occurred. 506 * @syscap SystemCapability.Ability.Form 507 * @systemapi 508 * @since 9 509 */ 510 function getAllFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 511 512 /** 513 * Obtains the FormInfo objects provided by all applications on the device. 514 * 515 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 516 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 517 * @throws { BusinessError } 201 - Permissions denied. 518 * @throws { BusinessError } 202 - The application is not a system application. 519 * @throws { BusinessError } 16500050 - IPC connection error. 520 * @throws { BusinessError } 16500060 - Service connection error. 521 * @throws { BusinessError } 16501000 - An internal functional error occurred. 522 * @syscap SystemCapability.Ability.Form 523 * @systemapi 524 * @since 9 525 */ 526 function getAllFormsInfo(): Promise<Array<formInfo.FormInfo>>; 527 528 /** 529 * Obtains the FormInfo objects provided by a specified application on the device. 530 * 531 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 532 * @param { string } bundleName - Indicates the bundle name of the application. 533 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 534 * @throws { BusinessError } 201 - Permissions denied. 535 * @throws { BusinessError } 202 - The application is not a system application. 536 * @throws { BusinessError } 401 - Parameter error. Possible causes: 537 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 538 * @throws { BusinessError } 16500050 - IPC connection error. 539 * @throws { BusinessError } 16500060 - Service connection error. 540 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 541 * @throws { BusinessError } 16501000 - An internal functional error occurred. 542 * @syscap SystemCapability.Ability.Form 543 * @systemapi 544 * @since 9 545 */ 546 function getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.FormInfo>>): void; 547 548 /** 549 * Obtains the FormInfo objects provided by a specified application on the device. 550 * 551 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 552 * @param { string } bundleName - Indicates the bundle name of the application. 553 * @param { string } moduleName - Indicates the module name of the application. 554 * @param { AsyncCallback<Array<formInfo.FormInfo>> } callback - The callback is used to return the FormInfo. 555 * @throws { BusinessError } 201 - Permissions denied. 556 * @throws { BusinessError } 202 - The application is not a system application. 557 * @throws { BusinessError } 401 - Parameter error. Possible causes: 558 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 559 * @throws { BusinessError } 16500050 - IPC connection error. 560 * @throws { BusinessError } 16500060 - Service connection error. 561 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 562 * @throws { BusinessError } 16501000 - An internal functional error occurred. 563 * @syscap SystemCapability.Ability.Form 564 * @systemapi 565 * @since 9 566 */ 567 function getFormsInfo( 568 bundleName: string, 569 moduleName: string, 570 callback: AsyncCallback<Array<formInfo.FormInfo>> 571 ): void; 572 573 /** 574 * Obtains the FormInfo objects provided by a specified application on the device. 575 * 576 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 577 * @param { string } bundleName - Indicates the bundle name of the application. 578 * @param { string } [moduleName] - Indicates the module name of the application. 579 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 580 * @throws { BusinessError } 201 - Permissions denied. 581 * @throws { BusinessError } 202 - The application is not a system application. 582 * @throws { BusinessError } 401 - Parameter error. Possible causes: 583 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 584 * @throws { BusinessError } 16500050 - IPC connection error. 585 * @throws { BusinessError } 16500060 - Service connection error. 586 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 587 * @throws { BusinessError } 16501000 - An internal functional error occurred. 588 * @syscap SystemCapability.Ability.Form 589 * @systemapi 590 * @since 9 591 */ 592 function getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formInfo.FormInfo>>; 593 594 /** 595 * Obtains the FormInfo objects provided by all application with filter on the device. 596 * 597 * @permission ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 598 * @param { formInfo.FormInfoFilter } filter - Indicates the requirements the forms that the formInfos belong to have to meet. 599 * @returns { Promise<Array<formInfo.FormInfo>> } Returns the FormInfo. 600 * @throws { BusinessError } 201 - Permissions denied. 601 * @throws { BusinessError } 202 - The application is not a system application. 602 * @throws { BusinessError } 401 - Parameter error. Possible causes: 603 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 604 * @throws { BusinessError } 16500050 - IPC connection error. 605 * @throws { BusinessError } 16500060 - Service connection error. 606 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 607 * @throws { BusinessError } 16501000 - An internal functional error occurred. 608 * @syscap SystemCapability.Ability.Form 609 * @systemapi 610 * @since 12 611 */ 612 function getFormsInfo(filter: formInfo.FormInfoFilter): Promise<Array<formInfo.FormInfo>>; 613 614 /** 615 * Deletes invalid forms of the application in the Form Manager Service based on the list of. 616 * <p>You can use this method to delete invalid forms of the application.</p> 617 * 618 * @permission ohos.permission.REQUIRE_FORM 619 * @param { Array<string> } formIds - Indicates the specified form id. 620 * @param { AsyncCallback<number> } callback - The callback is used to return the number of invalid forms deleted 621 * by the Form Manager Service. 622 * @throws { BusinessError } 201 - Permissions denied. 623 * @throws { BusinessError } 202 - The application is not a system application. 624 * @throws { BusinessError } 401 - Parameter error. Possible causes: 625 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 626 * @throws { BusinessError } 16500050 - IPC connection error. 627 * @throws { BusinessError } 16500060 - Service connection error. 628 * @throws { BusinessError } 16501000 - An internal functional error occurred. 629 * @syscap SystemCapability.Ability.Form 630 * @systemapi 631 * @since 9 632 */ 633 function deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<number>): void; 634 635 /** 636 * Deletes invalid forms of the application in the Form Manager Service based on the list of. 637 * <p>You can use this method to delete invalid forms of the application.</p> 638 * 639 * @permission ohos.permission.REQUIRE_FORM 640 * @param { Array<string> } formIds - Indicates the specified form id. 641 * @returns { Promise<number> } Returns the number of invalid forms deleted by the Form Manager Service. 642 * @throws { BusinessError } 201 - Permissions denied. 643 * @throws { BusinessError } 202 - The application is not a system application. 644 * @throws { BusinessError } 401 - Parameter error. Possible causes: 645 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 646 * @throws { BusinessError } 16500050 - IPC connection error. 647 * @throws { BusinessError } 16500060 - Service connection error. 648 * @throws { BusinessError } 16501000 - An internal functional error occurred. 649 * @syscap SystemCapability.Ability.Form 650 * @systemapi 651 * @since 9 652 */ 653 function deleteInvalidForms(formIds: Array<string>): Promise<number>; 654 655 /** 656 * Obtains the Form state. 657 * <p>You can use this method to obtains the form state.</p> 658 * 659 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 660 * @param { Want } want - Indicates want of the form. 661 * @param { AsyncCallback<formInfo.FormStateInfo> } callback - The callback is used to return the form state. 662 * @throws { BusinessError } 201 - Permissions denied. 663 * @throws { BusinessError } 202 - The application is not a system application. 664 * @throws { BusinessError } 401 - Parameter error. Possible causes: 665 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 666 * @throws { BusinessError } 16500050 - IPC connection error. 667 * @throws { BusinessError } 16500060 - Service connection error. 668 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 669 * @throws { BusinessError } 16501000 - An internal functional error occurred. 670 * @syscap SystemCapability.Ability.Form 671 * @systemapi 672 * @since 9 673 */ 674 function acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo>): void; 675 676 /** 677 * Obtains the Form state. 678 * <p>You can use this method to obtains the form state.</p> 679 * 680 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 681 * @param { Want } want - Indicates want of the form. 682 * @returns { Promise<formInfo.FormStateInfo> } Returns the form state. 683 * @throws { BusinessError } 201 - Permissions denied. 684 * @throws { BusinessError } 202 - The application is not a system application. 685 * @throws { BusinessError } 401 - Parameter error. Possible causes: 686 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 687 * @throws { BusinessError } 16500050 - IPC connection error. 688 * @throws { BusinessError } 16500060 - Service connection error. 689 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 690 * @throws { BusinessError } 16501000 - An internal functional error occurred. 691 * @syscap SystemCapability.Ability.Form 692 * @systemapi 693 * @since 9 694 */ 695 function acquireFormState(want: Want): Promise<formInfo.FormStateInfo>; 696 697 /** 698 * Listens to the event of uninstall form. 699 * <p>You can use this method to listen to the event of uninstall form.</p> 700 * 701 * @param { 'formUninstall' } type - Indicates event type. 702 * @param { Callback<string> } callback - The callback of formUninstall. 703 * @throws { BusinessError } 202 - The application is not a system application. 704 * @throws { BusinessError } 401 - Parameter error. Possible causes: 705 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 706 * @syscap SystemCapability.Ability.Form 707 * @systemapi 708 * @since 9 709 */ 710 function on(type: 'formUninstall', callback: Callback<string>): void; 711 712 /** 713 * Cancels listening to the event of uninstall form. 714 * <p>You can use this method to cancel listening to the event of uninstall form.</p> 715 * 716 * @param { 'formUninstall' } type - Indicates event type. 717 * @param { Callback<string> } [callback] - The callback of formUninstall. 718 * @throws { BusinessError } 202 - The application is not a system application. 719 * @throws { BusinessError } 401 - Parameter error. Possible causes: 720 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 721 * @syscap SystemCapability.Ability.Form 722 * @systemapi 723 * @since 9 724 */ 725 function off(type: 'formUninstall', callback?: Callback<string>): void; 726 727 /** 728 * Notify form is Visible 729 * <p>You can use this method to notify form visible state.</p> 730 * 731 * @permission ohos.permission.REQUIRE_FORM 732 * @param { Array<string> } formIds - Indicates the specified form id. 733 * @param { boolean } isVisible - Indicates whether visible. 734 * @param { AsyncCallback<void> } callback - The callback of notifyFormsVisible. 735 * @throws { BusinessError } 201 - Permissions denied. 736 * @throws { BusinessError } 202 - The application is not a system application. 737 * @throws { BusinessError } 401 - Parameter error. Possible causes: 738 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 739 * @throws { BusinessError } 16500050 - IPC connection error. 740 * @throws { BusinessError } 16500060 - Service connection error. 741 * @throws { BusinessError } 16501000 - An internal functional error occurred. 742 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 743 * @syscap SystemCapability.Ability.Form 744 * @systemapi 745 * @since 9 746 */ 747 function notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: AsyncCallback<void>): void; 748 749 /** 750 * Notify form is Visible 751 * <p>You can use this method to notify form visible state.</p> 752 * 753 * @permission ohos.permission.REQUIRE_FORM 754 * @param { Array<string> } formIds - Indicates the specified form id. 755 * @param { boolean } isVisible - Indicates whether visible. 756 * @returns { Promise<void> } The promise returned by the function. 757 * @throws { BusinessError } 201 - Permissions denied. 758 * @throws { BusinessError } 202 - The application is not a system application. 759 * @throws { BusinessError } 401 - Parameter error. Possible causes: 760 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 761 * @throws { BusinessError } 16500050 - IPC connection error. 762 * @throws { BusinessError } 16500060 - Service connection error. 763 * @throws { BusinessError } 16501000 - An internal functional error occurred. 764 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 765 * @syscap SystemCapability.Ability.Form 766 * @systemapi 767 * @since 9 768 */ 769 function notifyFormsVisible(formIds: Array<string>, isVisible: boolean): Promise<void>; 770 771 /** 772 * Notify form enable update state. 773 * <p>You can use this method to notify form enable update state.</p> 774 * 775 * @permission ohos.permission.REQUIRE_FORM 776 * @param { Array<string> } formIds - Indicates the specified form id. 777 * @param { boolean } isEnableUpdate - Indicates whether enable update. 778 * @param { AsyncCallback<void> } callback - The callback of notifyFormsEnableUpdate. 779 * @throws { BusinessError } 201 - Permissions denied. 780 * @throws { BusinessError } 202 - The application is not a system application. 781 * @throws { BusinessError } 401 - Parameter error. Possible causes: 782 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 783 * @throws { BusinessError } 16500050 - IPC connection error. 784 * @throws { BusinessError } 16500060 - Service connection error. 785 * @throws { BusinessError } 16501000 - An internal functional error occurred. 786 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 787 * @syscap SystemCapability.Ability.Form 788 * @systemapi 789 * @since 9 790 */ 791 function notifyFormsEnableUpdate( 792 formIds: Array<string>, 793 isEnableUpdate: boolean, 794 callback: AsyncCallback<void> 795 ): void; 796 797 /** 798 * Notify form enable update state. 799 * <p>You can use this method to notify form enable update state.</p> 800 * 801 * @permission ohos.permission.REQUIRE_FORM 802 * @param { Array<string> } formIds - Indicates the specified form id. 803 * @param { boolean } isEnableUpdate - Indicates whether enable update. 804 * @returns { Promise<void> } The promise returned by the function. 805 * @throws { BusinessError } 201 - Permissions denied. 806 * @throws { BusinessError } 202 - The application is not a system application. 807 * @throws { BusinessError } 401 - Parameter error. Possible causes: 808 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 809 * @throws { BusinessError } 16500050 - IPC connection error. 810 * @throws { BusinessError } 16500060 - Service connection error. 811 * @throws { BusinessError } 16501000 - An internal functional error occurred. 812 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 813 * @syscap SystemCapability.Ability.Form 814 * @systemapi 815 * @since 9 816 */ 817 function notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean): Promise<void>; 818 819 /** 820 * Share form by formId and deviceId. 821 * 822 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC 823 * @param { string } formId - Indicates the form ID. 824 * @param { string } deviceId - Indicates the remote device ID. 825 * @param { AsyncCallback<void> } callback - The callback of shareForm. 826 * @throws { BusinessError } 201 - Permissions denied. 827 * @throws { BusinessError } 202 - The application is not a system application. 828 * @throws { BusinessError } 401 - Parameter error. Possible causes: 829 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 830 * @throws { BusinessError } 16500050 - IPC connection error. 831 * @throws { BusinessError } 16501000 - An internal functional error occurred. 832 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 833 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 834 * @syscap SystemCapability.Ability.Form 835 * @systemapi 836 * @since 9 837 */ 838 function shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>): void; 839 840 /** 841 * Share form by formId and deviceId. 842 * 843 * @permission ohos.permission.REQUIRE_FORM and ohos.permission.DISTRIBUTED_DATASYNC 844 * @param { string } formId - Indicates the form ID. 845 * @param { string } deviceId - Indicates the remote device ID. 846 * @returns { Promise<void> } The promise returned by the function. 847 * @throws { BusinessError } 201 - Permissions denied. 848 * @throws { BusinessError } 202 - The application is not a system application. 849 * @throws { BusinessError } 401 - Parameter error. Possible causes: 850 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 851 * @throws { BusinessError } 16500050 - IPC connection error. 852 * @throws { BusinessError } 16501000 - An internal functional error occurred. 853 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 854 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 855 * @syscap SystemCapability.Ability.Form 856 * @systemapi 857 * @since 9 858 */ 859 function shareForm(formId: string, deviceId: string): Promise<void>; 860 861 /** 862 * Notify form that privacy whether to be protected. 863 * 864 * @permission ohos.permission.REQUIRE_FORM 865 * @param { Array<string> } formIds - Indicates the specified form id. 866 * @param { boolean } isProtected - Indicates whether to be protected. 867 * @param { AsyncCallback<void> } callback - The callback of notifyFormsPrivacyProtected. 868 * @throws { BusinessError } 201 - Permissions denied. 869 * @throws { BusinessError } 202 - The application is not a system application. 870 * @throws { BusinessError } 401 - Parameter error. Possible causes: 871 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 872 * @throws { BusinessError } 16500050 - IPC connection error. 873 * @throws { BusinessError } 16500060 - Service connection error. 874 * @throws { BusinessError } 16501000 - An internal functional error occurred. 875 * @syscap SystemCapability.Ability.Form 876 * @systemapi 877 * @since 9 878 */ 879 function notifyFormsPrivacyProtected( 880 formIds: Array<string>, 881 isProtected: boolean, 882 callback: AsyncCallback<void> 883 ): void; 884 885 /** 886 * Notify form that privacy whether to be protected. 887 * 888 * @permission ohos.permission.REQUIRE_FORM 889 * @param { Array<string> } formIds - Indicates the specified form id. 890 * @param { boolean } isProtected - Indicates whether to be protected. 891 * @returns { Promise<void> } The promise returned by the function. 892 * @throws { BusinessError } 201 - Permissions denied. 893 * @throws { BusinessError } 202 - The application is not a system application. 894 * @throws { BusinessError } 401 - Parameter error. Possible causes: 895 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 896 * @throws { BusinessError } 16500050 - IPC connection error. 897 * @throws { BusinessError } 16500060 - Service connection error. 898 * @throws { BusinessError } 16501000 - An internal functional error occurred. 899 * @syscap SystemCapability.Ability.Form 900 * @systemapi 901 * @since 9 902 */ 903 function notifyFormsPrivacyProtected(formIds: Array<string>, isProtected: boolean): Promise<void>; 904 905 /** 906 * Acquire form data by formId. 907 * 908 * @permission ohos.permission.REQUIRE_FORM 909 * @param { string } formId - Indicates the form ID. 910 * @param { AsyncCallback<{ [key: string]: Object }> } callback - The callback of acquireFormData. 911 * @throws { BusinessError } 201 - Permissions denied. 912 * @throws { BusinessError } 401 - Parameter error. Possible causes: 913 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 914 * @throws { BusinessError } 16500050 - An IPC connection error happened. 915 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 916 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 917 * @throws { BusinessError } 16501000 - An internal functional error occurred. 918 * invalid input parameter during form operation 919 * @syscap SystemCapability.Ability.Form 920 * @systemapi 921 * @StageModelOnly 922 * @since 10 923 */ 924 /** 925 * Acquire form data by formId. 926 * 927 * @permission ohos.permission.REQUIRE_FORM 928 * @param { string } formId - Indicates the form ID. 929 * @param { AsyncCallback<Record<string, Object>> } callback - The callback of acquireFormData. 930 * @throws { BusinessError } 201 - Permissions denied. 931 * @throws { BusinessError } 401 - Parameter error. Possible causes: 932 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 933 * @throws { BusinessError } 16500050 - IPC connection error. 934 * @throws { BusinessError } 16500060 - Service connection error. 935 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 936 * @throws { BusinessError } 16501000 - An internal functional error occurred. 937 * invalid input parameter during form operation 938 * @syscap SystemCapability.Ability.Form 939 * @systemapi 940 * @StageModelOnly 941 * @since 11 942 */ 943 function acquireFormData(formId: string, callback: AsyncCallback<Record<string, Object>>): void; 944 945 /** 946 * Acquire form data by formId. 947 * 948 * @permission ohos.permission.REQUIRE_FORM 949 * @param { string } formId - Indicates the form ID. 950 * @returns { Promise<{ [key: string]: Object }> } The promise returned by the function. 951 * @throws { BusinessError } 201 - Permissions denied. 952 * @throws { BusinessError } 401 - Parameter error. Possible causes: 953 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 954 * @throws { BusinessError } 16500050 - An IPC connection error happened. 955 * @throws { BusinessError } 16500060 - A service connection error happened, please try again later. 956 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 957 * @throws { BusinessError } 16501000 - An internal functional error occurred. 958 * invalid input parameter during form operation 959 * @syscap SystemCapability.Ability.Form 960 * @systemapi 961 * @StageModelOnly 962 * @since 10 963 */ 964 /** 965 * Acquire form data by formId. 966 * 967 * @permission ohos.permission.REQUIRE_FORM 968 * @param { string } formId - Indicates the form ID. 969 * @returns { Promise<Record<string, Object>> } The promise returned by the function. 970 * @throws { BusinessError } 201 - Permissions denied. 971 * @throws { BusinessError } 401 - Parameter error. Possible causes: 972 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 973 * @throws { BusinessError } 16500050 - IPC connection error. 974 * @throws { BusinessError } 16500060 - Service connection error. 975 * @throws { BusinessError } 16500100 - Failed to obtain the configuration information. 976 * @throws { BusinessError } 16501000 - An internal functional error occurred. 977 * invalid input parameter during form operation 978 * @syscap SystemCapability.Ability.Form 979 * @systemapi 980 * @StageModelOnly 981 * @since 11 982 */ 983 function acquireFormData(formId: string): Promise<Record<string, Object>>; 984 985 /** 986 * Notify the form framework to set a router proxy for the specified cards. 987 * <p>Once a card sets up a router proxy, the form framework will no longer invoke its onRouter callback, 988 * and FMS will not trigger the actual jump.</p> 989 * 990 * @permission ohos.permission.REQUIRE_FORM 991 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires setting up a router proxy. 992 * @param { Callback<Want> } proxy - Indicates the router proxy to be set up. 993 * @param { AsyncCallback<void> } callback - The callback of setRouterProxy. 994 * @throws { BusinessError } 201 - Permissions denied. 995 * @throws { BusinessError } 202 - The application is not a system application. 996 * @throws { BusinessError } 401 - Parameter error. Possible causes: 997 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 998 * @throws { BusinessError } 16500050 - IPC connection error. 999 * @throws { BusinessError } 16500060 - Service connection error. 1000 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1001 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1002 * @syscap SystemCapability.Ability.Form 1003 * @systemapi 1004 * @since 11 1005 */ 1006 function setRouterProxy(formIds: Array<string>, proxy: Callback<Want>, callback: AsyncCallback<void>): void; 1007 1008 /** 1009 * Notify the form framework to set a router proxy for the specified cards. 1010 * <p>Once a card sets up a router proxy, the form framework will no longer invoke its onRouter callback, 1011 * and FMS will not trigger the actual jump.</p> 1012 * 1013 * @permission ohos.permission.REQUIRE_FORM 1014 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires setting up a router proxy. 1015 * @param { Callback<Want> } proxy - Indicates the router proxy to be set up. 1016 * @returns { Promise<void> } The promise returned by the function. 1017 * @throws { BusinessError } 201 - Permissions denied. 1018 * @throws { BusinessError } 202 - The application is not a system application. 1019 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1020 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1021 * @throws { BusinessError } 16500050 - IPC connection error. 1022 * @throws { BusinessError } 16500060 - Service connection error. 1023 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1024 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1025 * @syscap SystemCapability.Ability.Form 1026 * @systemapi 1027 * @since 11 1028 */ 1029 function setRouterProxy(formIds: Array<string>, proxy: Callback<Want>): Promise<void>; 1030 1031 /** 1032 * Notify the form framework to clear the router proxy set for the specified cards. 1033 * 1034 * @permission ohos.permission.REQUIRE_FORM 1035 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires clearing of router proxy. 1036 * @param { AsyncCallback<void> } callback - The callback of clearRouterProxy. 1037 * @throws { BusinessError } 201 - Permissions denied. 1038 * @throws { BusinessError } 202 - The application is not a system application. 1039 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1040 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1041 * @throws { BusinessError } 16500050 - IPC connection error. 1042 * @throws { BusinessError } 16500060 - Service connection error. 1043 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1044 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1045 * @syscap SystemCapability.Ability.Form 1046 * @systemapi 1047 * @since 11 1048 */ 1049 function clearRouterProxy(formIds: Array<string>, callback: AsyncCallback<void>): void; 1050 1051 /** 1052 * Notify the form framework to clear the router proxy set for the specified cards. 1053 * 1054 * @permission ohos.permission.REQUIRE_FORM 1055 * @param { Array<string> } formIds - Indicates the IDs of the forms that requires clearing of router proxy. 1056 * @returns { Promise<void> } The promise returned by the function. 1057 * @throws { BusinessError } 201 - Permissions denied. 1058 * @throws { BusinessError } 202 - The application is not a system application. 1059 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1060 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1061 * @throws { BusinessError } 16500050 - IPC connection error. 1062 * @throws { BusinessError } 16500060 - Service connection error. 1063 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1064 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1065 * @syscap SystemCapability.Ability.Form 1066 * @systemapi 1067 * @since 11 1068 */ 1069 function clearRouterProxy(formIds: Array<string>): Promise<void>; 1070 1071 /** 1072 * Set result of publish form. 1073 * 1074 * @permission ohos.permission.REQUIRE_FORM 1075 * @param { string } formId - Indicates the form id. 1076 * @param { formInfo.PublishFormResult } result - The result of publish form. 1077 * @throws { BusinessError } 201 - Permissions denied. 1078 * @throws { BusinessError } 202 - The application is not a system application. 1079 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1080 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1081 * @throws { BusinessError } 16500050 - IPC connection error. 1082 * @throws { BusinessError } 16500060 - Service connection error. 1083 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1084 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 1085 * @syscap SystemCapability.Ability.Form 1086 * @systemapi 1087 * @stagemodelonly 1088 * @since 12 1089 */ 1090 function setPublishFormResult(formId: string, result: formInfo.PublishFormResult): void; 1091 1092 /** 1093 * Set permanent dynamic ArkTS forms recyclable, they will be recycled when memory is low. 1094 * 1095 * @permission ohos.permission.REQUIRE_FORM 1096 * @param { Array<string> } formIds - Indicates the form id list of permanent dynamic ArkTS forms. 1097 * @returns { Promise<void> } The promise returned by the function. 1098 * @throws { BusinessError } 201 - Permissions denied. 1099 * @throws { BusinessError } 202 - caller is not system app. 1100 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1101 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1102 * @throws { BusinessError } 16500050 - IPC connection error. 1103 * @throws { BusinessError } 16500060 - Service connection error. 1104 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1105 * @syscap SystemCapability.Ability.Form 1106 * @systemapi 1107 * @stagemodelonly 1108 * @since 11 1109 */ 1110 function setFormsRecyclable(formIds: Array<string>): Promise<void>; 1111 1112 /** 1113 * Set permanent dynamic ArkTS forms recyclable, they will be recycled when memory is low. 1114 * 1115 * @permission ohos.permission.REQUIRE_FORM 1116 * @param { Array<string> } formIds - Indicates the form id list of permanent dynamic ArkTS forms. 1117 * @param { AsyncCallback<void> } callback - The callback of setFormsRecyclable. 1118 * @throws { BusinessError } 201 - Permissions denied. 1119 * @throws { BusinessError } 202 - caller is not system app. 1120 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1121 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1122 * @throws { BusinessError } 16500050 - IPC connection error. 1123 * @throws { BusinessError } 16500060 - Service connection error. 1124 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1125 * @syscap SystemCapability.Ability.Form 1126 * @systemapi 1127 * @stagemodelonly 1128 * @since 11 1129 */ 1130 function setFormsRecyclable(formIds: Array<string>, callback: AsyncCallback<void>): void; 1131 1132 /** 1133 * Recycle permanent dynamic ArkTS forms. 1134 * 1135 * @permission ohos.permission.REQUIRE_FORM 1136 * @param { Array<string> } formIds - Indicates the IDs of the forms to be recycled. 1137 * @returns { Promise<void> } The promise returned by the function. 1138 * @throws { BusinessError } 201 - Permissions denied. 1139 * @throws { BusinessError } 202 - The application is not a system application. 1140 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1141 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1142 * @throws { BusinessError } 16500050 - IPC connection error. 1143 * @throws { BusinessError } 16500060 - Service connection error. 1144 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1145 * @syscap SystemCapability.Ability.Form 1146 * @systemapi 1147 * @stagemodelonly 1148 * @since 12 1149 */ 1150 function recycleForms(formIds: Array<string>): Promise<void>; 1151 1152 /** 1153 * Recover recycled permanent dynamic ArkTS forms. 1154 * 1155 * @permission ohos.permission.REQUIRE_FORM 1156 * @param { Array<string> } formIds - Indicates the form id list of recycled permanent dynamic ArkTS forms. 1157 * @returns { Promise<void> } The promise returned by the function. 1158 * @throws { BusinessError } 201 - Permissions denied. 1159 * @throws { BusinessError } 202 - caller is not system app. 1160 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1161 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1162 * @throws { BusinessError } 16500050 - IPC connection error. 1163 * @throws { BusinessError } 16500060 - Service connection error. 1164 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1165 * @syscap SystemCapability.Ability.Form 1166 * @systemapi 1167 * @stagemodelonly 1168 * @since 11 1169 */ 1170 function recoverForms(formIds: Array<string>): Promise<void>; 1171 1172 /** 1173 * Recover recycled permanent dynamic ArkTS forms. 1174 * 1175 * @permission ohos.permission.REQUIRE_FORM 1176 * @param { Array<string> } formIds - Indicates the form id list of recycled permanent dynamic ArkTS forms. 1177 * @param { AsyncCallback<void> } callback - The callback of recoverForms. 1178 * @throws { BusinessError } 201 - Permissions denied. 1179 * @throws { BusinessError } 202 - caller is not system app. 1180 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1181 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1182 * @throws { BusinessError } 16500050 - IPC connection error. 1183 * @throws { BusinessError } 16500060 - Service connection error. 1184 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1185 * @syscap SystemCapability.Ability.Form 1186 * @systemapi 1187 * @stagemodelonly 1188 * @since 11 1189 */ 1190 function recoverForms(formIds: Array<string>, callback: AsyncCallback<void>): void; 1191 1192 /** 1193 * Update location of the form. 1194 * 1195 * @permission ohos.permission.REQUIRE_FORM 1196 * @param { string } formId - Indicates the form id. 1197 * @param { formInfo.FormLocation } location - The location of the form. 1198 * @throws { BusinessError } 201 - Permissions denied. 1199 * @throws { BusinessError } 202 - caller is not system app. 1200 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1201 * 1.Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3.Parameter verification failed. 1202 * @throws { BusinessError } 16500050 - IPC connection error. 1203 * @throws { BusinessError } 16500060 - Service connection error. 1204 * @throws { BusinessError } 16501000 - An internal functional error occurred. 1205 * @throws { BusinessError } 16501001 - The ID of the form to be operated does not exist. 1206 * @throws { BusinessError } 16501003 - The form cannot be operated by the current application. 1207 * @syscap SystemCapability.Ability.Form 1208 * @systemapi 1209 * @stagemodelonly 1210 * @since 12 1211 */ 1212 function updateFormLocation(formId: string, location: formInfo.FormLocation): void; 1213} 1214export default formHost; 1215