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