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
Copy file name to clipboardExpand all lines: README.md
+18-12Lines changed: 18 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -34,6 +34,8 @@ Requests access to the [CNContactStore](https://developer.apple.com/documentatio
34
34
35
35
If the user has previously denied the request, this method will open the Contacts pane within the Privacy section of System Preferences.
36
36
37
+
*Note that access permission request prompts will not appear when `requestAccess()` is invoked in embedded terminals such as those found in Visual Studio Code. Run your code from an external terminal such as Terminal.app instead.*
38
+
37
39
### `contacts.getAuthStatus()`
38
40
39
41
Returns `String` - Can be one of 'Not Determined', 'Denied', 'Authorized', or 'Restricted'.
@@ -62,7 +64,7 @@ console.log(`Authorization access to contacts is: ${authStatus}`)
62
64
63
65
### `contacts.getAllContacts([extraProperties])`
64
66
65
-
*`extraProperties` string[] (optional) - an array of extra contact properties to fetch that can be any of: `jobTitle`, `departmentName`, `organizationName`, `middleName`, `note`, `contactImage`, `contactThumbnailImage`, `instantMessageAddresses`, or `socialProfiles`.
67
+
*`extraProperties` string[] (optional) - an array of extra contact properties to fetch that can be any of: `jobTitle`, `departmentName`, `organizationName`, `middleName`, `note`, `contactImage`, `contactThumbnailImage`, `instantMessageAddresses`, `socialProfiles`, or `urlAddresses`.
66
68
67
69
Returns `Array<Object>` - Returns an array of contact objects.
68
70
@@ -78,13 +80,14 @@ The returned objects will take the following format:
78
80
*`postalAddresses` String[] - An array of postal as strings.
79
81
*`jobTitle` String (optional) - The contact's job title.
80
82
*`departmentName` String (optional) - The name of the department associated with the contact.
81
-
*`organizationName`String (optional) - The name of the organization associated with the contact.
83
+
*`organizationName` String (optional) - The name of the organization associated with the contact.
82
84
*`middleName` String (optional) - The contact's middle name.
83
85
*`note` String (optional) - The note associated with the contact.
84
86
*`contactImage` Buffer (optional) - a Buffer representation of the contact's profile picture.
85
87
*`contactThumbnailImage` Buffer (optional) - a Buffer representation of The thumbnail version of the contact’s profile picture.
86
88
*`socialProfiles` Object[] (optional) - An array of labeled social profiles for a contact.
87
-
*`instantMessageAddresses` Object[] (optional) - An array of labeled IM addresses for the contact.
89
+
*`instantMessageAddresses` Object[] (optional) - An array of labeled IM addresses for the contact.
90
+
*`urlAddresses` String[] (optional) - An array of url addresses as strings.
88
91
89
92
This method will return an empty array (`[]`) if access to Contacts has not been granted.
*`name` String (required) - The first, middle, last, or full name of a contact.
115
-
*`extraProperties` String[] (optional) - an array of extra contact properties to fetch that can be any of: `jobTitle`, `departmentName`, `organizationName`, `middleName`, `note`, `contactImage`, `contactThumbnailImage`, `instantMessageAddresses`, or `socialProfiles`.
118
+
*`extraProperties` String[] (optional) - an array of extra contact properties to fetch that can be any of: `jobTitle`, `departmentName`, `organizationName`, `middleName`, `note`, `contactImage`, `contactThumbnailImage`, `instantMessageAddresses`, `socialProfiles`, or `urlAddresses`.
116
119
117
120
Returns `Array<Object>` - Returns an array of contact objects where either the first or last name of the contact matches `name`.
118
121
@@ -130,13 +133,14 @@ The returned object will take the following format:
130
133
*`postalAddresses` String[] - An array of postal as strings.
131
134
*`jobTitle` String (optional) - The contact's job title.
132
135
*`departmentName` String (optional) - The name of the department associated with the contact.
133
-
*`organizationName`String (optional) - The name of the organization associated with the contact.
136
+
*`organizationName` String (optional) - The name of the organization associated with the contact.
134
137
*`middleName` String (optional) - The contact's middle name.
135
138
*`note` String (optional) - The note associated with the contact.
136
139
*`contactImage` Buffer (optional) - a Buffer representation of the contact's profile picture.
137
140
*`contactThumbnailImage` Buffer (optional) - a Buffer representation of The thumbnail version of the contact’s profile picture.
138
141
*`socialProfiles` Object[] (optional) - An array of labeled social profiles for a contact.
139
-
*`instantMessageAddresses` Object[] (optional) - An array of labeled IM addresses for the contact.
142
+
*`instantMessageAddresses` Object[] (optional) - An array of labeled IM addresses for the contact.
143
+
*`urlAddresses` String[] (optional) - An array of url addresses as strings.
140
144
141
145
This method will return an empty array (`[]`) if access to Contacts has not been granted.
142
146
@@ -169,15 +173,16 @@ console.log(contacts)
169
173
*`nickname` String (optional) - The nickname for the contact.
170
174
*`jobTitle` String (optional) - The contact's job title.
171
175
*`departmentName` String (optional) - The name of the department associated with the contact.
172
-
*`organizationName`String (optional) - The name of the organization associated with the contact.
176
+
*`organizationName` String (optional) - The name of the organization associated with the contact.
173
177
*`middleName` String (optional) - The contact's middle name.
174
178
*`birthday` String (optional) - The birthday for the contact in `YYYY-MM-DD` format.
175
179
*`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`.
176
180
*`emailAddresses` Array\<String\> (optional) - The email addresses for the contact, as strings.
181
+
*`urlAddresses` Array\<String\> (optional) - The url addresses for the contact, as strings.
177
182
178
183
Returns `Boolean` - whether the contact information was created successfully.
179
184
180
-
Creates and save a new contact to the user's contacts database.
185
+
Creates and save a new contact to the user's contacts database.
181
186
182
187
This method will return `false` if access to Contacts has not been granted.
*`nickname` String (optional) - The nickname for the contact.
228
233
*`jobTitle` String (optional) - The contact's job title.
229
234
*`departmentName` String (optional) - The name of the department associated with the contact.
230
-
*`organizationName`String (optional) - The name of the organization associated with the contact.
235
+
*`organizationName` String (optional) - The name of the organization associated with the contact.
231
236
*`middleName` String (optional) - The contact's middle name.
232
237
*`birthday` String (optional) - The birthday for the contact in `YYYY-MM-DD` format.
233
238
*`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`.
234
239
*`emailAddresses` Array\<String\> (optional) - The email addresses for the contact, as strings.
240
+
*`urlAddresses` Array\<String\> (optional) - The url addresses for the contact, as strings.
235
241
236
242
Returns `Boolean` - whether the contact was updated successfully.
237
243
@@ -248,7 +254,7 @@ Example Usage:
248
254
constupdated=contacts.updateContact({
249
255
firstName:'William',
250
256
lastName:'Grapeseed',
251
-
nickname:'Will'
257
+
nickname:'Will',
252
258
})
253
259
254
260
console.log(`Contact was ${updated ?'updated':'not updated'}.`)
it('should throw if extraProperties contains invalid properties',()=>{
53
53
consterrorMessage=
54
-
'properties in extraProperties must be one of jobTitle, departmentName, organizationName, middleName, note, contactImage, contactThumbnailImage, instantMessageAddresses, socialProfiles'
54
+
'properties in extraProperties must be one of jobTitle, departmentName, organizationName, middleName, note, contactImage, contactThumbnailImage, instantMessageAddresses, socialProfiles, urlAddresses'
it('should throw if extraProperties contains invalid properties',()=>{
137
137
consterrorMessage=
138
-
'properties in extraProperties must be one of jobTitle, departmentName, organizationName, middleName, note, contactImage, contactThumbnailImage, instantMessageAddresses, socialProfiles'
138
+
'properties in extraProperties must be one of jobTitle, departmentName, organizationName, middleName, note, contactImage, contactThumbnailImage, instantMessageAddresses, socialProfiles, urlAddresses'
0 commit comments