-
Notifications
You must be signed in to change notification settings - Fork 5
/
api.json
721 lines (712 loc) · 28.4 KB
/
api.json
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
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
{
"globalm": {
"attribute": [
]
},
"folder": {
"attribute": [
{
"name": "ME",
"return_type": "Contact",
"description": "Return my Contact object",
"example": ""
}
],
"method": [
{
"name": "create_draft",
"return_type": "",
"return_href": "",
"params": "subject='', to=[], cc=[], bcc=[], content=''",
"description": "Create a draft message and save it to your draft folder",
"example": ["def on_deadline(my_message):", "\tif 'weekly meeting' in my_message.subject:", "\t\tcreate_draft('Schedule meeting next Monday', my_messsage.to, my_message.cc, 'coworker@mit.edu')"]
},
{
"name": "create_folder",
"return_type": "",
"return_href": "",
"params": "folder_name",
"description": "Create a new folder folder_name",
"example": ""
},
{
"name": "delete_folder",
"return_type": "",
"return_href": "",
"params": "folder_name",
"description": "Delete a folder folder_name",
"example": ""
},
{
"name": "get_current_events",
"return_type": "list",
"params": "",
"description": "Get calendar events happening right now, if any",
"example": ""
},
{
"name": "get_upcoming_events",
"return_type": "list",
"params": "",
"description": "Get upcoming calendar events, if any",
"example": ""
},
{
"name": "get_email_mode",
"return_type": "integer",
"params": "",
"description": "Return the index of the current email mode.",
"example": "",
"related": [{
"name": "set_email_mode"
}]
},
{
"name": "set_email_mode",
"return_type": "",
"params": "mode_index",
"description": "Set the current email mode",
"example": "",
"related": [{
"name": "get_email_mode"
}]
},
{
"name": "list_folders",
"return_type": "",
"return_href": "",
"params": "",
"description": "Get a list of folders",
"example": ["print list_folders()", ">>> [(('\\HasNoChildren',), '/', u'Boomerang'), (('\\HasChildren',), '/', u'Boomerang-Outbox'), (('\\HasNoChildren',), '/', u'Boomerang-Outbox/Cancelled'), (('\\HasNoChildren',), '/', u'Boomerang-Returned'), (('\\HasNoChildren',), '/', u'INBOX'), (('\\HasChildren', '\\Noselect'), '/', u'[Gmail]'), (('\\All', '\\HasNoChildren'), '/', u'[Gmail]/All Mail'), (('\\Drafts', '\\HasNoChildren'), '/', u'[Gmail]/Drafts'), (('\\HasNoChildren', '\\Important'), '/', u'[Gmail]/Important'), (('\\HasNoChildren', '\\Sent'), '/', u'[Gmail]/Sent Mail'), (('\\HasNoChildren', '\\Junk'), '/', u'[Gmail]/Spam'), (('\\Flagged', '\\HasNoChildren'), '/', u'[Gmail]/Starred'), (('\\HasNoChildren', '\\Trash')]"]
},
{
"name": "rename_folder",
"return_type": "",
"return_href": "",
"params": "old_name, new_name",
"description": "Change the name of a folder",
"example": ""
}
]
},
"message": {
"attribute": [{
"name": "to",
"return_type": "Contact []",
"return_href": "contact",
"description": "Get the Contacts the message is addressed to. Return a list of Contact objects",
"example": [
"print (new_message.to) # [<Contact object- David Karger>, <Contact object- Soya Park>]",
">>> ['David Karger', 'Soya Park']"
]
},
{
"name": "bcc",
"return_type": "Contact []",
"return_href": "contact",
"description": "Get the Contacts the message is bcced to. Return a list of Contact objects",
"example": ""
},
{
"name": "cc",
"return_type": "Contact []",
"return_href": "contact",
"description": "Get the Contacts the message is cced to. Return a list of Contact objects",
"example": ""
},
{
"name": "sender",
"return_type": "Contact",
"return_href": "contact",
"description": "Get the Contact the message is addressed from. Return a Contact object",
"example": ""
},
{
"name": "subject",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "recipients",
"return_type": "Contact []",
"description": "Returns the people in the to field, cc field, and bcc field. Return a list of Contact objects",
"example": ""
},
{
"name": "date",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "content",
"return_type": "string",
"description": "Get the content of the message. Returns a dictionary contains keys \"text\" and \"html\". See also contains() and extract_response()",
"example": ""
},
{
"name": "flags",
"return_type": "string []",
"description": "",
"example": "",
"related": [{
"name": "add_flags"
},
{
"name": "has_flag"
},
{
"name": "remove_flags"
}
]
},
{
"name": "thread",
"return_type": "t.List[Message]",
"description": "Return a list of Message objects in this thread",
"example": ""
},
{
"name": "progress",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "deadline",
"return_type": "datetime",
"description": "",
"example": ""
},
{
"name": "category",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "topic",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "task",
"return_type": "string",
"description": "",
"example": ""
}
],
"method": [
{
"name": "add_labels",
"params": "labels",
"description": "Add each of the label in a list of flags to the message",
"example": ""
},
{
"name": "has_label",
"params": "label",
"description": "Check if the message has a given label",
"example": ""
},
{
"name": "remove_labels",
"params": "labels",
"description": "Remove each of the flags in a list of labels from the message",
"example": ""
},
{
"name": "aggregate_response",
"params": "",
"description": "Aggregate response of messages in this thread and return a list of pairs of sender and their response",
"example": ""
},
{
"name": "copy",
"params": "dst_folder",
"description": "Copy this email from the current folder to dst_folder. If folder dst_folder does not exist, our engine creates a new folder with the name dst_folder",
"example": ""
},
{
"name": "contains",
"params": "string",
"description": "check if a string is contained in the content of a message",
"example": ""
},
{
"name": "delete",
"params": "",
"description": "Move this message to a trash folder",
"example": ""
},
{
"name": "extract_response",
"params": "",
"description": "For the thread messages, only take out a body of *this message* without previous headers and contetns",
"example": ""
},
{
"name": "extract_time_entity",
"params": "",
"description": "Return any time entity (e.g., tomorrow, 3/24 2pm) mentioned in this message body using NLP ",
"example": ""
},
{
"name": "forward",
"params": "to=[], cc=[], bcc=[], subject='', content=''",
"description": "Forward this email to the given recipients.",
"example": ""
},
{
"name": "is_read",
"params": "",
"return_type": "bool",
"description": "Get if the message has been read",
"example": "",
"related": [{
"name": "mark_read"
},
{
"name": "mark_unread"
},
{
"name": "remove_flags"
}
]
},
{
"name": "is_recent",
"params": "",
"return_type": "bool",
"description": "Get if the message is recent",
"example": "",
"related": []
},
{
"name": "mark_read",
"params": "",
"description": "",
"example": "",
"related": [{
"name": "is_read"
},
{
"name": "mark_unread"
}
]
},
{
"name": "mark_unread",
"params": "",
"description": "",
"example": "",
"related": [{
"name": "is_read"
},
{
"name": "mark_read"
}
]
},
{
"name": "move",
"params": "dst_folder",
"description": "Move this email to dst_folder.",
"example": [
"msg.move('conference')"
]
},
{
"name": "on_time",
"params": "handler, when",
"description": "Run the handler when the time is up.",
"example": ""
},
{
"name": "on_response",
"params": "handler",
"description": "Message method- Run the handler when there is new response arrived on this message thread",
"example": ""
},
{
"name": "recent_messages",
"params": "N=3",
"return_type": "Message []",
"description": "Message method- Return previous messages in this message thread.",
"example": []
},
{
"name": "reply",
"params": "content, to=[], cc=[], bcc=[]",
"description": "Reply to the sender and additional recipients.",
"example": []
},
{
"name": "reply_all",
"params": "address, to=[], cc=[], bcc=[]",
"description": "Reply all to the sender & recipients and additional recipients",
"example": []
},
{
"name": "see_later",
"params": "later_at=60, hide_in='YoUPS see_later'",
"description": "Hide temporarily this message into a designated folder (hide_in) then move back to the orginal folder. later_at could be a definite time (datetime instance) or a relative time (number in minute)",
"example": []
}
]
},
"contact": {
"attribute": [{
"name": "name",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "email",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "organization",
"return_type": "string",
"description": "",
"example": ""
},
{
"name": "geolocation",
"return_type": "string",
"description": "",
"example": ""
}
],
"method": [
{
"name": "messages",
"params": "N=3",
"return_type": "Message []",
"description": "Contact method- Return the messages where this contact is listed in the from/to/cc/bcc field",
"example": []
},
{
"name": "messages_bcc",
"params": "N=3",
"return_type": "Message []",
"description": "Contact method- Return the messages where this contact is listed in the bcc field",
"example": []
},
{
"name": "messages_cc",
"params": "N=3",
"return_type": "Message []",
"description": "Contact method- Return the messages where this contact is listed in the cc field",
"example": []
},
{
"name": "messages_from",
"params": "N=3",
"return_type": "Message []",
"description": "Contact method- Return the messages where this contact is listed in the from field",
"example": []
},
{
"name": "messages_to",
"params": "N=3",
"return_type": "Message []",
"description": "Contact method- Return the messages where this contact is listed in the to field",
"example": []
},
{
"name": "on_message",
"params": "handler",
"description": "Contact method- Run the handler when there is new response arrived from this contact",
"example": ""
}]
},
"getter_archieve": [{
"name": "get_content",
"params": "",
"description": "Return contents of this email / thread. \n\n Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": "",
"thread": "get_contents",
"thread_params": "cond = True"
},
{
"name": "get_date",
"params": "",
"description": "Return arrival date of this email / thread. <br>Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": [
"print get_date()",
">>> ['Wed, 29 Aug 2018 01:59:59 -0400']",
" ",
"print get_dates()",
">>> ['Wed, 29 Aug 2018 00:23:12 -0400', 'Wed, 29 Aug 2018 01:01:03 -0400', 'Wed, 29 Aug 2018 01:59:59 -0400']"
],
"thread": "get_dates",
"thread_params": "cond = True"
},
{
"name": "get_gmail_labels",
"params": "",
"description": "Return a list of notes of this email / thread. <br>Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": "",
"thread": "get_notes",
"thread_params": "cond = True"
},
{
"name": "get_note",
"params": "",
"description": "Return a list of notes of this email / thread. <br>Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": "",
"thread": "get_notes",
"thread_params": "cond = True"
},
{
"name": "get_sender",
"params": "",
"description": "Return a sender of this email / thread. <br>Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": [
"print get_sender()",
">>> ['Soya Park <soya@mit.edu>']",
" ",
"def only_important():",
" if 'important' in get_note():",
" return True",
" return False",
"print get_senders( cond = only_important )",
">>> [['David Karger <david@mit.edu>'], ['David Karger <david@mit.edu>']]"
],
"thread": "get_senders",
"thread_params": "cond = True"
},
{
"name": "get_subject",
"params": "",
"description": "Return a subject of this email / thread. <br>Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": "",
"thread": "get_subjects",
"thread_params": "cond = True"
},
{
"name": "get_recipient",
"params": "",
"description": "Return a list of recipients of this email. <br>Developers can selectively retrieve some emails of the thread by using parameter cond. cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails in the thread.",
"example": [
"print get_recipient()",
">>> ['Soya Park <soya@mit.edu>', 'Amy Zhang <zhang@mit.edu>']",
"print get_recipients()",
">>> [['Soya Park <soya@mit.edu>'], ['David Karger <david@mit.edu>', 'Amy Zhang <zhang@mit.edu>'], ['Soya Park <soya@mit.edu>', 'Amy Zhang <zhang@mit.edu>']]"
],
"thread": "get_recipients",
"thread_params": "cond = True"
}
],
"getter": [{
"name": "get_content",
"params": "",
"description": "Return a content of this email.",
"example": "",
"thread": "get_contents",
"thread_params": "cond = True"
},
{
"name": "get_date",
"params": "",
"description": "Return an arrival date of this email.",
"example": [
"print get_date()",
">>> ['Wed, 29 Aug 2018 01:59:59 -0400']"
],
"thread": "get_dates",
"thread_params": "cond = True"
},
{
"name": "get_gmail_labels",
"params": "",
"description": "Return a list of labels of this email.",
"example": "",
"thread": "get_notes",
"thread_params": "cond = True"
},
{
"name": "get_labels",
"params": "",
"description": "Return a list of notes of this email.",
"example": "",
"thread": "get_notes",
"thread_params": "cond = True"
},
{
"name": "get_sender",
"params": "",
"description": "Return a sender of this email.",
"example": [
"print get_sender()",
">>> ['Soya Park <soya@mit.edu>']"
],
"thread": "get_senders",
"thread_params": "cond = True"
},
{
"name": "get_subject",
"params": "",
"description": "Return a subject of this email.",
"example": "",
"thread": "get_subjects",
"thread_params": "cond = True"
},
{
"name": "get_recipients",
"params": "",
"description": "Return a list of recipients of this email.",
"example": [
"print get_recipients()",
">>> ['Soya Park <soya@mit.edu>', 'Amy Zhang <zhang@mit.edu>']"
],
"thread": "get_recipients",
"thread_params": "cond = True"
}
],
"mode": [{
"name": "get_history",
"params": "email, hours = 24, cond = True",
"description": "Get an interaction history with this recipient. To specify the range of time, set parameter hours. Parameter cond should be a callable that returns boolean. Default value of cond is True and it will retrieve from all emails exchanged with a contact of the email.",
"example": [
"def draft_email(email):",
" if 'draft' in email.get_labels():",
" return True",
" return False",
"",
"print get_history('soya@mit.edu', 3, draft_email) ",
">>> {'received_emails': 5, 'cond': 2}"
]
},
{
"name": "get_mode",
"params": "",
"description": "Get an index of a current email mode",
"example": ""
},
{
"name": "set_mode",
"params": "mode_index",
"description": "Change a current email mode",
"example": ""
}
],
"methods": [{
"name": "add_gmail_labels",
"params": "labels",
"description": "Add labels to email in the current folder.",
"example": [
"add_gmail_labels([“important”, “deadline”])"
],
"thread": "add_labels",
"thread_params": "flags, cond = True"
},
{
"name": "add_labels",
"params": "labels",
"description": "Add note to email in the currently folder.",
"example": [
"add_labels([“important”, “deadline”])"
],
"thread": "add_notes",
"thread_params": "flags, cond = True"
},
{
"name": "remove_gmail_labels",
"params": "labels",
"description": "Remove one or more labels from this email in the currently selected folder. labels should be a list of strings.",
"example": "",
"thread": "remove_notes",
"thread_params": "flags, cond = True"
},
{
"name": "remove_labels",
"params": "labels",
"description": "Remove one or more labels from this email in the currently selected folder. labels should be a list of strings.",
"example": "",
"thread": "remove_notes",
"thread_params": "flags, cond = True"
},
{
"name": "send",
"params": "subject, recipient_address, body",
"description": "send an email",
"example": "",
"thread": "remove_notes",
"thread_params": "flags, cond = True"
}
],
"calendar": {
"init": [{
"name": "Calendar",
"params": "name, link, apple=False",
"return_type": "Calendar",
"return_href": "Calendar",
"example": [
"name = 'Classes'",
"link = 'https://calendar.google.com/calendar/ical/<CALENDAR ID>/myclasses.ics'",
"classes = Calendar(name, link)"
]
}],
"attribute": [{
"name": "name",
"return_type": "string",
"description": "name of the calendar"
},
{
"name": "link",
"return_type": "string",
"description": "link to .ics file for calendar"
}
],
"method": [{
"name": "get_conflicts",
"params": "startTime=datetime.datetime.now(), endTime=None, defaultInterval=datetime.timedelta(hours=1)",
"return_type": "dict",
"description": "Get list of conflicting events on calendar between startTime and endTime. By default it will get all conflicts from now to an hour from now. If you specify just a start time, it will look from the start time to an hour after the start time.",
"example": [
"classes = Calendar(name, link)",
"start = datetime.datetime(2019, 3, 18, hour=10, minute=30)",
"end = datetime.datetime(2019, 3, 18, hour=11, minute=30)",
"conflicts = classes.get_conflicts(startTime=start, endTime=end)",
"print(conflicts)",
">>> [",
">>> {",
">>> 'start': datetime.datetime(2019, 3, 18, 11, 0, tzinfo=tzfile('/usr/share/zoneinfo/America/New_York')), ",
">>> 'location': '34-101', ",
">>> 'end': datetime.datetime(2019, 3, 18, 12, 30, tzinfo=tzfile('/usr/share/zoneinfo/America/New_York')), ",
">>> 'name': '6.031 Lecture', ",
">>> 'description': 'Introduces fundamental principles and techniques of software development.'",
">>> }, ",
">>> {",
">>> 'start': datetime.datetime(2019, 3, 18, 10, 0, tzinfo=tzfile('/usr/share/zoneinfo/America/New_York')), ",
">>> 'location': '34-101', ",
">>> 'end': datetime.datetime(2019, 3, 18, 11, 0, tzinfo=tzfile('/usr/share/zoneinfo/America/New_York')), ",
">>> 'name': '6.UAT Lecture', ",
">>> 'description': 'Provides instruction in aspects of effective technical oral presentations and exposure to communication skills useful in a workplace setting.'",
">>> }",
">>> ]"
]
},
{
"name": "create_event",
"params": "name, startTime, endTime=None, description='', location='', path=''",
"return_type": "string",
"description": "Create a new .ics file with the specified event. Returns the string of the ics file",
"example": [
"startTime = datetime.datetime(2019, 3, 4, hour=14, minute=0, tzinfo=tz)",
"endTime = datetime.datetime(2019, 3, 4, hour=15, minute=0, tzinfo=tz)",
"name = cal.create_event('Available', startTime, endTime)",
"print(name)",
">>> Available-2019-04-18 15:41:33.570990.ics"
]
}
]
}
}