1/* 2 * Copyright (c) 2022 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 16import Want from "./@ohos.app.ability.Want"; 17 18/** 19 * Interface of request dialog. 20 * @namespace dialogRequest 21 * @syscap SystemCapability.Ability.AbilityRuntime.Core 22 * @since 9 23 */ 24declare namespace dialogRequest { 25 /** 26 * Request info of a request. 27 * @typedef RequestInfo 28 * @syscap SystemCapability.Ability.AbilityRuntime.Core 29 * @since 9 30 */ 31 export interface RequestInfo { 32 } 33 34 export enum ResultCode { 35 RESULT_OK = 0, 36 RESULT_CANCEL = 1, 37 } 38 39 /** 40 * The result of requestDialogService with asynchronous callback. 41 * 42 * @since 9 43 * @syscap SystemCapability.Ability.AbilityRuntime.Core 44 * @permission N/A 45 * @StageModelOnly 46 */ 47 export interface RequestResult { 48 /** 49 * The request result passed in by the user. 50 * 51 * @since 9 52 * @syscap SystemCapability.Ability.AbilityRuntime.Core 53 * @StageModelOnly 54 */ 55 result: ResultCode; 56 } 57 58 /** 59 * Provides methods for request callback. 60 * @name AuthenticatorCallback 61 * @syscap SystemCapability.Ability.AbilityRuntime.Core 62 * @since 9 63 */ 64 export interface RequestCallback { 65 /** 66 * Send request result to caller. 67 * @param { RequestResult } result - result for request. 68 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 69 * @syscap SystemCapability.Ability.AbilityRuntime.AbilityCore 70 * @StageModelOnly 71 * @since 9 72 */ 73 setRequestResult(result: RequestResult): void; 74 } 75 76 /** 77 * Get request info from caller want. 78 * @param { Want } want - want from caller. 79 * @returns { RequestInfo } Returns the request info from caller. 80 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 81 * @syscap SystemCapability.Ability.AbilityRuntime.Core 82 * @since 9 83 */ 84 function getRequestInfo(want: Want): RequestInfo; 85 86 /** 87 * Get request callback from caller want. 88 * @param { Want } want - want from caller. 89 * @returns { RequestCallback } Returns the request callback. 90 * @throws { BusinessError } 401 - If the input parameter is not valid parameter. 91 * @syscap SystemCapability.Ability.AbilityRuntime.Core 92 * @since 9 93 */ 94 function getRequestCallback(want: Want): RequestCallback; 95} 96 97export default dialogRequest;