1/* 2 * Copyright (c) 2023-2024 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 Want from './@ohos.app.ability.Want'; 22import type wantConstant from './@ohos.app.ability.wantConstant'; 23 24/** 25 * interface of insightIntent. 26 * 27 * @namespace insightIntent 28 * @syscap SystemCapability.Ability.AbilityRuntime.Core 29 * @StageModelOnly 30 * @atomicservice 31 * @since arkts {'1.1':'11', '1.2':'20'} 32 * @arkts 1.1&1.2 33 */ 34declare namespace insightIntent { 35 /** 36 * Enum for supported execute mode. 37 * 38 * @enum { number } 39 * @syscap SystemCapability.Ability.AbilityRuntime.Core 40 * @StageModelOnly 41 * @atomicservice 42 * @since arkts {'1.1':'11', '1.2':'20'} 43 * @arkts 1.1&1.2 44 */ 45 enum ExecuteMode { 46 /** 47 * UIAbility foreground. 48 * 49 * @syscap SystemCapability.Ability.AbilityRuntime.Core 50 * @StageModelOnly 51 * @atomicservice 52 * @since arkts {'1.1':'11', '1.2':'20'} 53 * @arkts 1.1&1.2 54 */ 55 UI_ABILITY_FOREGROUND = 0, 56 57 /** 58 * UIAbility background. 59 * 60 * @syscap SystemCapability.Ability.AbilityRuntime.Core 61 * @StageModelOnly 62 * @atomicservice 63 * @since arkts {'1.1':'11', '1.2':'20'} 64 * @arkts 1.1&1.2 65 */ 66 UI_ABILITY_BACKGROUND = 1, 67 68 /** 69 * UIExtensionAbility. 70 * 71 * @syscap SystemCapability.Ability.AbilityRuntime.Core 72 * @StageModelOnly 73 * @since arkts {'1.1':'11', '1.2':'20'} 74 * @arkts 1.1&1.2 75 */ 76 UI_EXTENSION_ABILITY = 2, 77 78 /** 79 * ServiceExtensionAbility. 80 * 81 * @syscap SystemCapability.Ability.AbilityRuntime.Core 82 * @systemapi 83 * @StageModelOnly 84 * @since arkts {'1.1':'11', '1.2':'20'} 85 * @arkts 1.1&1.2 86 */ 87 SERVICE_EXTENSION_ABILITY = 3, 88 } 89 90 /** 91 * Result of intent execution. 92 * 93 * @typedef ExecuteResult 94 * @syscap SystemCapability.Ability.AbilityRuntime.Core 95 * @StageModelOnly 96 * @atomicservice 97 * @since arkts {'1.1':'11', '1.2':'20'} 98 * @arkts 1.1&1.2 99 */ 100 interface ExecuteResult { 101 /** 102 * Indicates result code. 103 * 104 * @type { number } 105 * @syscap SystemCapability.Ability.AbilityRuntime.Core 106 * @StageModelOnly 107 * @atomicservice 108 * @since arkts {'1.1':'11', '1.2':'20'} 109 * @arkts 1.1&1.2 110 */ 111 code: number; 112 113 /** 114 * Indicates execute result. 115 * 116 * @type { ?Record<string, Object> } 117 * @syscap SystemCapability.Ability.AbilityRuntime.Core 118 * @StageModelOnly 119 * @atomicservice 120 * @since arkts {'1.1':'11', '1.2':'20'} 121 * @arkts 1.1&1.2 122 */ 123 result?: Record<string, Object>; 124 125 /** 126 * Indicates the URIs will be authorized to the insight intent driver. 127 * 128 * @type { ?Array<string> } 129 * @syscap SystemCapability.Ability.AbilityRuntime.Core 130 * @stagemodelonly 131 * @atomicservice 132 * @since arkts {'1.1':'18', '1.2':'20'} 133 * @arkts 1.1&1.2 134 */ 135 uris?: Array<string>; 136 137 /** 138 * Indicates the URIs read and write permissions which consistent with {@link Want#flags}, 139 * flags must be one of {@link wantConstant#Flags#FLAG_AUTH_READ_URI_PERMISSION}, 140 * {@link wantConstant#Flags#FLAG_AUTH_WRITE_URI_PERMISSION}, 141 * {@link wantConstant#Flags#FLAG_AUTH_READ_URI_PERMISSION}| 142 * {@link wantConstant#Flags#FLAG_AUTH_WRITE_URI_PERMISSION}. 143 * 144 * @type { ?number } 145 * @syscap SystemCapability.Ability.AbilityRuntime.Core 146 * @stagemodelonly 147 * @atomicservice 148 * @since arkts {'1.1':'18', '1.2':'20'} 149 * @arkts 1.1&1.2 150 */ 151 flags?: number; 152 } 153 154 /** 155 * Define IntentEntity. 156 * 157 * @interface IntentEntity 158 * @syscap SystemCapability.Ability.AbilityRuntime.Core 159 * @stagemodelonly 160 * @atomicservice 161 * @since 20 162 */ 163 interface IntentEntity { 164 /** 165 * The entity Id. 166 * 167 * @type { string } 168 * @syscap SystemCapability.Ability.AbilityRuntime.Core 169 * @stagemodelonly 170 * @atomicservice 171 * @since 20 172 */ 173 entityId: string; 174 } 175 176 /** 177 * The class of insight intent result. 178 * 179 * @interface IntentResult<T> 180 * @syscap SystemCapability.Ability.AbilityRuntime.Core 181 * @stagemodelonly 182 * @atomicservice 183 * @since 20 184 */ 185 interface IntentResult<T> { 186 /** 187 * The result code. 188 * 189 * @type { number } 190 * @syscap SystemCapability.Ability.AbilityRuntime.Core 191 * @stagemodelonly 192 * @atomicservice 193 * @since 20 194 */ 195 code: number; 196 197 /** 198 * The insight intent result. 199 * 200 * @type { ?T } 201 * @syscap SystemCapability.Ability.AbilityRuntime.Core 202 * @stagemodelonly 203 * @atomicservice 204 * @since 20 205 */ 206 result?: T; 207 } 208} 209 210export default insightIntent; 211