diff --git a/api/@ohos.commonEventManager.d.ts b/api/@ohos.commonEventManager.d.ts index 472432ef211fee6d068ba57df25847dc5b67db45..56762448863174666056b49f00dc956a7a42aa64 100644 --- a/api/@ohos.commonEventManager.d.ts +++ b/api/@ohos.commonEventManager.d.ts @@ -196,6 +196,23 @@ declare namespace commonEventManager { * @since arkts {'1.1':'20', '1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Publishes an ordered, sticky, or standard common event to a specified user. + * + * @param { string } event - Specified the names of the common events. + * @param { number } userId - Specified the user to receive the common events. + * @param { AsyncCallback } callback - The callback of publishAsUser. + * @throws { BusinessError } 202 - not system app + * @throws { BusinessError } 1500003 - The common event sending frequency too high. + * @throws { BusinessError } 1500006 - Invalid userId. + * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. + * @throws { BusinessError } 1500008 - Failed to initialize the common event service. + * @throws { BusinessError } 1500009 - Failed to obtain system parameters. + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since arkts {'1.1':'21', '1.2':'21'} + * @arkts 1.1&1.2 + */ function publishAsUser(event: string, userId: number, callback: AsyncCallback): void; /** @@ -216,7 +233,7 @@ declare namespace commonEventManager { * @systemapi * @since 9 */ - /** + /** * Publishes an ordered, sticky, or standard common event to a specified user. * * @param { string } event - Specified the names of the common events. @@ -234,6 +251,25 @@ declare namespace commonEventManager { * @since arkts {'1.1':'20', '1.2':'20'} * @arkts 1.1&1.2 */ + /** + * Publishes an ordered, sticky, or standard common event to a specified user. + * + * @param { string } event - Specified the names of the common events. + * @param { number } userId - Specified the user to receive the common events. + * @param { CommonEventPublishData } options - Indicates the CommonEventPublishData containing the common event + * content and attributes. + * @param { AsyncCallback } callback - The callback of publishAsUser. + * @throws { BusinessError } 202 - not system app + * @throws { BusinessError } 1500003 - The common event sending frequency too high. + * @throws { BusinessError } 1500006 - Invalid userId. + * @throws { BusinessError } 1500007 - Failed to send the message to the common event service. + * @throws { BusinessError } 1500008 - Failed to initialize the common event service. + * @throws { BusinessError } 1500009 - Failed to obtain system parameters. + * @syscap SystemCapability.Notification.CommonEvent + * @systemapi + * @since arkts {'1.1':'21', '1.2':'21'} + * @arkts 1.1&1.2 + */ function publishAsUser( event: string, userId: number,