161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"), 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit NotificationKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport { AsyncCallback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport { BundleOption as _BundleOption } from './notification/NotificationCommonDef'; 2361847f8eSopenharmony_ciimport { NotificationSubscribeInfo as _NotificationSubscribeInfo } from './notification/notificationSubscribeInfo'; 2461847f8eSopenharmony_ciimport { NotificationSubscriber as _NotificationSubscriber } from './notification/notificationSubscriber'; 2561847f8eSopenharmony_ciimport { SubscribeCallbackData as _SubscribeCallbackData } from './notification/notificationSubscriber'; 2661847f8eSopenharmony_ciimport { EnabledNotificationCallbackData as _EnabledNotificationCallbackData } from './notification/notificationSubscriber'; 2761847f8eSopenharmony_ciimport type { BadgeNumberCallbackData as _BadgeNumberCallbackData } from './notification/notificationSubscriber'; 2861847f8eSopenharmony_ci 2961847f8eSopenharmony_ci/** 3061847f8eSopenharmony_ci * @namespace notificationSubscribe 3161847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 3261847f8eSopenharmony_ci * @systemapi 3361847f8eSopenharmony_ci * @since 9 3461847f8eSopenharmony_ci */ 3561847f8eSopenharmony_cideclare namespace notificationSubscribe { 3661847f8eSopenharmony_ci /** 3761847f8eSopenharmony_ci * Describes a NotificationKey, which can be used to identify a notification. 3861847f8eSopenharmony_ci * 3961847f8eSopenharmony_ci * @typedef NotificationKey 4061847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 4161847f8eSopenharmony_ci * @systemapi 4261847f8eSopenharmony_ci * @since 9 4361847f8eSopenharmony_ci */ 4461847f8eSopenharmony_ci export interface NotificationKey { 4561847f8eSopenharmony_ci /** 4661847f8eSopenharmony_ci * Notify ID. 4761847f8eSopenharmony_ci * 4861847f8eSopenharmony_ci * @type { number } 4961847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 5061847f8eSopenharmony_ci * @systemapi 5161847f8eSopenharmony_ci * @since 9 5261847f8eSopenharmony_ci */ 5361847f8eSopenharmony_ci id: number; 5461847f8eSopenharmony_ci 5561847f8eSopenharmony_ci /** 5661847f8eSopenharmony_ci * Notification label. 5761847f8eSopenharmony_ci * 5861847f8eSopenharmony_ci * @type { ?string } 5961847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 6061847f8eSopenharmony_ci * @systemapi 6161847f8eSopenharmony_ci * @since 9 6261847f8eSopenharmony_ci */ 6361847f8eSopenharmony_ci label?: string; 6461847f8eSopenharmony_ci } 6561847f8eSopenharmony_ci 6661847f8eSopenharmony_ci /** 6761847f8eSopenharmony_ci * Reason for remove a notification 6861847f8eSopenharmony_ci * 6961847f8eSopenharmony_ci * @enum { number } 7061847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 7161847f8eSopenharmony_ci * @systemapi 7261847f8eSopenharmony_ci * @since 9 7361847f8eSopenharmony_ci */ 7461847f8eSopenharmony_ci export enum RemoveReason { 7561847f8eSopenharmony_ci /** 7661847f8eSopenharmony_ci * Notification clicked notification on the status bar 7761847f8eSopenharmony_ci * 7861847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 7961847f8eSopenharmony_ci * @systemapi 8061847f8eSopenharmony_ci * @since 9 8161847f8eSopenharmony_ci */ 8261847f8eSopenharmony_ci CLICK_REASON_REMOVE = 1, 8361847f8eSopenharmony_ci 8461847f8eSopenharmony_ci /** 8561847f8eSopenharmony_ci * User dismissal notification on the status bar 8661847f8eSopenharmony_ci * 8761847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 8861847f8eSopenharmony_ci * @systemapi 8961847f8eSopenharmony_ci * @since 9 9061847f8eSopenharmony_ci */ 9161847f8eSopenharmony_ci CANCEL_REASON_REMOVE = 2 9261847f8eSopenharmony_ci } 9361847f8eSopenharmony_ci 9461847f8eSopenharmony_ci /** 9561847f8eSopenharmony_ci * Subscribe to notifications. 9661847f8eSopenharmony_ci * 9761847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 9861847f8eSopenharmony_ci * @param { NotificationSubscriber } subscriber - The notification subscriber. 9961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of subscribe. 10061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 10161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 10261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 10361847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 10461847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 10561847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 10661847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 10761847f8eSopenharmony_ci * @throws { BusinessError } 1600012 - No memory space. 10861847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 10961847f8eSopenharmony_ci * @systemapi 11061847f8eSopenharmony_ci * @since 9 11161847f8eSopenharmony_ci */ 11261847f8eSopenharmony_ci function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void; 11361847f8eSopenharmony_ci 11461847f8eSopenharmony_ci /** 11561847f8eSopenharmony_ci * Subscribe self notifications. 11661847f8eSopenharmony_ci * 11761847f8eSopenharmony_ci * @param { NotificationSubscriber } subscriber - The notification subscriber. 11861847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 11961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 12061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 12161847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 12261847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 12361847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 12461847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 12561847f8eSopenharmony_ci * @throws { BusinessError } 1600012 - No memory space. 12661847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 12761847f8eSopenharmony_ci * @systemapi 12861847f8eSopenharmony_ci * @since 11 12961847f8eSopenharmony_ci */ 13061847f8eSopenharmony_ci function subscribeSelf(subscriber: NotificationSubscriber): Promise<void>; 13161847f8eSopenharmony_ci 13261847f8eSopenharmony_ci /** 13361847f8eSopenharmony_ci * Subscribe to notifications. 13461847f8eSopenharmony_ci * 13561847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 13661847f8eSopenharmony_ci * @param { NotificationSubscriber } subscriber - The notification subscriber. 13761847f8eSopenharmony_ci * @param { NotificationSubscribeInfo } info - The notification subscribe info. 13861847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of subscribe. 13961847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 14061847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 14161847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 14261847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 14361847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 14461847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 14561847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 14661847f8eSopenharmony_ci * @throws { BusinessError } 1600012 - No memory space. 14761847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 14861847f8eSopenharmony_ci * @systemapi 14961847f8eSopenharmony_ci * @since 9 15061847f8eSopenharmony_ci */ 15161847f8eSopenharmony_ci function subscribe( 15261847f8eSopenharmony_ci subscriber: NotificationSubscriber, 15361847f8eSopenharmony_ci info: NotificationSubscribeInfo, 15461847f8eSopenharmony_ci callback: AsyncCallback<void> 15561847f8eSopenharmony_ci ): void; 15661847f8eSopenharmony_ci 15761847f8eSopenharmony_ci /** 15861847f8eSopenharmony_ci * Subscribe to notifications 15961847f8eSopenharmony_ci * 16061847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 16161847f8eSopenharmony_ci * @param { NotificationSubscriber } subscriber - The notification subscriber. 16261847f8eSopenharmony_ci * @param { NotificationSubscribeInfo } [info] - The notification subscribe info. 16361847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 16461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 16561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 16661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 16761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 16861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 16961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 17061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 17161847f8eSopenharmony_ci * @throws { BusinessError } 1600012 - No memory space. 17261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 17361847f8eSopenharmony_ci * @systemapi 17461847f8eSopenharmony_ci * @since 9 17561847f8eSopenharmony_ci */ 17661847f8eSopenharmony_ci function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise<void>; 17761847f8eSopenharmony_ci 17861847f8eSopenharmony_ci /** 17961847f8eSopenharmony_ci * Unsubscribe notifications. 18061847f8eSopenharmony_ci * 18161847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 18261847f8eSopenharmony_ci * @param { NotificationSubscriber } subscriber - The notification subscriber. 18361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of unsubscribe. 18461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 18561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 18661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 18761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 18861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 18961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 19061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 19161847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 19261847f8eSopenharmony_ci * @systemapi 19361847f8eSopenharmony_ci * @since 9 19461847f8eSopenharmony_ci */ 19561847f8eSopenharmony_ci function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void; 19661847f8eSopenharmony_ci 19761847f8eSopenharmony_ci /** 19861847f8eSopenharmony_ci * Unsubscribe notifications. 19961847f8eSopenharmony_ci * 20061847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 20161847f8eSopenharmony_ci * @param { NotificationSubscriber } subscriber - The notification subscriber. 20261847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 20361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 20461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 20561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 20661847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 20761847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 20861847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 20961847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 21061847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 21161847f8eSopenharmony_ci * @systemapi 21261847f8eSopenharmony_ci * @since 9 21361847f8eSopenharmony_ci */ 21461847f8eSopenharmony_ci function unsubscribe(subscriber: NotificationSubscriber): Promise<void>; 21561847f8eSopenharmony_ci 21661847f8eSopenharmony_ci /** 21761847f8eSopenharmony_ci * Remove notification based on BundleOption and NotificationKey. 21861847f8eSopenharmony_ci * 21961847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 22061847f8eSopenharmony_ci * @param { BundleOption } bundle - The bundle option. 22161847f8eSopenharmony_ci * @param { NotificationKey } notificationKey - The notification key. 22261847f8eSopenharmony_ci * @param { RemoveReason } reason - The remove reason. 22361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of remove. 22461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 22561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 22661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 22761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 22861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 22961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 23061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 23161847f8eSopenharmony_ci * @throws { BusinessError } 1600007 - The notification does not exist. 23261847f8eSopenharmony_ci * @throws { BusinessError } 17700001 - The specified bundle name was not found. 23361847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 23461847f8eSopenharmony_ci * @systemapi 23561847f8eSopenharmony_ci * @since 9 23661847f8eSopenharmony_ci */ 23761847f8eSopenharmony_ci function remove( 23861847f8eSopenharmony_ci bundle: BundleOption, 23961847f8eSopenharmony_ci notificationKey: NotificationKey, 24061847f8eSopenharmony_ci reason: RemoveReason, 24161847f8eSopenharmony_ci callback: AsyncCallback<void> 24261847f8eSopenharmony_ci ): void; 24361847f8eSopenharmony_ci 24461847f8eSopenharmony_ci /** 24561847f8eSopenharmony_ci * Remove notification based on BundleOption and NotificationKey. 24661847f8eSopenharmony_ci * 24761847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 24861847f8eSopenharmony_ci * @param { BundleOption } bundle - The bundle option. 24961847f8eSopenharmony_ci * @param { NotificationKey } notificationKey - The notification key. 25061847f8eSopenharmony_ci * @param { RemoveReason } reason - The remove reason. 25161847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 25261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 25361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 25461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 25561847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 25661847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 25761847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 25861847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 25961847f8eSopenharmony_ci * @throws { BusinessError } 1600007 - The notification does not exist. 26061847f8eSopenharmony_ci * @throws { BusinessError } 17700001 - The specified bundle name was not found. 26161847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 26261847f8eSopenharmony_ci * @systemapi 26361847f8eSopenharmony_ci * @since 9 26461847f8eSopenharmony_ci */ 26561847f8eSopenharmony_ci function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise<void>; 26661847f8eSopenharmony_ci 26761847f8eSopenharmony_ci /** 26861847f8eSopenharmony_ci * Remove notification based on hashCode. 26961847f8eSopenharmony_ci * 27061847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 27161847f8eSopenharmony_ci * @param { string } hashCode - The hashCode. 27261847f8eSopenharmony_ci * @param { RemoveReason } reason - The remove reason. 27361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of remove. 27461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 27561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 27661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 27761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 27861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 27961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 28061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 28161847f8eSopenharmony_ci * @throws { BusinessError } 1600007 - The notification does not exist. 28261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 28361847f8eSopenharmony_ci * @systemapi 28461847f8eSopenharmony_ci * @since 9 28561847f8eSopenharmony_ci */ 28661847f8eSopenharmony_ci function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback<void>): void; 28761847f8eSopenharmony_ci 28861847f8eSopenharmony_ci 28961847f8eSopenharmony_ci /** 29061847f8eSopenharmony_ci * Remove notifications based on hashCodes. 29161847f8eSopenharmony_ci * 29261847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 29361847f8eSopenharmony_ci * @param { Array<String> } hashCodes - The hashCode array. 29461847f8eSopenharmony_ci * @param { RemoveReason } reason - The remove reason. 29561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of remove. 29661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 29761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 29861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 29961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 30061847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 30161847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 30261847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 30361847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 30461847f8eSopenharmony_ci * @systemapi 30561847f8eSopenharmony_ci * @since 10 30661847f8eSopenharmony_ci */ 30761847f8eSopenharmony_ci function remove(hashCodes: Array<String>, reason: RemoveReason, callback: AsyncCallback<void>): void; 30861847f8eSopenharmony_ci 30961847f8eSopenharmony_ci /** 31061847f8eSopenharmony_ci * Remove notification based on hashCode. 31161847f8eSopenharmony_ci * 31261847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 31361847f8eSopenharmony_ci * @param { string } hashCode - The hashCode. 31461847f8eSopenharmony_ci * @param { RemoveReason } reason - The remove reason. 31561847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 31661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 31761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 31861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 31961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 32061847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 32161847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 32261847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 32361847f8eSopenharmony_ci * @throws { BusinessError } 1600007 - The notification does not exist. 32461847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 32561847f8eSopenharmony_ci * @systemapi 32661847f8eSopenharmony_ci * @since 9 32761847f8eSopenharmony_ci */ 32861847f8eSopenharmony_ci function remove(hashCode: string, reason: RemoveReason): Promise<void>; 32961847f8eSopenharmony_ci 33061847f8eSopenharmony_ci /** 33161847f8eSopenharmony_ci * Remove notifications based on hashCodes. 33261847f8eSopenharmony_ci * 33361847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 33461847f8eSopenharmony_ci * @param { Array<String> } hashCodes - The hashCode array. 33561847f8eSopenharmony_ci * @param { RemoveReason } reason - The remove reason. 33661847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 33761847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 33861847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 33961847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 34061847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 34161847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 34261847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 34361847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 34461847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 34561847f8eSopenharmony_ci * @systemapi 34661847f8eSopenharmony_ci * @since 10 34761847f8eSopenharmony_ci */ 34861847f8eSopenharmony_ci function remove(hashCodes: Array<String>, reason: RemoveReason): Promise<void>; 34961847f8eSopenharmony_ci 35061847f8eSopenharmony_ci /** 35161847f8eSopenharmony_ci * RemoveAll all notifications based on BundleOption. 35261847f8eSopenharmony_ci * 35361847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 35461847f8eSopenharmony_ci * @param { BundleOption } bundle - The bundle option. 35561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of removeAll. 35661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 35761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 35861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 35961847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 36061847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 36161847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 36261847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 36361847f8eSopenharmony_ci * @throws { BusinessError } 17700001 - The specified bundle name was not found. 36461847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 36561847f8eSopenharmony_ci * @systemapi 36661847f8eSopenharmony_ci * @since 9 36761847f8eSopenharmony_ci */ 36861847f8eSopenharmony_ci function removeAll(bundle: BundleOption, callback: AsyncCallback<void>): void; 36961847f8eSopenharmony_ci 37061847f8eSopenharmony_ci /** 37161847f8eSopenharmony_ci * RemoveAll all notifications. 37261847f8eSopenharmony_ci * 37361847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 37461847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of removeAll. 37561847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 37661847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 37761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 37861847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 37961847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 38061847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 38161847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 38261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 38361847f8eSopenharmony_ci * @systemapi 38461847f8eSopenharmony_ci * @since 9 38561847f8eSopenharmony_ci */ 38661847f8eSopenharmony_ci function removeAll(callback: AsyncCallback<void>): void; 38761847f8eSopenharmony_ci 38861847f8eSopenharmony_ci /** 38961847f8eSopenharmony_ci * Remove all notifications under the specified user. 39061847f8eSopenharmony_ci * 39161847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 39261847f8eSopenharmony_ci * @param { number } userId - The userId. 39361847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - The callback of removeAll. 39461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 39561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 39661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 39761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 39861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 39961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 40061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 40161847f8eSopenharmony_ci * @throws { BusinessError } 1600008 - The user does not exist. 40261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 40361847f8eSopenharmony_ci * @systemapi 40461847f8eSopenharmony_ci * @since 9 40561847f8eSopenharmony_ci */ 40661847f8eSopenharmony_ci function removeAll(userId: number, callback: AsyncCallback<void>): void; 40761847f8eSopenharmony_ci 40861847f8eSopenharmony_ci /** 40961847f8eSopenharmony_ci * Remove all notifications under the specified user. 41061847f8eSopenharmony_ci * 41161847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 41261847f8eSopenharmony_ci * @param { number } userId - The userId. 41361847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 41461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 41561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 41661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 41761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 41861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 41961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 42061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 42161847f8eSopenharmony_ci * @throws { BusinessError } 1600008 - The user does not exist. 42261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 42361847f8eSopenharmony_ci * @systemapi 42461847f8eSopenharmony_ci * @since 9 42561847f8eSopenharmony_ci */ 42661847f8eSopenharmony_ci function removeAll(userId: number): Promise<void>; 42761847f8eSopenharmony_ci 42861847f8eSopenharmony_ci /** 42961847f8eSopenharmony_ci * RemoveAll all notifications. 43061847f8eSopenharmony_ci * 43161847f8eSopenharmony_ci * @permission ohos.permission.NOTIFICATION_CONTROLLER 43261847f8eSopenharmony_ci * @param { BundleOption } [bundle] - The bundle option. 43361847f8eSopenharmony_ci * @returns { Promise<void> } The promise returned by the function. 43461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission denied. 43561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Not system application to call the interface. 43661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 43761847f8eSopenharmony_ci * <br>2. Incorrect parameter types. 3. Parameter verification failed. 43861847f8eSopenharmony_ci * @throws { BusinessError } 1600001 - Internal error. 43961847f8eSopenharmony_ci * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 44061847f8eSopenharmony_ci * @throws { BusinessError } 1600003 - Failed to connect to the service. 44161847f8eSopenharmony_ci * @throws { BusinessError } 17700001 - The specified bundle name was not found. 44261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 44361847f8eSopenharmony_ci * @systemapi 44461847f8eSopenharmony_ci * @since 9 44561847f8eSopenharmony_ci */ 44661847f8eSopenharmony_ci function removeAll(bundle?: BundleOption): Promise<void>; 44761847f8eSopenharmony_ci 44861847f8eSopenharmony_ci /** 44961847f8eSopenharmony_ci * Describes a bundleOption in a notification. 45061847f8eSopenharmony_ci * 45161847f8eSopenharmony_ci * @typedef { _BundleOption } BundleOption 45261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 45361847f8eSopenharmony_ci * @systemapi 45461847f8eSopenharmony_ci * @since 9 45561847f8eSopenharmony_ci */ 45661847f8eSopenharmony_ci export type BundleOption = _BundleOption; 45761847f8eSopenharmony_ci 45861847f8eSopenharmony_ci /** 45961847f8eSopenharmony_ci * Sets filter criteria of publishers for subscribing to desired notifications. 46061847f8eSopenharmony_ci * 46161847f8eSopenharmony_ci * @typedef { _NotificationSubscribeInfo } NotificationSubscribeInfo 46261847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 46361847f8eSopenharmony_ci * @systemapi 46461847f8eSopenharmony_ci * @since 9 46561847f8eSopenharmony_ci */ 46661847f8eSopenharmony_ci export type NotificationSubscribeInfo = _NotificationSubscribeInfo; 46761847f8eSopenharmony_ci 46861847f8eSopenharmony_ci /** 46961847f8eSopenharmony_ci * Provides methods that will be called back when the subscriber receives a new notification or 47061847f8eSopenharmony_ci * a notification is canceled. 47161847f8eSopenharmony_ci * 47261847f8eSopenharmony_ci * @typedef { _NotificationSubscriber } NotificationSubscriber 47361847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 47461847f8eSopenharmony_ci * @systemapi 47561847f8eSopenharmony_ci * @since 9 47661847f8eSopenharmony_ci */ 47761847f8eSopenharmony_ci export type NotificationSubscriber = _NotificationSubscriber; 47861847f8eSopenharmony_ci 47961847f8eSopenharmony_ci /** 48061847f8eSopenharmony_ci * Provides methods that will be called back when the subscriber receives a new notification or 48161847f8eSopenharmony_ci * a notification is canceled. 48261847f8eSopenharmony_ci * 48361847f8eSopenharmony_ci * @typedef { _SubscribeCallbackData } SubscribeCallbackData 48461847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 48561847f8eSopenharmony_ci * @systemapi 48661847f8eSopenharmony_ci * @since 9 48761847f8eSopenharmony_ci */ 48861847f8eSopenharmony_ci export type SubscribeCallbackData = _SubscribeCallbackData; 48961847f8eSopenharmony_ci 49061847f8eSopenharmony_ci /** 49161847f8eSopenharmony_ci * Describes the properties of the application that the permission to send notifications has changed. 49261847f8eSopenharmony_ci * 49361847f8eSopenharmony_ci * @typedef { _EnabledNotificationCallbackData } EnabledNotificationCallbackData 49461847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 49561847f8eSopenharmony_ci * @systemapi 49661847f8eSopenharmony_ci * @since 9 49761847f8eSopenharmony_ci */ 49861847f8eSopenharmony_ci export type EnabledNotificationCallbackData = _EnabledNotificationCallbackData; 49961847f8eSopenharmony_ci 50061847f8eSopenharmony_ci /** 50161847f8eSopenharmony_ci * Describes the badge number of the application has changed. 50261847f8eSopenharmony_ci * 50361847f8eSopenharmony_ci * @typedef { _BadgeNumberCallbackData } BadgeNumberCallbackData 50461847f8eSopenharmony_ci * @syscap SystemCapability.Notification.Notification 50561847f8eSopenharmony_ci * @systemapi 50661847f8eSopenharmony_ci * @since 11 50761847f8eSopenharmony_ci */ 50861847f8eSopenharmony_ci export type BadgeNumberCallbackData = _BadgeNumberCallbackData; 50961847f8eSopenharmony_ci} 51061847f8eSopenharmony_ci 51161847f8eSopenharmony_ciexport default notificationSubscribe; 512