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 type { AutoFillType } from './AutoFillType'; 22import type CustomData from './CustomData'; 23import type AutoFillPopupConfig from './AutoFillPopupConfig'; 24import type ViewData from './ViewData'; 25 26/** 27 * Fill request for automatic filling. 28 * 29 * @interface FillRequest 30 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 31 * @systemapi 32 * @stagemodelonly 33 * @since 11 34 */ 35export interface FillRequest { 36 /** 37 * The auto fill type. 38 * 39 * @type { AutoFillType } 40 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 41 * @systemapi 42 * @stagemodelonly 43 * @since 11 44 */ 45 type: AutoFillType; 46 47 /** 48 * The view data. Indicates the basic page information for the fill request. 49 * 50 * @type { ViewData } 51 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 52 * @systemapi 53 * @stagemodelonly 54 * @since 11 55 */ 56 viewData: ViewData; 57 58 /** 59 * The custom data. 60 * 61 * @type { CustomData } 62 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 63 * @systemapi 64 * @stagemodelonly 65 * @since 13 66 */ 67 customData: CustomData; 68 69 /** 70 * Whether the UI extension window type is popup window. 71 * 72 * @type { boolean } 73 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 74 * @systemapi 75 * @stagemodelonly 76 * @since 12 77 */ 78 isPopup: boolean; 79} 80 81/** 82 * Save request for automatic filling. 83 * 84 * @interface SaveRequest 85 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 86 * @systemapi 87 * @stagemodelonly 88 * @since 11 89 */ 90export interface SaveRequest { 91 /** 92 * The view data. Indicates the basic page information for the save request. 93 * 94 * @type { ViewData } 95 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 96 * @systemapi 97 * @stagemodelonly 98 * @since 11 99 */ 100 viewData: ViewData; 101} 102 103/** 104 * Update request for automatic filling. 105 * 106 * @interface UpdateRequest 107 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 108 * @systemapi 109 * @stagemodelonly 110 * @since 12 111 */ 112export interface UpdateRequest { 113 /** 114 * The view data. Indicates the basic page information for the update request. 115 * 116 * @type { ViewData } 117 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 118 * @systemapi 119 * @stagemodelonly 120 * @since 12 121 */ 122 viewData: ViewData; 123} 124 125/** 126 * Fill response for automatic filling. 127 * 128 * @interface FillResponse 129 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 130 * @systemapi 131 * @stagemodelonly 132 * @since 11 133 */ 134export interface FillResponse { 135 /** 136 * The view data. Contains basic page information and backfill information. 137 * 138 * @type { ViewData } 139 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 140 * @systemapi 141 * @stagemodelonly 142 * @since 11 143 */ 144 viewData: ViewData; 145} 146 147/** 148 * Fill request callback for automatic filling. 149 * 150 * @interface FillRequestCallback 151 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 152 * @systemapi 153 * @stagemodelonly 154 * @since 11 155 */ 156export interface FillRequestCallback { 157 /** 158 * Notify the system that a fill request is successfully filled. 159 * 160 * @param { FillResponse } response - Indicates the fill response. 161 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 162 * @throws { BusinessError } 401 - Mandatory parameters are left unspecified. 163 * @throws { BusinessError } 16000050 - Internal error. 164 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 165 * @systemapi 166 * @stagemodelonly 167 * @since 11 168 */ 169 onSuccess(response: FillResponse): void; 170 171 /** 172 * Notification system a fill request failed to be filled. 173 * 174 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 175 * @throws { BusinessError } 16000050 - Internal error. 176 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 177 * @systemapi 178 * @stagemodelonly 179 * @since 11 180 */ 181 onFailure(): void; 182 183 /** 184 * Notification system that filling has been cancelled. 185 * 186 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 187 * @throws { BusinessError } 16000050 - Internal error. 188 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 189 * @systemapi 190 * @stagemodelonly 191 * @since 11 192 */ 193 /** 194 * Notification system that filling has been cancelled. 195 * 196 * @param { string } [fillContent] - Indicates the content to be filled in. 197 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 198 * @throws { BusinessError } 401 - Parameter error. Possible causes: <br>1.The input parameter is not valid parameter; 199 * <br>2. Mandatory parameters are left unspecified. 200 * @throws { BusinessError } 16000050 - Internal error. 201 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 202 * @systemapi 203 * @stagemodelonly 204 * @since 12 205 */ 206 onCancel(fillContent?: string): void; 207 208 /** 209 * autofill popup config. 210 * 211 * @param { AutoFillPopupConfig } autoFillPopupConfig - Indicates the autofill popup config. 212 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 213 * @throws { BusinessError } 401 - Mandatory parameters are left unspecified. 214 * @throws { BusinessError } 16000050 - Internal error. 215 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 216 * @systemapi 217 * @stagemodelonly 218 * @since 12 219 */ 220 setAutoFillPopupConfig(autoFillPopupConfig: AutoFillPopupConfig): void; 221} 222 223/** 224 * Save request callback for automatic filling. 225 * 226 * @interface SaveRequestCallback 227 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 228 * @systemapi 229 * @stagemodelonly 230 * @since 11 231 */ 232export interface SaveRequestCallback { 233 /** 234 * Notify the system that a save request is successfully handled. 235 * 236 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 237 * @throws { BusinessError } 16000050 - Internal error. 238 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 239 * @systemapi 240 * @stagemodelonly 241 * @since 11 242 */ 243 onSuccess(): void; 244 245 /** 246 * Notify the system that a save request is failed to be handled. 247 * 248 * @throws { BusinessError } 202 - Permission denied, non-system app called system api. 249 * @throws { BusinessError } 16000050 - Internal error. 250 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 251 * @systemapi 252 * @stagemodelonly 253 * @since 11 254 */ 255 onFailure(): void; 256}