• 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 AbilityKit
19 */
20
21import type window from './@ohos.window';
22import type insightIntent from './@ohos.app.ability.insightIntent';
23import type InsightIntentContext from './@ohos.app.ability.InsightIntentContext';
24import type UIExtensionContentSession from './@ohos.app.ability.UIExtensionContentSession';
25
26/**
27 * The class of insight intent executor.
28 *
29 * @syscap SystemCapability.Ability.AbilityRuntime.Core
30 * @StageModelOnly
31 * @atomicservice
32 * @since arkts {'1.1':'11', '1.2':'20'}
33 * @arkts 1.1&1.2
34 */
35declare class InsightIntentExecutor {
36  /**
37   * Indicates context of insight intent.
38   *
39   * @type { InsightIntentContext }
40   * @syscap SystemCapability.Ability.AbilityRuntime.Core
41   * @StageModelOnly
42   * @atomicservice
43   * @since arkts {'1.1':'11', '1.2':'20'}
44   * @arkts 1.1&1.2
45   */
46  context: InsightIntentContext;
47
48  /**
49   * Called when a UIAbility executes the insight intent in the foreground.
50   *
51   * @param { string } name - Indicates the insight intent name.
52   * @param { Record<string, Object> } param - Indicates the insight intent parameters.
53   * @param { window.WindowStage } pageLoader - Indicates the page loader.
54   * @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
55   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
56   * @StageModelOnly
57   * @atomicservice
58   * @since arkts {'1.1':'11', '1.2':'20'}
59   * @arkts 1.1&1.2
60   */
61  onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage):
62    insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
63
64  /**
65   * Called when a UIAbility executes the insight intent in the background.
66   *
67   * @param { string } name - Indicates the insight intent name.
68   * @param { Record<string, Object> } param - Indicates the insight intent parameters.
69   * @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
70   * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore
71   * @StageModelOnly
72   * @atomicservice
73   * @since arkts {'1.1':'11', '1.2':'20'}
74   * @arkts 1.1&1.2
75   */
76  onExecuteInUIAbilityBackgroundMode(name: string, param: Record<string, Object>):
77    insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
78
79  /**
80   * Called when a UIExtensionAbility executes the insight intent.
81   *
82   * @param { string } name - Indicates the insight intent name.
83   * @param { Record<string, Object> } param - Indicates the insight intent parameters.
84   * @param { UIExtensionContentSession } pageLoader - Indicates the page loader.
85   * @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
86   * @syscap SystemCapability.Ability.AbilityRuntime.Core
87   * @StageModelOnly
88   * @since arkts {'1.1':'11', '1.2':'20'}
89   * @arkts 1.1&1.2
90   */
91  onExecuteInUIExtensionAbility(name: string, param: Record<string, Object>, pageLoader: UIExtensionContentSession):
92    insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
93
94  /**
95   * Called when a ServiceExtensionAbility executes the insight intent.
96   *
97   * @param { string } name - Indicates the insight intent name.
98   * @param { Record<string, Object> } param - Indicates the insight intent parameters.
99   * @returns { insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult> } The result of insight intent execution, support promise.
100   * @syscap SystemCapability.Ability.AbilityRuntime.Core
101   * @StageModelOnly
102   * @since arkts {'1.1':'11', '1.2':'20'}
103   * @arkts 1.1&1.2
104   */
105  onExecuteInServiceExtensionAbility(name: string, param: Record<string, Object>):
106    insightIntent.ExecuteResult | Promise<insightIntent.ExecuteResult>;
107}
108
109export default InsightIntentExecutor;