1 | export declare type ContactFieldType = '*' | 'addresses' | 'birthday' | 'categories' | 'country' | 'department' | 'displayName' | 'emails' | 'familyName' | 'formatted' | 'givenName' | 'honorificPrefix' | 'honorificSuffix' | 'id' | 'ims' | 'locality' | 'middleName' | 'name' | 'nickname' | 'note' | 'organizations' | 'phoneNumbers' | 'photos' | 'postalCode' | 'region' | 'streetAddress' | 'title' | 'urls';
|
2 |
|
3 |
|
4 |
|
5 | export interface IContactProperties {
|
6 |
|
7 | id?: string;
|
8 |
|
9 | displayName?: string;
|
10 |
|
11 | name?: IContactName;
|
12 |
|
13 | nickname?: string;
|
14 |
|
15 | phoneNumbers?: IContactField[];
|
16 |
|
17 | emails?: IContactField[];
|
18 |
|
19 | addresses?: IContactAddress[];
|
20 |
|
21 | ims?: IContactField[];
|
22 |
|
23 | organizations?: IContactOrganization[];
|
24 |
|
25 | birthday?: Date;
|
26 |
|
27 | note?: string;
|
28 |
|
29 | photos?: IContactField[];
|
30 |
|
31 | categories?: IContactField[];
|
32 |
|
33 | urls?: IContactField[];
|
34 | }
|
35 |
|
36 |
|
37 |
|
38 | export declare class Contact implements IContactProperties {
|
39 | private _objectInstance;
|
40 | id: string;
|
41 | displayName: string;
|
42 | name: IContactName;
|
43 | nickname: string;
|
44 | phoneNumbers: IContactField[];
|
45 | emails: IContactField[];
|
46 | addresses: IContactAddress[];
|
47 | ims: IContactField[];
|
48 | organizations: IContactOrganization[];
|
49 | birthday: Date;
|
50 | note: string;
|
51 | photos: IContactField[];
|
52 | categories: IContactField[];
|
53 | urls: IContactField[];
|
54 | constructor();
|
55 | clone(): Contact;
|
56 | remove(): Promise<any>;
|
57 | save(): Promise<any>;
|
58 | }
|
59 | /**
|
60 | * @private
|
61 | */
|
62 | export interface IContactError {
|
63 |
|
64 | code: number;
|
65 |
|
66 | message: string;
|
67 | }
|
68 |
|
69 |
|
70 |
|
71 | export declare var ContactError: {
|
72 | new (code: number): IContactError;
|
73 | UNKNOWN_ERROR: number;
|
74 | INVALID_ARGUMENT_ERROR: number;
|
75 | TIMEOUT_ERROR: number;
|
76 | PENDING_OPERATION_ERROR: number;
|
77 | IO_ERROR: number;
|
78 | NOT_SUPPORTED_ERROR: number;
|
79 | PERMISSION_DENIED_ERROR: number;
|
80 | };
|
81 | export interface IContactName {
|
82 |
|
83 | formatted?: string;
|
84 |
|
85 | familyName?: string;
|
86 |
|
87 | givenName?: string;
|
88 |
|
89 | middleName?: string;
|
90 |
|
91 | honorificPrefix?: string;
|
92 |
|
93 | honorificSuffix?: string;
|
94 | }
|
95 |
|
96 |
|
97 |
|
98 | export declare class ContactName implements IContactName {
|
99 | formatted: string;
|
100 | familyName: string;
|
101 | givenName: string;
|
102 | middleName: string;
|
103 | honorificPrefix: string;
|
104 | honorificSuffix: string;
|
105 | constructor(formatted?: string, familyName?: string, givenName?: string, middleName?: string, honorificPrefix?: string, honorificSuffix?: string);
|
106 | }
|
107 | export interface IContactField {
|
108 |
|
109 | type?: string;
|
110 |
|
111 | value?: string;
|
112 |
|
113 | pref?: boolean;
|
114 | }
|
115 |
|
116 |
|
117 |
|
118 | export declare class ContactField implements IContactField {
|
119 | type: string;
|
120 | value: string;
|
121 | pref: boolean;
|
122 | constructor(type?: string, value?: string, pref?: boolean);
|
123 | }
|
124 | export interface IContactAddress {
|
125 |
|
126 | pref?: boolean;
|
127 |
|
128 | type?: string;
|
129 |
|
130 | formatted?: string;
|
131 |
|
132 | streetAddress?: string;
|
133 |
|
134 | locality?: string;
|
135 |
|
136 | region?: string;
|
137 |
|
138 | postalCode?: string;
|
139 |
|
140 | country?: string;
|
141 | }
|
142 |
|
143 |
|
144 |
|
145 | export declare class ContactAddress implements IContactAddress {
|
146 | pref: boolean;
|
147 | type: string;
|
148 | formatted: string;
|
149 | streetAddress: string;
|
150 | locality: string;
|
151 | region: string;
|
152 | postalCode: string;
|
153 | country: string;
|
154 | constructor(pref?: boolean, type?: string, formatted?: string, streetAddress?: string, locality?: string, region?: string, postalCode?: string, country?: string);
|
155 | }
|
156 | export interface IContactOrganization {
|
157 |
|
158 | pref?: boolean;
|
159 |
|
160 | type?: string;
|
161 |
|
162 | name?: string;
|
163 |
|
164 | department?: string;
|
165 |
|
166 | title?: string;
|
167 | }
|
168 |
|
169 |
|
170 |
|
171 | export declare class ContactOrganization implements IContactOrganization {
|
172 | type: string;
|
173 | name: string;
|
174 | department: string;
|
175 | title: string;
|
176 | pref: boolean;
|
177 | constructor(type?: string, name?: string, department?: string, title?: string, pref?: boolean);
|
178 | }
|
179 | /** Search options to filter navigator.contacts. */
|
180 | export interface IContactFindOptions {
|
181 |
|
182 | filter?: string;
|
183 |
|
184 | multiple?: boolean;
|
185 |
|
186 | desiredFields?: string[];
|
187 | |
188 |
|
189 |
|
190 | hasPhoneNumber?: boolean;
|
191 | }
|
192 |
|
193 |
|
194 |
|
195 | export declare class ContactFindOptions implements IContactFindOptions {
|
196 | filter: string;
|
197 | multiple: boolean;
|
198 | desiredFields: string[];
|
199 | hasPhoneNumber: boolean;
|
200 | constructor(filter?: string, multiple?: boolean, desiredFields?: string[], hasPhoneNumber?: boolean);
|
201 | }
|
202 | /**
|
203 | * @name Contacts
|
204 | * @description
|
205 | * Access and manage Contacts on the device.
|
206 | *
|
207 | * @usage
|
208 | *
|
209 | * ```typescript
|
210 | * import { Contacts, Contact, ContactField, ContactName } from 'ionic-native';
|
211 | *
|
212 | *
|
213 | * let contact: Contact = Contacts.create();
|
214 | *
|
215 | * contact.name = new ContactName(null, 'Smith', 'John');
|
216 | * contact.phoneNumbers = [new ContactField('mobile', '6471234567')];
|
217 | * contact.save().then(
|
218 | * () => console.log('Contact saved!', contact),
|
219 | * (error: any) => console.error('Error saving contact.', error)
|
220 | * );
|
221 | *
|
222 | * ```
|
223 | * @interfaces
|
224 | * IContactProperties
|
225 | * IContactError
|
226 | * IContactName
|
227 | * IContactField
|
228 | * IContactAddress
|
229 | * IContactOrganization
|
230 | * IContactFindOptions
|
231 | */
|
232 | export declare class Contacts {
|
233 | /**
|
234 | * Create a single contact.
|
235 | * @returns {Contact} Returns a Contact object
|
236 | */
|
237 | static create(): Contact;
|
238 | /**
|
239 | * Search for contacts in the Contacts list.
|
240 | * @param fields {ContactFieldType[]} Contact fields to be used as a search qualifier
|
241 | * @param options {IContactFindOptions} Optional options for the query
|
242 | * @returns {Promise<Contact[]>} Returns a Promise that resolves with the search results (an array of Contact objects)
|
243 | */
|
244 | static find(fields: ContactFieldType[], options?: IContactFindOptions): Promise<Contact[]>;
|
245 | /**
|
246 | * Select a single Contact.
|
247 | * @returns {Promise<Contact>} Returns a Promise that resolves with the selected Contact
|
248 | */
|
249 | static pickContact(): Promise<Contact>;
|
250 | }
|
251 |
|
\ | No newline at end of file |