From 5befe024ef5c3f108f4d5e9d1d81e342d0ed6bd0 Mon Sep 17 00:00:00 2001 From: ohos-lsw Date: Fri, 18 Mar 2022 13:10:19 +0800 Subject: [PATCH] update contact api Signed-off-by: ohos-lsw --- api/@ohos.contact.d.ts | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/api/@ohos.contact.d.ts b/api/@ohos.contact.d.ts index 8242ea2aa9..6b3da54f25 100644 --- a/api/@ohos.contact.d.ts +++ b/api/@ohos.contact.d.ts @@ -26,7 +26,7 @@ declare namespace contact { /** * Creates a contact. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.WRITE_CONTACTS} * * @param contact Indicates the contact information. * @return Returns the contact ID (which can be obtained by {@link Contact#getId()}) if the creation is successful; @@ -35,10 +35,22 @@ declare namespace contact { function addContact(contact: Contact, callback: AsyncCallback): void; function addContact(contact: Contact): Promise; + /** + * Select contact. + * + *

Permissions required: {@code ohos.permission.READ_CONTACTS} + * + * @return Returns the contact list which user select; + * returns empty contact list if user not select. + * @syscap SystemCapability.Applications.ContactsData, SystemCapability.Applications.Contacts + */ + function selectContact(callback: AsyncCallback>): void; + function selectContact(): Promise>; + /** * Deletes a specified contact. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.WRITE_CONTACTS} * * @param key Indicates the unique query key of a contact to delete. * @return Returns {@code true} if the contact is deleted; returns {@code false} otherwise. @@ -49,7 +61,7 @@ declare namespace contact { /** * Queries a specified contact of specified attributes. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param key Indicates the unique query key of a contact. * @param holder Indicates the contact holder. If this parameter is null, the default holder is used for matching. @@ -65,7 +77,7 @@ declare namespace contact { /** * Queries contacts with query conditions. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param holder Indicates the contact holder. If this parameter is null, the default holder is used for matching. * @param attrs Indicates the contact attributes. If this parameter is null, all attributes are used for matching. @@ -80,7 +92,7 @@ declare namespace contact { /** * Queries contacts by a specified email address, contact holder, and contact attributes. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param email Indicates the email address. * @param holder Indicates the contact holder. If this parameter is null, the default holder is used for matching. @@ -96,7 +108,7 @@ declare namespace contact { /** * Queries contacts by a phone number, holder, and contact attribute. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS}. + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param phoneNumber Indicates the phone number. Only full match is supported, and wildcards are not supported. * @param holder Indicates the contact holder. If this parameter is null, the default holder is used for matching. @@ -113,7 +125,7 @@ declare namespace contact { /** * Queries contact groups. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param holder Indicates the contact holder. If this parameter is null, the default holder is used for matching. * @return Returns the contact group list. @@ -125,7 +137,7 @@ declare namespace contact { /** * Queries contact holders. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @return Returns the {@code Holder} list object. */ @@ -135,7 +147,7 @@ declare namespace contact { /** * Obtains the query key of a contact based on a specified ID and holder. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param id Indicates the contact ID. * @param holder Indicates the contact holder. If this parameter is null, the default holder is used for matching. @@ -148,7 +160,7 @@ declare namespace contact { /** * Queries information about "my card". * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param attrs Indicates the contact attributes. If this parameter is null, all attributes are used for matching. * @return Returns information about "my card". @@ -160,7 +172,7 @@ declare namespace contact { /** * Updates specified attributes of a contact. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.WRITE_CONTACTS} * * @param contact Indicates the contact whose information is to update. * @param attrs Indicates the contact attributes to update. If this parameter is null, @@ -174,7 +186,7 @@ declare namespace contact { /** * Checks whether the contact ID is in the local phone book. * - *

Permissions required: {@code ohos.permission.READ_CONTACTS} and {@code ohos.permission.WRITE_CONTACTS} + *

Permissions required: {@code ohos.permission.READ_CONTACTS} * * @param id Indicates the contact ID. * @return Returns {@code true} if the contact ID is in the local phone book; returns {@code false} otherwise. @@ -185,6 +197,8 @@ declare namespace contact { /** * Checks whether the contact ID is of "my card". * + *

Permissions required: {@code ohos.permission.READ_CONTACTS} + * * @param id Indicates the contact ID. * @return Returns {@code true} if the contact ID is of "my card"; returns {@code false} otherwise. */ -- Gitee