• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 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
21/**
22  * Specific failure codes indicating failure to open atomicservice.
23  *
24  * @enum { number }
25  * @syscap SystemCapability.Ability.AbilityRuntime.Core
26  * @stagemodelonly
27  * @atomicservice
28  * @since 20
29  * @arkts 1.1&1.2
30*/
31declare enum FailureCode {
32  /**
33   * Indicates fail to open atomicservice due to the system error, such as redirect dialog crash, alloc memory failed.
34   *
35   * @syscap SystemCapability.Ability.AbilityRuntime.Core
36   * @stagemodelonly
37   * @atomicservice
38   * @since 20
39   * @arkts 1.1&1.2
40   */
41  FAILURE_CODE_SYSTEM_MALFUNCTION = 0,
42
43  /**
44   * Indicates the user cancelled the redirection.
45   *
46   * @syscap SystemCapability.Ability.AbilityRuntime.Core
47   * @stagemodelonly
48   * @atomicservice
49   * @since 20
50   * @arkts 1.1&1.2
51   */
52  FAILURE_CODE_USER_CANCEL = 1,
53
54  /**
55   * Indicates the user refused the redirection.
56   *
57   * @syscap SystemCapability.Ability.AbilityRuntime.Core
58   * @stagemodelonly
59   * @atomicservice
60   * @since 20
61   * @arkts 1.1&1.2
62   */
63  FAILURE_CODE_USER_REFUSE = 2,
64}
65
66/**
67 * CompletionHandlerForAtomicService is a handler to handle the completion events of openAtomicService.
68 *
69 * @syscap SystemCapability.Ability.AbilityRuntime.Core
70 * @stagemodelonly
71 * @atomicservice
72 * @since 20
73 */
74declare class CompletionHandlerForAtomicService {
75  /**
76   * Notify the success result of openAtomicService.
77   *
78   * @param { string } appId - Globally unique identifier of an atomicservice, which is allocated by the cloud.
79   * @syscap SystemCapability.Ability.AbilityRuntime.Core
80   * @stagemodelonly
81   * @atomicservice
82   * @since 20
83   */
84  onAtomicServiceRequestSuccess(appId: string): void;
85
86  /**
87   * Notify the failure result of openAtomicService.
88   *
89   * @param { string } appId - Globally unique identifier of an atomicservice, which is allocated by the cloud.
90   * @param { FailureCode } failureCode - Indicates the failure code for open atomic service.
91   * @param { string } failureMessage - Indicates the detail failure message for open atomic service.
92   * @syscap SystemCapability.Ability.AbilityRuntime.Core
93   * @stagemodelonly
94   * @atomicservice
95   * @since 20
96   */
97  onAtomicServiceRequestFailure(appId: string, failureCode: FailureCode, failureMessage: string): void;
98}
99
100export { FailureCode };
101export default CompletionHandlerForAtomicService;
102