forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
google-apps-script.contacts.d.ts
299 lines (280 loc) · 10.7 KB
/
google-apps-script.contacts.d.ts
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
// Type definitions for Google Apps Script 2015-11-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare module GoogleAppsScript {
export module Contacts {
/**
* Address field in a contact.
*/
export interface AddressField {
deleteAddressField(): void;
getAddress(): string;
getLabel(): Object;
isPrimary(): boolean;
setAddress(address: string): AddressField;
setAsPrimary(): AddressField;
setLabel(field: Field): AddressField;
setLabel(label: string): AddressField;
}
/**
* Company field in a Contact.
*/
export interface CompanyField {
deleteCompanyField(): void;
getCompanyName(): string;
getJobTitle(): string;
isPrimary(): boolean;
setAsPrimary(): CompanyField;
setCompanyName(company: string): CompanyField;
setJobTitle(title: string): CompanyField;
}
/**
* A Contact contains the name, address, and various contact details of a contact.
*/
export interface Contact {
addAddress(label: Object, address: string): AddressField;
addCompany(company: string, title: string): CompanyField;
addCustomField(label: Object, content: Object): CustomField;
addDate(label: Object, month: Base.Month, day: Integer, year: Integer): DateField;
addEmail(label: Object, address: string): EmailField;
addIM(label: Object, address: string): IMField;
addPhone(label: Object, number: string): PhoneField;
addToGroup(group: ContactGroup): Contact;
addUrl(label: Object, url: string): UrlField;
deleteContact(): void;
getAddresses(): AddressField[];
getAddresses(label: Object): AddressField[];
getCompanies(): CompanyField[];
getContactGroups(): ContactGroup[];
getCustomFields(): CustomField[];
getCustomFields(label: Object): CustomField[];
getDates(): DateField[];
getDates(label: Object): DateField[];
getEmails(): EmailField[];
getEmails(label: Object): EmailField[];
getFamilyName(): string;
getFullName(): string;
getGivenName(): string;
getIMs(): IMField[];
getIMs(label: Object): IMField[];
getId(): string;
getInitials(): string;
getLastUpdated(): Date;
getMaidenName(): string;
getMiddleName(): string;
getNickname(): string;
getNotes(): string;
getPhones(): PhoneField[];
getPhones(label: Object): PhoneField[];
getPrefix(): string;
getPrimaryEmail(): string;
getShortName(): string;
getSuffix(): string;
getUrls(): UrlField[];
getUrls(label: Object): UrlField[];
removeFromGroup(group: ContactGroup): Contact;
setFamilyName(familyName: string): Contact;
setFullName(fullName: string): Contact;
setGivenName(givenName: string): Contact;
setInitials(initials: string): Contact;
setMaidenName(maidenName: string): Contact;
setMiddleName(middleName: string): Contact;
setNickname(nickname: string): Contact;
setNotes(notes: string): Contact;
setPrefix(prefix: string): Contact;
setShortName(shortName: string): Contact;
setSuffix(suffix: string): Contact;
getEmailAddresses(): String[];
getHomeAddress(): string;
getHomeFax(): string;
getHomePhone(): string;
getMobilePhone(): string;
getPager(): string;
getUserDefinedField(key: string): string;
getUserDefinedFields(): Object;
getWorkAddress(): string;
getWorkFax(): string;
getWorkPhone(): string;
setHomeAddress(addr: string): void;
setHomeFax(phone: string): void;
setHomePhone(phone: string): void;
setMobilePhone(phone: string): void;
setPager(phone: string): void;
setPrimaryEmail(primaryEmail: string): void;
setUserDefinedField(key: string, value: string): void;
setUserDefinedFields(o: Object): void;
setWorkAddress(addr: string): void;
setWorkFax(phone: string): void;
setWorkPhone(phone: string): void;
}
/**
* A ContactGroup is is a group of contacts.
*/
export interface ContactGroup {
addContact(contact: Contact): ContactGroup;
deleteGroup(): void;
getContacts(): Contact[];
getId(): string;
getName(): string;
isSystemGroup(): boolean;
removeContact(contact: Contact): ContactGroup;
setName(name: string): ContactGroup;
getGroupName(): string;
setGroupName(name: string): void;
}
/**
* This class allows users to access their own Google Contacts and create, remove, and update
* contacts listed therein.
*/
export interface ContactsApp {
ExtendedField: ExtendedField
Field: Field
Gender: Gender
Month: Base.Month
Priority: Priority
Sensitivity: Sensitivity
createContact(givenName: string, familyName: string, email: string): Contact;
createContactGroup(name: string): ContactGroup;
deleteContact(contact: Contact): void;
deleteContactGroup(group: ContactGroup): void;
getContact(emailAddress: string): Contact;
getContactById(id: string): Contact;
getContactGroup(name: string): ContactGroup;
getContactGroupById(id: string): ContactGroup;
getContactGroups(): ContactGroup[];
getContacts(): Contact[];
getContactsByAddress(query: string): Contact[];
getContactsByAddress(query: string, label: Field): Contact[];
getContactsByAddress(query: string, label: string): Contact[];
getContactsByCompany(query: string): Contact[];
getContactsByCustomField(query: Object, label: ExtendedField): Contact[];
getContactsByDate(month: Base.Month, day: Integer, label: Field): Contact[];
getContactsByDate(month: Base.Month, day: Integer, year: Integer, label: Field): Contact[];
getContactsByDate(month: Base.Month, day: Integer, year: Integer, label: string): Contact[];
getContactsByDate(month: Base.Month, day: Integer, label: string): Contact[];
getContactsByEmailAddress(query: string): Contact[];
getContactsByEmailAddress(query: string, label: Field): Contact[];
getContactsByEmailAddress(query: string, label: string): Contact[];
getContactsByGroup(group: ContactGroup): Contact[];
getContactsByIM(query: string): Contact[];
getContactsByIM(query: string, label: Field): Contact[];
getContactsByIM(query: string, label: string): Contact[];
getContactsByJobTitle(query: string): Contact[];
getContactsByName(query: string): Contact[];
getContactsByName(query: string, label: Field): Contact[];
getContactsByNotes(query: string): Contact[];
getContactsByPhone(query: string): Contact[];
getContactsByPhone(query: string, label: Field): Contact[];
getContactsByPhone(query: string, label: string): Contact[];
getContactsByUrl(query: string): Contact[];
getContactsByUrl(query: string, label: Field): Contact[];
getContactsByUrl(query: string, label: string): Contact[];
findByEmailAddress(email: string): Contact;
findContactGroup(name: string): ContactGroup;
getAllContacts(): Contact[];
}
/**
* A custom field in a Contact.
*/
export interface CustomField {
deleteCustomField(): void;
getLabel(): Object;
getValue(): Object;
setLabel(field: ExtendedField): CustomField;
setLabel(label: string): CustomField;
setValue(value: Object): CustomField;
}
/**
* A date field in a Contact.
*/
export interface DateField {
deleteDateField(): void;
getDay(): Integer;
getLabel(): Object;
getMonth(): Base.Month;
getYear(): Integer;
setDate(month: Base.Month, day: Integer): DateField;
setDate(month: Base.Month, day: Integer, year: Integer): DateField;
setLabel(label: Field): DateField;
setLabel(label: string): DateField;
}
/**
* An email field in a Contact.
*/
export interface EmailField {
deleteEmailField(): void;
getAddress(): string;
getDisplayName(): string;
getLabel(): Object;
isPrimary(): boolean;
setAddress(address: string): EmailField;
setAsPrimary(): EmailField;
setDisplayName(name: string): EmailField;
setLabel(field: Field): EmailField;
setLabel(label: string): EmailField;
}
/**
* An enum for extended contacts fields.
*/
export enum ExtendedField { HOBBY, MILEAGE, LANGUAGE, GENDER, BILLING_INFORMATION, DIRECTORY_SERVER, SENSITIVITY, PRIORITY, HOME, WORK, USER, OTHER }
/**
* An enum for contacts fields.
*/
export enum Field { FULL_NAME, GIVEN_NAME, MIDDLE_NAME, FAMILY_NAME, MAIDEN_NAME, NICKNAME, SHORT_NAME, INITIALS, PREFIX, SUFFIX, HOME_EMAIL, WORK_EMAIL, BIRTHDAY, ANNIVERSARY, HOME_ADDRESS, WORK_ADDRESS, ASSISTANT_PHONE, CALLBACK_PHONE, MAIN_PHONE, PAGER, HOME_FAX, WORK_FAX, HOME_PHONE, WORK_PHONE, MOBILE_PHONE, GOOGLE_VOICE, NOTES, GOOGLE_TALK, AIM, YAHOO, SKYPE, QQ, MSN, ICQ, JABBER, BLOG, FTP, PROFILE, HOME_PAGE, WORK_WEBSITE, HOME_WEBSITE, JOB_TITLE, COMPANY }
/**
* An enum for contact gender.
*/
export enum Gender { MALE, FEMALE }
/**
* An instant messaging field in a Contact.
*/
export interface IMField {
deleteIMField(): void;
getAddress(): string;
getLabel(): Object;
isPrimary(): boolean;
setAddress(address: string): IMField;
setAsPrimary(): IMField;
setLabel(field: Field): IMField;
setLabel(label: string): IMField;
}
/**
* A phone number field in a Contact.
*/
export interface PhoneField {
deletePhoneField(): void;
getLabel(): Object;
getPhoneNumber(): string;
isPrimary(): boolean;
setAsPrimary(): PhoneField;
setLabel(field: Field): PhoneField;
setLabel(label: string): PhoneField;
setPhoneNumber(number: string): PhoneField;
}
/**
* An enum for contact priority.
*/
export enum Priority { HIGH, LOW, NORMAL }
/**
* An enum for contact sensitivity.
*/
export enum Sensitivity { CONFIDENTIAL, NORMAL, PERSONAL, PRIVATE }
/**
* A URL field in a Contact.
*/
export interface UrlField {
deleteUrlField(): void;
getAddress(): string;
getLabel(): Object;
isPrimary(): boolean;
setAddress(address: string): UrlField;
setAsPrimary(): UrlField;
setLabel(field: Field): UrlField;
setLabel(label: string): UrlField;
}
}
}
declare var ContactsApp: GoogleAppsScript.Contacts.ContactsApp;