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