You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This method will return `false` if access to Contacts has not been granted.
128
128
129
-
### contacts.deleteContactByName(name)
129
+
### contacts.deleteContact(name)
130
130
131
131
*`name` String (required) - The first, last, or full name of a contact.
132
132
@@ -139,9 +139,38 @@ However, you should take care to specify `name` to such a degree that you can be
139
139
140
140
```js
141
141
constname='Jonathan Appleseed'
142
-
constdeleted=contacts.deleteContactByName(name)
142
+
constdeleted=contacts.deleteContact(name)
143
143
144
144
console.log(`Contact ${name} was ${deleted ?'deleted':'not deleted'}.`)
145
145
```
146
146
147
147
This method will return `false` if access to Contacts has not been granted.
148
+
149
+
### contacts.updateContact(contact)
150
+
151
+
*`contact` Object
152
+
*`firstName` String (required) - The first name of the contact.
153
+
*`lastName` String (optional) - The last name of the contact.
154
+
*`nickname` String (optional) - The nickname for the contact.
155
+
*`birthday` String (optional) - The birthday for the contact in `YYYY-MM-DD` format.
156
+
*`phoneNumbers` Array\<String\> (optional) - The phone numbers for the contact, as strings in [E.164 format](https://en.wikipedia.org/wiki/E.164): `+14155552671` or `+442071838750`.
157
+
*`emailAddresses` Array\<String\> (optional) - The email addresses for the contact, as strings.
158
+
159
+
Returns `Boolean` - whether the contact was updated successfully.
160
+
161
+
Updates a contact to the user's contacts database.
162
+
163
+
You should take care to specify parameters to the `contact` object to such a degree that you can be confident the first contact to be returned from a predicate search is the contact you intend to update.
164
+
165
+
```js
166
+
// Change contact's nickname from Billy -> Will
167
+
constupdated=contacts.updateContact({
168
+
firstName:'William',
169
+
lastName:'Grapeseed',
170
+
nickname:'Will'
171
+
})
172
+
173
+
console.log(`Contact was ${updated ?'updated':'not updated'}.`)
174
+
```
175
+
176
+
This method will return `false` if access to Contacts has not been granted.
0 commit comments