update d.ts files

Signed-off-by: zhaoyuan <zhaoyuan17@huawei.com>
This commit is contained in:
zhaoyuan 2021-09-27 14:12:43 +00:00
parent ddb7fcef01
commit 333e323cc4
11 changed files with 152 additions and 6 deletions

View File

@ -45,6 +45,7 @@ declare namespace commonEvent {
*/
function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback<void>): void;
/**
* create the CommonEventSubscriber for the SubscriberInfo.
*

View File

@ -16,6 +16,7 @@
import { AsyncCallback , Callback} from './basic';
import { Want } from './ability/want';
import { WantAgentInfo } from './wantAgent/wantAgentInfo';
import { TriggerInfo } from './wantAgent/triggerInfo';
/**
* Provide the method obtain trigger, cancel, and compare and to obtain
@ -23,17 +24,78 @@ import { WantAgentInfo } from './wantAgent/wantAgentInfo';
*
* @name wantAgent
* @since 7
* @devices phone, tablet
* @devices phone, tablet, tv, wearable, car
* @import wantAgent from '@ohos.wantAgent';
* @permission N/A
*/
declare namespace wantAgent {
/**
* Obtains the bundle name of an {@link WantAgent}.
*
* @param agent Indicates the {@link WantAgent} whose bundle name is to be obtained.
* @return Returns the bundle name of the {@link WantAgent} if any.
* @since 7
*/
function getBundleName(agent: WantAgent, callback: AsyncCallback<string>): void;
function getBundleName(agent: WantAgent): Promise<string>;
/**
* Obtains the bundle name of an {@link WantAgent}.
*
* @param agent Indicates the {@link WantAgent} whose UID is to be obtained.
* @return Returns the UID of the {@link WantAgent} if any; returns {@code -1} otherwise.
* @since 7
*/
function getUid(agent: WantAgent, callback: AsyncCallback<number>): void;
function getUid(agent: WantAgent): Promise<number>;
/**
* Obtains the {@link Want} of an {@link WantAgent}.
*
* @param agent Indicates the {@link WantAgent} whose UID is to be obtained.
* @return Returns the {@link Want} of the {@link WantAgent}.
* @systemapi Hide this for inner system use.
* @since 7
*/
function getWant(agent: WantAgent, callback: AsyncCallback<Want>): void;
function getWant(agent: WantAgent): Promise<Want>;
/**
* Cancels an {@link WantAgent}. Only the application that creates the {@link IntentAgent} can cancel it.
*
* @param agent Indicates the {@link WantAgent} to cancel.
* @since 7
*/
function cancel(agent: WantAgent, callback: AsyncCallback<void>): void;
function cancel(agent: WantAgent): Promise<void>;
/**
* Obtains the bundle name of an {@link WantAgent}.
*
* @param agent Indicates the {@link WantAgent} whose bundle name is to be obtained.
* @param triggerInfo Indicates the {@link TriggerInfo} object that contains triggering parameters.
* @param callback Indicates the callback method to be called after the {@link WantAgent} is triggered.
* @since 7
*/
function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void;
/**
* Checks whether two {@link WantAgent} objects are the same.
*
* @param agent Indicates one of the {@link WantAgent} object to compare.
* @param otherAgent Indicates the other {@link WantAgent} object to compare.
* @return Returns {@code true} If the two objects are the same; returns {@code false} otherwise.
* @since 7
*/
function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback<boolean>): void;
function equal(agent: WantAgent, otherAgent: WantAgent): Promise<boolean>;
/**
* Obtains an {@link WantAgent} object.
*
* @param info Indicates the {@link WantAgentInfo} object that contains parameters of the
* {@link WantAgent} object to create.
* @return Returns the created {@link WantAgent} object.
*
* @since 7
*/
function getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void;
@ -69,6 +131,20 @@ declare namespace wantAgent {
START_SERVICE,
SEND_COMMON_EVENT
}
/**
* A callback for the {@link trigger()} method. After the method execution is complete,
* the callback process will start.
*
* @since 7
*/
export interface CompleteData {
info: WantAgent;
want: Want;
finalCode: number;
finalData: string;
extraInfo?: {[key: string]: any};
}
}
export type WantAgent = object;

View File

@ -49,4 +49,12 @@ export interface CommonEventData {
* @since 7
*/
data?: string;
/**
* The description of the parameters in a common event.
*
* @default -
* @since 7
*/
parameters?: {[key: string]: any};
}

View File

@ -66,4 +66,12 @@ export interface CommonEventPublishData {
* @since 7
*/
isSticky?: boolean;
/**
* The description of the parameters in a common event.
*
* @default -
* @since 7
*/
parameters?: {[key: string]: any};
}

View File

@ -14,6 +14,7 @@
*/
import notification from '../@ohos.notification';
import image from './@ohos.multimedia.image';
/**
* Constructs basic notifications.
@ -61,9 +62,24 @@ export interface NotificationMultiLineContent extends NotificationBasicContent {
}
/**
* Constructs a notification that includes multiple lines of text.
* Constructs a notification that includes a picture.
*
* @name NotificationMultiLineContent
* @name NotificationPictureContent
* @since 7
* @sysCap SystemCapability.Notification.ANS
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export interface NotificationPictureContent extends NotificationBasicContent {
briefText: string;
expandedTitle: string;
picture: image.PixelMap;
}
/**
* Constructs a notification.
*
* @name NotificationContent
* @since 7
* @sysCap SystemCapability.Notification.ANS
* @devices phone, tablet, tv, wearable, car
@ -74,4 +90,5 @@ export interface NotificationContent {
normal?: NotificationBasicContent;
longText?: NotificationLongTextContent;
multiLine?: NotificationMultiLineContent;
picture?: NotificationPictureContent;
}

View File

@ -14,6 +14,7 @@
*/
import notification from '../@ohos.notification';
import image from '../@ohos.multimedia.image';
import { WantAgent } from '../@ohos.wantAgent';
import { NotificationContent } from './notificationContent';
import { NotificationActionButton } from './notificationActionButton';
@ -48,6 +49,8 @@ export interface NotificationRequest {
badgeIconStyle?: number;
showDeliveryTime?: boolean;
actionButtons?: Array<NotificationActionButton>;
smallIcon?: image.PixelMap;
largeIcon?: image.PixelMap;
readonly creatorBundleName?: string;
readonly creatorUid?: number;
readonly creatorPid?: number;

View File

@ -22,6 +22,7 @@ import { NotificationSlot } from './notificationSlot';
* @sysCap SystemCapability.Notification.ANS
* @devices phone, tablet, tv, wearable, car
* @permission N/A
* @systemapi Hide this for inner system use.
* @since 7
*/
export interface NotificationSorting {

View File

@ -23,6 +23,7 @@ import { NotificationSorting } from './notificationSorting';
* @sysCap SystemCapability.Notification.ANS
* @devices phone, tablet, tv, wearable, car
* @permission N/A
* @systemapi Hide this for inner system use.
*/
interface NotificationSortingMap {
readonly sortings: {[key: string]: NotificationSorting};

View File

@ -21,6 +21,7 @@
* @sysCap SystemCapability.Notification.ANS
* @devices phone, tablet, tv, wearable, car
* @permission N/A
* @systemapi Hide this for inner system use.
*/
export interface NotificationSubscribeInfo {
bundleNames?: Array<string>;

31
api/wantAgent/triggerInfo.d.ts vendored Normal file
View File

@ -0,0 +1,31 @@
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Want } from '../ability/want';
/**
* the info when object of WantAgent trigger
*
* @name TriggerInfo
* @since 7
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export interface TriggerInfo {
code: number;
want?: Want;
permission?: string;
extraInfo?: {[key: string]: any};
}

View File

@ -21,8 +21,7 @@ import wantAgent from '../@ohos.wantAgent'
*
* @name WantAgentInfo
* @since 7
* @sysCap ans
* @devices phone, tablet
* @devices phone, tablet, tv, wearable, car
* @permission N/A
*/
export interface WantAgentInfo {