1/* 2 * Copyright (c) 2022-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 21import { AsyncCallback } from './@ohos.base'; 22import { BundleOption as _BundleOption } from './notification/NotificationCommonDef'; 23import { NotificationSubscribeInfo as _NotificationSubscribeInfo } from './notification/notificationSubscribeInfo'; 24import { NotificationSubscriber as _NotificationSubscriber } from './notification/notificationSubscriber'; 25import { SubscribeCallbackData as _SubscribeCallbackData } from './notification/notificationSubscriber'; 26import { EnabledNotificationCallbackData as _EnabledNotificationCallbackData } from './notification/notificationSubscriber'; 27/*** if arkts 1.1 */ 28import type { BadgeNumberCallbackData as _BadgeNumberCallbackData } from './notification/notificationSubscriber'; 29/*** endif */ 30/*** if arkts 1.2 */ 31import type { BadgeNumberCallbackData as _BadgeNumberCallbackData } from './notification/notificationSubscriber'; 32/*** endif */ 33 34/** 35 * @namespace notificationSubscribe 36 * @syscap SystemCapability.Notification.Notification 37 * @systemapi 38 * @since arkts {'1.1':'9', '1.2':'20'} 39 * @arkts 1.1&1.2 40 */ 41declare namespace notificationSubscribe { 42 /** 43 * Describes a NotificationKey, which can be used to identify a notification. 44 * 45 * @typedef NotificationKey 46 * @syscap SystemCapability.Notification.Notification 47 * @systemapi 48 * @since arkts {'1.1':'9', '1.2':'20'} 49 * @arkts 1.1&1.2 50 */ 51 export interface NotificationKey { 52 /** 53 * Notify ID. 54 * 55 * @type { number } 56 * @syscap SystemCapability.Notification.Notification 57 * @systemapi 58 * @since arkts {'1.1':'9', '1.2':'20'} 59 * @arkts 1.1&1.2 60 */ 61 id: number; 62 63 /** 64 * Notification label. 65 * 66 * @type { ?string } 67 * @syscap SystemCapability.Notification.Notification 68 * @systemapi 69 * @since arkts {'1.1':'9', '1.2':'20'} 70 * @arkts 1.1&1.2 71 */ 72 label?: string; 73 } 74 75 /** 76 * Reason for remove a notification 77 * 78 * @enum { number } 79 * @syscap SystemCapability.Notification.Notification 80 * @systemapi 81 * @since arkts {'1.1':'9', '1.2':'20'} 82 * @arkts 1.1&1.2 83 */ 84 export enum RemoveReason { 85 /** 86 * Notification clicked notification on the status bar 87 * 88 * @syscap SystemCapability.Notification.Notification 89 * @systemapi 90 * @since arkts {'1.1':'9', '1.2':'20'} 91 * @arkts 1.1&1.2 92 */ 93 CLICK_REASON_REMOVE = 1, 94 95 /** 96 * User dismissal notification on the status bar 97 * 98 * @syscap SystemCapability.Notification.Notification 99 * @systemapi 100 * @since arkts {'1.1':'9', '1.2':'20'} 101 * @arkts 1.1&1.2 102 */ 103 CANCEL_REASON_REMOVE = 2 104 } 105 106 /** 107 * Subscribe to notifications. 108 * 109 * @permission ohos.permission.NOTIFICATION_CONTROLLER 110 * @param { NotificationSubscriber } subscriber - The notification subscriber. 111 * @param { AsyncCallback<void> } callback - The callback of subscribe. 112 * @throws { BusinessError } 201 - Permission denied. 113 * @throws { BusinessError } 202 - Not system application to call the interface. 114 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 115 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 116 * @throws { BusinessError } 1600001 - Internal error. 117 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 118 * @throws { BusinessError } 1600003 - Failed to connect to the service. 119 * @throws { BusinessError } 1600012 - No memory space. 120 * @syscap SystemCapability.Notification.Notification 121 * @systemapi 122 * @since arkts {'1.1':'9', '1.2':'20'} 123 * @arkts 1.1&1.2 124 */ 125 function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void; 126 127 /** 128 * Subscribe self notifications. 129 * 130 * @param { NotificationSubscriber } subscriber - The notification subscriber. 131 * @returns { Promise<void> } The promise returned by the function. 132 * @throws { BusinessError } 202 - Not system application to call the interface. 133 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 134 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 135 * @throws { BusinessError } 1600001 - Internal error. 136 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 137 * @throws { BusinessError } 1600003 - Failed to connect to the service. 138 * @throws { BusinessError } 1600012 - No memory space. 139 * @syscap SystemCapability.Notification.Notification 140 * @systemapi 141 * @since 11 142 */ 143 function subscribeSelf(subscriber: NotificationSubscriber): Promise<void>; 144 145 /** 146 * Subscribe to notifications. 147 * 148 * @permission ohos.permission.NOTIFICATION_CONTROLLER 149 * @param { NotificationSubscriber } subscriber - The notification subscriber. 150 * @param { NotificationSubscribeInfo } info - The notification subscribe info. 151 * @param { AsyncCallback<void> } callback - The callback of subscribe. 152 * @throws { BusinessError } 201 - Permission denied. 153 * @throws { BusinessError } 202 - Not system application to call the interface. 154 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 155 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 156 * @throws { BusinessError } 1600001 - Internal error. 157 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 158 * @throws { BusinessError } 1600003 - Failed to connect to the service. 159 * @throws { BusinessError } 1600012 - No memory space. 160 * @syscap SystemCapability.Notification.Notification 161 * @systemapi 162 * @since arkts {'1.1':'9', '1.2':'20'} 163 * @arkts 1.1&1.2 164 */ 165 function subscribe( 166 subscriber: NotificationSubscriber, 167 info: NotificationSubscribeInfo, 168 callback: AsyncCallback<void> 169 ): void; 170 171 /** 172 * Subscribe to notifications 173 * 174 * @permission ohos.permission.NOTIFICATION_CONTROLLER 175 * @param { NotificationSubscriber } subscriber - The notification subscriber. 176 * @param { NotificationSubscribeInfo } [info] - The notification subscribe info. 177 * @returns { Promise<void> } The promise returned by the function. 178 * @throws { BusinessError } 201 - Permission denied. 179 * @throws { BusinessError } 202 - Not system application to call the interface. 180 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 181 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 182 * @throws { BusinessError } 1600001 - Internal error. 183 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 184 * @throws { BusinessError } 1600003 - Failed to connect to the service. 185 * @throws { BusinessError } 1600012 - No memory space. 186 * @syscap SystemCapability.Notification.Notification 187 * @systemapi 188 * @since arkts {'1.1':'9', '1.2':'20'} 189 * @arkts 1.1&1.2 190 */ 191 function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise<void>; 192 193 /** 194 * Unsubscribe notifications. 195 * 196 * @permission ohos.permission.NOTIFICATION_CONTROLLER 197 * @param { NotificationSubscriber } subscriber - The notification subscriber. 198 * @param { AsyncCallback<void> } callback - The callback of unsubscribe. 199 * @throws { BusinessError } 201 - Permission denied. 200 * @throws { BusinessError } 202 - Not system application to call the interface. 201 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 202 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 203 * @throws { BusinessError } 1600001 - Internal error. 204 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 205 * @throws { BusinessError } 1600003 - Failed to connect to the service. 206 * @syscap SystemCapability.Notification.Notification 207 * @systemapi 208 * @since 9 209 */ 210 /** 211 * Unsubscribe notifications. 212 * 213 * @param { NotificationSubscriber } subscriber - The notification subscriber. 214 * @param { AsyncCallback<void> } callback - The callback of unsubscribe. 215 * @throws { BusinessError } 202 - Not system application to call the interface. 216 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 217 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 218 * @throws { BusinessError } 1600001 - Internal error. 219 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 220 * @throws { BusinessError } 1600003 - Failed to connect to the service. 221 * @syscap SystemCapability.Notification.Notification 222 * @systemapi 223 * @since 20 224 * @arkts 1.1&1.2 225 */ 226 function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void; 227 228 /** 229 * Unsubscribe notifications. 230 * 231 * @permission ohos.permission.NOTIFICATION_CONTROLLER 232 * @param { NotificationSubscriber } subscriber - The notification subscriber. 233 * @returns { Promise<void> } The promise returned by the function. 234 * @throws { BusinessError } 201 - Permission denied. 235 * @throws { BusinessError } 202 - Not system application to call the interface. 236 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 237 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 238 * @throws { BusinessError } 1600001 - Internal error. 239 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 240 * @throws { BusinessError } 1600003 - Failed to connect to the service. 241 * @syscap SystemCapability.Notification.Notification 242 * @systemapi 243 * @since 9 244 */ 245 /** 246 * Unsubscribe notifications. 247 * 248 * @param { NotificationSubscriber } subscriber - The notification subscriber. 249 * @returns { Promise<void> } The promise returned by the function. 250 * @throws { BusinessError } 202 - Not system application to call the interface. 251 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 252 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 253 * @throws { BusinessError } 1600001 - Internal error. 254 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 255 * @throws { BusinessError } 1600003 - Failed to connect to the service. 256 * @syscap SystemCapability.Notification.Notification 257 * @systemapi 258 * @since 20 259 * @arkts 1.1&1.2 260 */ 261 function unsubscribe(subscriber: NotificationSubscriber): Promise<void>; 262 263 /** 264 * Remove notification based on BundleOption and NotificationKey. 265 * 266 * @permission ohos.permission.NOTIFICATION_CONTROLLER 267 * @param { BundleOption } bundle - The bundle option. 268 * @param { NotificationKey } notificationKey - The notification key. 269 * @param { RemoveReason } reason - The remove reason. 270 * @param { AsyncCallback<void> } callback - The callback of remove. 271 * @throws { BusinessError } 201 - Permission denied. 272 * @throws { BusinessError } 202 - Not system application to call the interface. 273 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 274 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 275 * @throws { BusinessError } 1600001 - Internal error. 276 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 277 * @throws { BusinessError } 1600003 - Failed to connect to the service. 278 * @throws { BusinessError } 1600007 - The notification does not exist. 279 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 280 * @syscap SystemCapability.Notification.Notification 281 * @systemapi 282 * @since arkts {'1.1':'9', '1.2':'20'} 283 * @arkts 1.1&1.2 284 */ 285 function remove( 286 bundle: BundleOption, 287 notificationKey: NotificationKey, 288 reason: RemoveReason, 289 callback: AsyncCallback<void> 290 ): void; 291 292 /** 293 * Remove notification based on BundleOption and NotificationKey. 294 * 295 * @permission ohos.permission.NOTIFICATION_CONTROLLER 296 * @param { BundleOption } bundle - The bundle option. 297 * @param { NotificationKey } notificationKey - The notification key. 298 * @param { RemoveReason } reason - The remove reason. 299 * @returns { Promise<void> } The promise returned by the function. 300 * @throws { BusinessError } 201 - Permission denied. 301 * @throws { BusinessError } 202 - Not system application to call the interface. 302 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 303 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 304 * @throws { BusinessError } 1600001 - Internal error. 305 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 306 * @throws { BusinessError } 1600003 - Failed to connect to the service. 307 * @throws { BusinessError } 1600007 - The notification does not exist. 308 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 309 * @syscap SystemCapability.Notification.Notification 310 * @systemapi 311 * @since arkts {'1.1':'9', '1.2':'20'} 312 * @arkts 1.1&1.2 313 */ 314 function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise<void>; 315 316 /** 317 * Remove notification based on hashCode. 318 * 319 * @permission ohos.permission.NOTIFICATION_CONTROLLER 320 * @param { string } hashCode - The hashCode. 321 * @param { RemoveReason } reason - The remove reason. 322 * @param { AsyncCallback<void> } callback - The callback of remove. 323 * @throws { BusinessError } 201 - Permission denied. 324 * @throws { BusinessError } 202 - Not system application to call the interface. 325 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 326 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 327 * @throws { BusinessError } 1600001 - Internal error. 328 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 329 * @throws { BusinessError } 1600003 - Failed to connect to the service. 330 * @throws { BusinessError } 1600007 - The notification does not exist. 331 * @syscap SystemCapability.Notification.Notification 332 * @systemapi 333 * @since arkts {'1.1':'9', '1.2':'20'} 334 * @arkts 1.1&1.2 335 */ 336 function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback<void>): void; 337 338 339 /** 340 * Remove notifications based on hashCodes. 341 * 342 * @permission ohos.permission.NOTIFICATION_CONTROLLER 343 * @param { Array<String> } hashCodes - The hashCode array. 344 * @param { RemoveReason } reason - The remove reason. 345 * @param { AsyncCallback<void> } callback - The callback of remove. 346 * @throws { BusinessError } 201 - Permission denied. 347 * @throws { BusinessError } 202 - Not system application to call the interface. 348 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 349 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 350 * @throws { BusinessError } 1600001 - Internal error. 351 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 352 * @throws { BusinessError } 1600003 - Failed to connect to the service. 353 * @syscap SystemCapability.Notification.Notification 354 * @systemapi 355 * @since arkts {'1.1':'10', '1.2':'20'} 356 * @arkts 1.1&1.2 357 */ 358 function remove(hashCodes: Array<String>, reason: RemoveReason, callback: AsyncCallback<void>): void; 359 360 /** 361 * Remove notification based on hashCode. 362 * 363 * @permission ohos.permission.NOTIFICATION_CONTROLLER 364 * @param { string } hashCode - The hashCode. 365 * @param { RemoveReason } reason - The remove reason. 366 * @returns { Promise<void> } The promise returned by the function. 367 * @throws { BusinessError } 201 - Permission denied. 368 * @throws { BusinessError } 202 - Not system application to call the interface. 369 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 370 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 371 * @throws { BusinessError } 1600001 - Internal error. 372 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 373 * @throws { BusinessError } 1600003 - Failed to connect to the service. 374 * @throws { BusinessError } 1600007 - The notification does not exist. 375 * @syscap SystemCapability.Notification.Notification 376 * @systemapi 377 * @since arkts {'1.1':'9', '1.2':'20'} 378 * @arkts 1.1&1.2 379 */ 380 function remove(hashCode: string, reason: RemoveReason): Promise<void>; 381 382 /** 383 * Remove notifications based on hashCodes. 384 * 385 * @permission ohos.permission.NOTIFICATION_CONTROLLER 386 * @param { Array<String> } hashCodes - The hashCode array. 387 * @param { RemoveReason } reason - The remove reason. 388 * @returns { Promise<void> } The promise returned by the function. 389 * @throws { BusinessError } 201 - Permission denied. 390 * @throws { BusinessError } 202 - Not system application to call the interface. 391 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 392 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 393 * @throws { BusinessError } 1600001 - Internal error. 394 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 395 * @throws { BusinessError } 1600003 - Failed to connect to the service. 396 * @syscap SystemCapability.Notification.Notification 397 * @systemapi 398 * @since arkts {'1.1':'10', '1.2':'20'} 399 * @arkts 1.1&1.2 400 */ 401 function remove(hashCodes: Array<String>, reason: RemoveReason): Promise<void>; 402 403 /** 404 * RemoveAll all notifications based on BundleOption. 405 * 406 * @permission ohos.permission.NOTIFICATION_CONTROLLER 407 * @param { BundleOption } bundle - The bundle option. 408 * @param { AsyncCallback<void> } callback - The callback of removeAll. 409 * @throws { BusinessError } 201 - Permission denied. 410 * @throws { BusinessError } 202 - Not system application to call the interface. 411 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 412 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 413 * @throws { BusinessError } 1600001 - Internal error. 414 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 415 * @throws { BusinessError } 1600003 - Failed to connect to the service. 416 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 417 * @syscap SystemCapability.Notification.Notification 418 * @systemapi 419 * @since 9 420 */ 421 function removeAll(bundle: BundleOption, callback: AsyncCallback<void>): void; 422 423 /** 424 * RemoveAll all notifications. 425 * 426 * @permission ohos.permission.NOTIFICATION_CONTROLLER 427 * @param { AsyncCallback<void> } callback - The callback of removeAll. 428 * @throws { BusinessError } 201 - Permission denied. 429 * @throws { BusinessError } 202 - Not system application to call the interface. 430 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 431 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 432 * @throws { BusinessError } 1600001 - Internal error. 433 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 434 * @throws { BusinessError } 1600003 - Failed to connect to the service. 435 * @syscap SystemCapability.Notification.Notification 436 * @systemapi 437 * @since 9 438 */ 439 function removeAll(callback: AsyncCallback<void>): void; 440 441 /** 442 * Remove all notifications under the specified user. 443 * 444 * @permission ohos.permission.NOTIFICATION_CONTROLLER 445 * @param { number } userId - The userId. 446 * @param { AsyncCallback<void> } callback - The callback of removeAll. 447 * @throws { BusinessError } 201 - Permission denied. 448 * @throws { BusinessError } 202 - Not system application to call the interface. 449 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 450 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 451 * @throws { BusinessError } 1600001 - Internal error. 452 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 453 * @throws { BusinessError } 1600003 - Failed to connect to the service. 454 * @throws { BusinessError } 1600008 - The user does not exist. 455 * @syscap SystemCapability.Notification.Notification 456 * @systemapi 457 * @since 9 458 */ 459 function removeAll(userId: number, callback: AsyncCallback<void>): void; 460 461 /** 462 * Remove all notifications under the specified user. 463 * 464 * @permission ohos.permission.NOTIFICATION_CONTROLLER 465 * @param { number } userId - The userId. 466 * @returns { Promise<void> } The promise returned by the function. 467 * @throws { BusinessError } 201 - Permission denied. 468 * @throws { BusinessError } 202 - Not system application to call the interface. 469 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 470 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 471 * @throws { BusinessError } 1600001 - Internal error. 472 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 473 * @throws { BusinessError } 1600003 - Failed to connect to the service. 474 * @throws { BusinessError } 1600008 - The user does not exist. 475 * @syscap SystemCapability.Notification.Notification 476 * @systemapi 477 * @since 9 478 */ 479 function removeAll(userId: number): Promise<void>; 480 481 /** 482 * RemoveAll all notifications. 483 * 484 * @permission ohos.permission.NOTIFICATION_CONTROLLER 485 * @param { BundleOption } [bundle] - The bundle option. 486 * @returns { Promise<void> } The promise returned by the function. 487 * @throws { BusinessError } 201 - Permission denied. 488 * @throws { BusinessError } 202 - Not system application to call the interface. 489 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 490 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 491 * @throws { BusinessError } 1600001 - Internal error. 492 * @throws { BusinessError } 1600002 - Marshalling or unmarshalling error. 493 * @throws { BusinessError } 1600003 - Failed to connect to the service. 494 * @throws { BusinessError } 17700001 - The specified bundle name was not found. 495 * @syscap SystemCapability.Notification.Notification 496 * @systemapi 497 * @since 9 498 */ 499 function removeAll(bundle?: BundleOption): Promise<void>; 500 501 /** 502 * Trigger notification cross-device operation. 503 * 504 * @permission ohos.permission.NOTIFICATION_CONTROLLER 505 * @param { string } hashcode - The notification identifier. 506 * @param { OperationInfo } [operationInfo] - The interactive information. 507 * @returns { Promise<void> } The promise returned by the function. 508 * @throws { BusinessError } 201 - Permission denied. 509 * @throws { BusinessError } 202 - Not system application to call the interface. 510 * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified. 511 * <br>2. Incorrect parameter types. 3. Parameter verification failed. 512 * @throws { BusinessError } 1600010 - Distributed operation failed. 513 * @throws { BusinessError } 1600021 - Distributed operation timed out. 514 * @syscap SystemCapability.Notification.Notification 515 * @systemapi 516 * @since arkts {'1.1':'18', '1.2':'20'} 517 * @arkts 1.1&1.2 518 */ 519 function distributeOperation(hashcode: string, operationInfo?: OperationInfo): Promise<void>; 520 521 /** 522 * Information on cross-device notification interactions 523 * 524 * @typedef OperationInfo 525 * @syscap SystemCapability.Notification.Notification 526 * @systemapi 527 * @since arkts {'1.1':'18', '1.2':'20'} 528 * @arkts 1.1&1.2 529 */ 530 export interface OperationInfo { 531 /** 532 * action button name 533 * 534 * @type { ?string } 535 * @syscap SystemCapability.Notification.Notification 536 * @systemapi 537 * @since arkts {'1.1':'18', '1.2':'20'} 538 * @arkts 1.1&1.2 539 */ 540 actionName?: string; 541 542 /** 543 * user input. 544 * 545 * @type { ?string } 546 * @syscap SystemCapability.Notification.Notification 547 * @systemapi 548 * @since arkts {'1.1':'18', '1.2':'20'} 549 * @arkts 1.1&1.2 550 */ 551 userInput?: string; 552 553 /** 554 * action operation type 555 * 556 * @type { ?number } 557 * @syscap SystemCapability.Notification.Notification 558 * @systemapi 559 * @since 20 560 * @arkts 1.1&1.2 561 */ 562 operationType?: number; 563 564 /** 565 * action button index 566 * 567 * @type { ?number } 568 * @syscap SystemCapability.Notification.Notification 569 * @systemapi 570 * @since 20 571 * @arkts 1.1&1.2 572 */ 573 buttonIndex?: number; 574 } 575 576 /** 577 * Describes a bundleOption in a notification. 578 * 579 * @typedef { _BundleOption } BundleOption 580 * @syscap SystemCapability.Notification.Notification 581 * @systemapi 582 * @since arkts {'1.1':'9', '1.2':'20'} 583 * @arkts 1.1&1.2 584 */ 585 export type BundleOption = _BundleOption; 586 587 /** 588 * Sets filter criteria of publishers for subscribing to desired notifications. 589 * 590 * @typedef { _NotificationSubscribeInfo } NotificationSubscribeInfo 591 * @syscap SystemCapability.Notification.Notification 592 * @systemapi 593 * @since arkts {'1.1':'9', '1.2':'20'} 594 * @arkts 1.1&1.2 595 */ 596 export type NotificationSubscribeInfo = _NotificationSubscribeInfo; 597 598 /** 599 * Provides methods that will be called back when the subscriber receives a new notification or 600 * a notification is canceled. 601 * 602 * @typedef { _NotificationSubscriber } NotificationSubscriber 603 * @syscap SystemCapability.Notification.Notification 604 * @systemapi 605 * @since arkts {'1.1':'9', '1.2':'20'} 606 * @arkts 1.1&1.2 607 */ 608 export type NotificationSubscriber = _NotificationSubscriber; 609 610 /** 611 * Provides methods that will be called back when the subscriber receives a new notification or 612 * a notification is canceled. 613 * 614 * @typedef { _SubscribeCallbackData } SubscribeCallbackData 615 * @syscap SystemCapability.Notification.Notification 616 * @systemapi 617 * @since arkts {'1.1':'9', '1.2':'20'} 618 * @arkts 1.1&1.2 619 */ 620 export type SubscribeCallbackData = _SubscribeCallbackData; 621 622 /** 623 * Describes the properties of the application that the permission to send notifications has changed. 624 * 625 * @typedef { _EnabledNotificationCallbackData } EnabledNotificationCallbackData 626 * @syscap SystemCapability.Notification.Notification 627 * @systemapi 628 * @since arkts {'1.1':'9', '1.2':'20'} 629 * @arkts 1.1&1.2 630 */ 631 export type EnabledNotificationCallbackData = _EnabledNotificationCallbackData; 632 633 /** 634 * Describes the badge number of the application has changed. 635 * 636 * @typedef { _BadgeNumberCallbackData } BadgeNumberCallbackData 637 * @syscap SystemCapability.Notification.Notification 638 * @systemapi 639 * @since arkts {'1.1':'11', '1.2':'20'} 640 * @arkts 1.1&1.2 641 */ 642 export type BadgeNumberCallbackData = _BadgeNumberCallbackData; 643} 644 645export default notificationSubscribe; 646