UNPKG

10.1 kBTypeScriptView Raw
1import { PermissionResponse, PermissionStatus } from 'expo-modules-core';
2export declare type CalendarFormatType = typeof CalendarFormats.Gregorian | typeof CalendarFormats.Buddhist | typeof CalendarFormats.Chinese | typeof CalendarFormats.Coptic | typeof CalendarFormats.EthiopicAmeteMihret | typeof CalendarFormats.EthiopicAmeteAlem | typeof CalendarFormats.Hebrew | typeof CalendarFormats.ISO8601 | typeof CalendarFormats.Indian | typeof CalendarFormats.Islamic | typeof CalendarFormats.IslamicCivil | typeof CalendarFormats.Japanese | typeof CalendarFormats.Persian | typeof CalendarFormats.RepublicOfChina | typeof CalendarFormats.IslamicTabular | typeof CalendarFormats.IslamicUmmAlQura;
3export declare type ContainerType = typeof ContainerTypes.Local | typeof ContainerTypes.Exchange | typeof ContainerTypes.CardDAV | typeof ContainerTypes.Unassigned;
4export declare type ContactType = typeof ContactTypes.Person | typeof ContactTypes.Company;
5export declare type FieldType = typeof Fields.ID | typeof Fields.ContactType | typeof Fields.Name | typeof Fields.FirstName | typeof Fields.MiddleName | typeof Fields.LastName | typeof Fields.MaidenName | typeof Fields.NamePrefix | typeof Fields.NameSuffix | typeof Fields.Nickname | typeof Fields.PhoneticFirstName | typeof Fields.PhoneticMiddleName | typeof Fields.PhoneticLastName | typeof Fields.Birthday | typeof Fields.NonGregorianBirthday | typeof Fields.Emails | typeof Fields.PhoneNumbers | typeof Fields.Addresses | typeof Fields.SocialProfiles | typeof Fields.InstantMessageAddresses | typeof Fields.UrlAddresses | typeof Fields.Company | typeof Fields.JobTitle | typeof Fields.Department | typeof Fields.ImageAvailable | typeof Fields.Image | typeof Fields.RawImage | typeof Fields.ExtraNames | typeof Fields.Note | typeof Fields.Dates | typeof Fields.Relationships;
6export declare type Date = {
7 day?: number;
8 month?: number;
9 year?: number;
10 id: string;
11 label: string;
12 format?: CalendarFormatType;
13};
14export declare type Relationship = {
15 label: string;
16 name?: string;
17 id: string;
18};
19export declare type Email = {
20 email?: string;
21 isPrimary?: boolean;
22 label: string;
23 id: string;
24};
25export declare type PhoneNumber = {
26 number?: string;
27 isPrimary?: boolean;
28 digits?: string;
29 countryCode?: string;
30 label: string;
31 id: string;
32};
33export declare type Address = {
34 street?: string;
35 city?: string;
36 country?: string;
37 region?: string;
38 neighborhood?: string;
39 postalCode?: string;
40 poBox?: string;
41 isoCountryCode?: string;
42 label: string;
43 id: string;
44};
45export declare type SocialProfile = {
46 service?: string;
47 localizedProfile?: string;
48 url?: string;
49 username?: string;
50 userId?: string;
51 label: string;
52 id: string;
53};
54export declare type InstantMessageAddress = {
55 service?: string;
56 username?: string;
57 localizedService?: string;
58 label: string;
59 id: string;
60};
61export declare type UrlAddress = {
62 label: string;
63 url?: string;
64 id: string;
65};
66export declare type Image = {
67 uri?: string;
68 width?: number;
69 height?: number;
70 base64?: string;
71};
72export declare type Contact = {
73 id: string;
74 contactType: ContactType;
75 name: string;
76 firstName?: string;
77 middleName?: string;
78 lastName?: string;
79 maidenName?: string;
80 namePrefix?: string;
81 nameSuffix?: string;
82 nickname?: string;
83 phoneticFirstName?: string;
84 phoneticMiddleName?: string;
85 phoneticLastName?: string;
86 company?: string;
87 jobTitle?: string;
88 department?: string;
89 note?: string;
90 imageAvailable?: boolean;
91 image?: Image;
92 rawImage?: Image;
93 birthday?: Date;
94 dates?: Date[];
95 relationships?: Relationship[];
96 emails?: Email[];
97 phoneNumbers?: PhoneNumber[];
98 addresses?: Address[];
99 instantMessageAddresses?: InstantMessageAddress[];
100 urlAddresses?: UrlAddress[];
101 nonGregorianBirthday?: Date;
102 socialProfiles?: SocialProfile[];
103};
104export declare type ContactResponse = {
105 data: Contact[];
106 hasNextPage: boolean;
107 hasPreviousPage: boolean;
108};
109export declare type ContactSort = typeof SortTypes.UserDefault | typeof SortTypes.FirstName | typeof SortTypes.LastName | typeof SortTypes.None;
110export declare type ContactQuery = {
111 pageSize?: number;
112 pageOffset?: number;
113 fields?: FieldType[];
114 sort?: ContactSort;
115 name?: string;
116 id?: string | string[];
117 groupId?: string;
118 containerId?: string;
119 rawContacts?: boolean;
120};
121export declare type FormOptions = {
122 displayedPropertyKeys?: FieldType[];
123 message?: string;
124 alternateName?: string;
125 allowsEditing?: boolean;
126 allowsActions?: boolean;
127 shouldShowLinkedContacts?: boolean;
128 isNew?: boolean;
129 cancelButtonTitle?: string;
130 preventAnimation?: boolean;
131 groupId?: string;
132};
133export declare type GroupQuery = {
134 groupId?: string;
135 groupName?: string;
136 containerId?: string;
137};
138export declare type Group = {
139 name?: string;
140 id?: string;
141};
142export declare type ContainerQuery = {
143 contactId?: string;
144 groupId?: string;
145 containerId?: string | string[];
146};
147export declare type Container = {
148 name: string;
149 id: string;
150 type: ContainerType;
151};
152export { PermissionStatus, PermissionResponse };
153/**
154 * Returns whether the Contacts API is enabled on the current device. This does not check the app permissions.
155 *
156 * @returns Async `boolean`, indicating whether the Contacts API is available on the current device. Currently this resolves to `true` on iOS and Android only.
157 */
158export declare function isAvailableAsync(): Promise<boolean>;
159export declare function shareContactAsync(contactId: string, message: string, shareOptions?: object): Promise<any>;
160export declare function getContactsAsync(contactQuery?: ContactQuery): Promise<ContactResponse>;
161export declare function getPagedContactsAsync(contactQuery?: ContactQuery): Promise<ContactResponse>;
162export declare function getContactByIdAsync(id: string, fields?: FieldType[]): Promise<Contact | undefined>;
163export declare function addContactAsync(contact: Contact, containerId?: string): Promise<string>;
164export declare function updateContactAsync(contact: Contact): Promise<string>;
165export declare function removeContactAsync(contactId: string): Promise<any>;
166export declare function writeContactToFileAsync(contactQuery?: ContactQuery): Promise<string | undefined>;
167export declare function presentFormAsync(contactId?: string | null, contact?: Contact | null, formOptions?: FormOptions): Promise<any>;
168export declare function addExistingGroupToContainerAsync(groupId: string, containerId: string): Promise<any>;
169export declare function createGroupAsync(name?: string, containerId?: string): Promise<string>;
170export declare function updateGroupNameAsync(groupName: string, groupId: string): Promise<any>;
171export declare function removeGroupAsync(groupId: string): Promise<any>;
172export declare function addExistingContactToGroupAsync(contactId: string, groupId: string): Promise<any>;
173export declare function removeContactFromGroupAsync(contactId: string, groupId: string): Promise<any>;
174export declare function getGroupsAsync(groupQuery: GroupQuery): Promise<Group[]>;
175export declare function getDefaultContainerIdAsync(): Promise<string>;
176export declare function getContainersAsync(containerQuery: ContainerQuery): Promise<Container[]>;
177export declare function getPermissionsAsync(): Promise<PermissionResponse>;
178export declare function requestPermissionsAsync(): Promise<PermissionResponse>;
179export declare const PHONE_NUMBERS = "phoneNumbers";
180export declare const EMAILS = "emails";
181export declare const ADDRESSES = "addresses";
182export declare const IMAGE = "image";
183export declare const RAW_IMAGE = "rawImage";
184export declare const NOTE = "note";
185export declare const BIRTHDAY = "birthday";
186export declare const NON_GREGORIAN_BIRTHDAY = "nonGregorianBirthday";
187export declare const NAME_PREFIX = "namePrefix";
188export declare const NAME_SUFFIX = "nameSuffix";
189export declare const PHONETIC_FIRST_NAME = "phoneticFirstName";
190export declare const PHONETIC_MIDDLE_NAME = "phoneticMiddleName";
191export declare const PHONETIC_LAST_NAME = "phoneticLastName";
192export declare const SOCIAL_PROFILES = "socialProfiles";
193export declare const IM_ADDRESSES = "instantMessageAddresses";
194export declare const URLS = "urlAddresses";
195export declare const DATES = "dates";
196export declare const RAW_DATES = "rawDates";
197export declare const RELATIONSHIPS = "relationships";
198export declare const Fields: {
199 ID: string;
200 ContactType: string;
201 Name: string;
202 FirstName: string;
203 MiddleName: string;
204 LastName: string;
205 MaidenName: string;
206 NamePrefix: string;
207 NameSuffix: string;
208 Nickname: string;
209 PhoneticFirstName: string;
210 PhoneticMiddleName: string;
211 PhoneticLastName: string;
212 Birthday: string;
213 NonGregorianBirthday: string;
214 Emails: string;
215 PhoneNumbers: string;
216 Addresses: string;
217 SocialProfiles: string;
218 InstantMessageAddresses: string;
219 UrlAddresses: string;
220 Company: string;
221 JobTitle: string;
222 Department: string;
223 ImageAvailable: string;
224 Image: string;
225 RawImage: string;
226 ExtraNames: string;
227 Note: string;
228 Dates: string;
229 Relationships: string;
230};
231export declare const CalendarFormats: {
232 Gregorian: string;
233 Buddhist: string;
234 Chinese: string;
235 Coptic: string;
236 EthiopicAmeteMihret: string;
237 EthiopicAmeteAlem: string;
238 Hebrew: string;
239 ISO8601: string;
240 Indian: string;
241 Islamic: string;
242 IslamicCivil: string;
243 Japanese: string;
244 Persian: string;
245 RepublicOfChina: string;
246 IslamicTabular: string;
247 IslamicUmmAlQura: string;
248};
249export declare const ContainerTypes: {
250 Local: string;
251 Exchange: string;
252 CardDAV: string;
253 Unassigned: string;
254};
255export declare const SortTypes: {
256 UserDefault: string;
257 FirstName: string;
258 LastName: string;
259 None: string;
260};
261export declare const ContactTypes: {
262 Person: string;
263 Company: string;
264};