1/* 2 * Copyright (c) 2021-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 NotificationKit 19 */ 20 21/** 22 * @typedef ActionResult 23 * @syscap SystemCapability.Notification.Notification 24 * @since 3 25 */ 26export interface ActionResult { 27 /** 28 * Bundle name of the application to be redirected to after the notification is clicked. 29 * 30 * @type { string } 31 * @syscap SystemCapability.Notification.Notification 32 * @since 3 33 */ 34 bundleName: string; 35 36 /** 37 * Ability name of the application to be redirected to after the notification is clicked. 38 * 39 * @type { string } 40 * @syscap SystemCapability.Notification.Notification 41 * @since 3 42 */ 43 abilityName: string; 44 45 /** 46 * URI of the page to be redirected to. The supported URI formats are as follows: 47 * 1. Absolute path of the page, which is provided by the pages list in the config.json file. Example: 48 * pages/index/index 49 * pages/detail/detail 50 * 2. Particular path. If the value is a slash (/), the home page is displayed. 51 * 52 * @type { string } 53 * @syscap SystemCapability.Notification.Notification 54 * @since 3 55 */ 56 uri: string; 57} 58 59/** 60 * @typedef ShowNotificationOptions 61 * @syscap SystemCapability.Notification.Notification 62 * @since 3 63 */ 64export interface ShowNotificationOptions { 65 /** 66 * Notification title. 67 * 68 * @type { ?string } 69 * @syscap SystemCapability.Notification.Notification 70 * @since 3 71 */ 72 contentTitle?: string; 73 74 /** 75 * Notification content. 76 * 77 * @type { ?string } 78 * @syscap SystemCapability.Notification.Notification 79 * @since 3 80 */ 81 contentText?: string; 82 83 /** 84 * Action triggered after the notification is clicked. 85 * 86 * @type { ?ActionResult } 87 * @syscap SystemCapability.Notification.Notification 88 * @since 3 89 * @deprecated since 7 90 */ 91 clickAction?: ActionResult; 92} 93 94/** 95 * @syscap SystemCapability.Notification.Notification 96 * @since 3 97 */ 98export default class Notification { 99 /** 100 * Displays the notification. 101 * 102 * @param { ShowNotificationOptions } [options] - Options. 103 * @syscap SystemCapability.Notification.Notification 104 * @since 3 105 */ 106 static show(options?: ShowNotificationOptions): void; 107} 108