1+ // Type definitions for node-mac-contacts
2+ // Project: node-mac-contacts
3+
4+ export function getAuthStatus ( ) : AuthStatus
5+ export function requestAccess ( ) : Promise < 'Denied' | 'Authorized' >
6+ export function getAllContacts ( extraProperties ?: ContactExtraProperties ) : Promise < Contact [ ] >
7+ export function getContactByName ( name : string , extraProperties ?: ContactExtraProperties ) : Promise < Contact >
8+ export function addNewContact ( contact ?: AddOrUpdateContactOptions ) : boolean
9+ export function updateContact ( contact ?: AddOrUpdateContactOptions ) : boolean
10+ export function deleteContact ( contact ?: DeleteContactOptions ) : boolean
11+
12+ export interface listener extends NodeJS . EventEmitter {
13+ setup ( ) : void
14+ remove ( ) : void
15+ isListening ( ) : boolean
16+ on ( event : 'contact-changed' , listener : ( external : Boolean ) => void ) : this
17+ once ( event : 'contact-changed' , listener : ( external : Boolean ) => void ) : this
18+ }
19+
20+ export type ContactExtraProperties = Array < 'jobTitle' | 'departmentName' | 'organizationName' | 'middleName' | 'note' | 'contactImage' | 'contactThumbnailImage' | 'instantMessageAddresses' | 'socialProfiles' >
21+
22+ export type AuthStatus = 'Not Determined' | 'Denied' | 'Authorized' | 'Restricted'
23+
24+ export interface DeleteContactOptions {
25+ identifier ?: string ,
26+ name ?: string
27+ }
28+
29+ export interface AddOrUpdateContactOptions {
30+ firstName : string
31+ middleName ?: string
32+ lastName ?: string
33+ nickname ?: string
34+ jobTitle ?: string
35+ departmentName ?: string
36+ organizationName ?: string
37+ birthday ?: string
38+ phoneNumbers ?: string [ ]
39+ emailAddresses ?: string [ ]
40+ }
41+
42+ export interface Contact {
43+ identifier : string
44+ firstName : string
45+ middleName : string
46+ lastName : string
47+ nickname : string
48+ birthday : string
49+ phoneNumbers : string [ ]
50+ emailAddresses : string [ ]
51+ postalAddresses : string [ ]
52+ jobTitle ?: string
53+ departmentName ?: string
54+ organizationName ?: string
55+ note ?: string
56+ contactImage ?: Buffer
57+ contactThumbnailImage ?: Buffer
58+ socialProfiles ?: { service : string , username : string } [ ]
59+ instantMessageAddresses ?: { service : string , username : string } [ ]
60+ }
0 commit comments