-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcontact.js
More file actions
117 lines (108 loc) · 3.06 KB
/
contact.js
File metadata and controls
117 lines (108 loc) · 3.06 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
const ContactsContainer = require('./contacts-container');
const ContactsGroup = require('./contacts-group');
class Contact {
/**
* @param {string} namePrefix
* @param {string} givenName
* @param {string} middleName
* @param {string} familyName
* @param {string} nickname
* @param {Date} birthday
* @param {[string]} emailAddresses
* @param {[string]} phoneNumbers
* @param {[string]} postalAddresses
* @param {[string]} socialProfiles
* @param {string} note
* @param {[string]} urlAddresses
* @param {[any]} dates
* @param {string} organizationName
* @param {string} departmentName
* @param {string} jobTitle
*/
constructor(namePrefix, givenName, middleName, familyName, nickname, birthday, emailAddresses, phoneNumbers, postalAddresses, socialProfiles, note, urlAddresses, dates, organizationName, departmentName, jobTitle) {
Object.defineProperty(this, "identifier", {
value: ""
});
this.namePrefix = namePrefix;
this.givenName = givenName;
this.middleName = middleName;
this.familyName = familyName;
this.nickname = nickname;
this.birthday = birthday;
this.image = null;
this.emailAddresses = emailAddresses;
this.phoneNumbers = phoneNumbers;
this.postalAddresses = postalAddresses;
this.socialProfiles = socialProfiles;
this.note = note;
this.urlAddresses = urlAddresses;
this.dates = dates;
this.organizationName = organizationName;
this.departmentName = departmentName;
this.jobTitle = jobTitle;
let availableProperties = [];
for (item of [
"NamePrefix",
"GiveName",
"MiddleName",
"FamilyName",
"Nickname",
"Birthday",
"EmailAddresses",
"PhoneNumbers",
"PostalAddresses",
"SocialProfiles",
"Image",
"Note",
"URLAddresses",
"OrganizationName",
"DepartmentName",
"JobTitle",
"Dates"
]) {
availableProperties.push(`is${item}Available`);
}
for (item of availableProperties) {
Object.defineProperty(this, item, {value: true});
}
}
/**
* @param {[ContactsContainer]} containers
* @returns {Promise<[Contact]>} - Promise that provides the contacts when fulfilled.
*/
static async all(containers) {
return this.all(containers)
}
/**
* @param {[ContactsGroup]} groups
* @returns {Promise<[Contact]>} - Promise that provides the contacts when fulfilled.
*/
static async inGroups(groups) {
return this.inGroups(groups)
}
/**
* @param {Contact} contact
* @param {string} containerIdentifier
*/
static add(contact, containerIdentifier) {
return this.add(contact, containerIdentifier)
}
/**
* @param {Contact} contact
*/
static update(contact) {
return this.update(contact)
}
/**
* @param {Contact} contact
*/
static delete(contact) {
return this.delete(contact)
}
/**
* @returns {Promise} - Promise that fulfills when the changes have been persisted. The promise carries no value.
*/
static async persistChanges() {
}
}
module.exports = Contact;