|
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, |
|
4 * You can obtain one at http://mozilla.org/MPL/2.0/. |
|
5 */ |
|
6 |
|
7 dictionary ContactAddress { |
|
8 sequence<DOMString>? type; |
|
9 DOMString? streetAddress; |
|
10 DOMString? locality; |
|
11 DOMString? region; |
|
12 DOMString? postalCode; |
|
13 DOMString? countryName; |
|
14 boolean? pref; |
|
15 }; |
|
16 |
|
17 dictionary ContactField { |
|
18 sequence<DOMString>? type; |
|
19 DOMString? value; |
|
20 boolean? pref; |
|
21 }; |
|
22 |
|
23 dictionary ContactTelField : ContactField { |
|
24 DOMString? carrier; |
|
25 }; |
|
26 |
|
27 dictionary ContactProperties { |
|
28 Date? bday; |
|
29 Date? anniversary; |
|
30 |
|
31 DOMString? sex; |
|
32 DOMString? genderIdentity; |
|
33 |
|
34 sequence<Blob>? photo; |
|
35 |
|
36 sequence<ContactAddress>? adr; |
|
37 |
|
38 sequence<ContactField>? email; |
|
39 sequence<ContactField>? url; |
|
40 sequence<ContactField>? impp; |
|
41 |
|
42 sequence<ContactTelField>? tel; |
|
43 |
|
44 sequence<DOMString>? name; |
|
45 sequence<DOMString>? honorificPrefix; |
|
46 sequence<DOMString>? givenName; |
|
47 sequence<DOMString>? phoneticGivenName; |
|
48 sequence<DOMString>? additionalName; |
|
49 sequence<DOMString>? familyName; |
|
50 sequence<DOMString>? phoneticFamilyName; |
|
51 sequence<DOMString>? honorificSuffix; |
|
52 sequence<DOMString>? nickname; |
|
53 sequence<DOMString>? category; |
|
54 sequence<DOMString>? org; |
|
55 sequence<DOMString>? jobTitle; |
|
56 sequence<DOMString>? note; |
|
57 sequence<DOMString>? key; |
|
58 }; |
|
59 |
|
60 [Constructor(optional ContactProperties properties), |
|
61 JSImplementation="@mozilla.org/contact;1"] |
|
62 interface mozContact { |
|
63 attribute DOMString id; |
|
64 readonly attribute Date? published; |
|
65 readonly attribute Date? updated; |
|
66 |
|
67 attribute Date? bday; |
|
68 attribute Date? anniversary; |
|
69 |
|
70 attribute DOMString? sex; |
|
71 attribute DOMString? genderIdentity; |
|
72 |
|
73 [Cached, Pure] attribute sequence<Blob>? photo; |
|
74 |
|
75 [Cached, Pure] attribute sequence<ContactAddress>? adr; |
|
76 |
|
77 [Cached, Pure] attribute sequence<ContactField>? email; |
|
78 [Cached, Pure] attribute sequence<ContactField>? url; |
|
79 [Cached, Pure] attribute sequence<ContactField>? impp; |
|
80 |
|
81 [Cached, Pure] attribute sequence<ContactTelField>? tel; |
|
82 |
|
83 [Cached, Pure] attribute sequence<DOMString>? name; |
|
84 [Cached, Pure] attribute sequence<DOMString>? honorificPrefix; |
|
85 [Cached, Pure] attribute sequence<DOMString>? givenName; |
|
86 [Cached, Pure] attribute sequence<DOMString>? phoneticGivenName; |
|
87 [Cached, Pure] attribute sequence<DOMString>? additionalName; |
|
88 [Cached, Pure] attribute sequence<DOMString>? familyName; |
|
89 [Cached, Pure] attribute sequence<DOMString>? phoneticFamilyName; |
|
90 [Cached, Pure] attribute sequence<DOMString>? honorificSuffix; |
|
91 [Cached, Pure] attribute sequence<DOMString>? nickname; |
|
92 [Cached, Pure] attribute sequence<DOMString>? category; |
|
93 [Cached, Pure] attribute sequence<DOMString>? org; |
|
94 [Cached, Pure] attribute sequence<DOMString>? jobTitle; |
|
95 [Cached, Pure] attribute sequence<DOMString>? note; |
|
96 [Cached, Pure] attribute sequence<DOMString>? key; |
|
97 |
|
98 void init(optional ContactProperties properties); |
|
99 |
|
100 [ChromeOnly] |
|
101 void setMetadata(DOMString id, Date? published, Date? updated); |
|
102 |
|
103 jsonifier; |
|
104 }; |
|
105 |
|
106 dictionary ContactFindSortOptions { |
|
107 DOMString sortBy; // "givenName" or "familyName" |
|
108 DOMString sortOrder = "ascending"; // e.g. "descending" |
|
109 }; |
|
110 |
|
111 dictionary ContactFindOptions : ContactFindSortOptions { |
|
112 DOMString filterValue; // e.g. "Tom" |
|
113 DOMString filterOp; // e.g. "startsWith" |
|
114 any filterBy; // e.g. ["givenName", "nickname"] |
|
115 unsigned long filterLimit = 0; |
|
116 }; |
|
117 |
|
118 [NoInterfaceObject, NavigatorProperty="mozContacts", |
|
119 JSImplementation="@mozilla.org/contactManager;1"] |
|
120 interface ContactManager : EventTarget { |
|
121 DOMRequest find(optional ContactFindOptions options); |
|
122 DOMCursor getAll(optional ContactFindSortOptions options); |
|
123 DOMRequest clear(); |
|
124 DOMRequest save(mozContact contact); |
|
125 DOMRequest remove((mozContact or DOMString) contactOrId); |
|
126 DOMRequest getRevision(); |
|
127 DOMRequest getCount(); |
|
128 |
|
129 attribute EventHandler oncontactchange; |
|
130 }; |