+1
-1
bin/fastmail_list.ml
+1
-1
bin/fastmail_list.ml
+23
-66
lib/jmap_mail.ml
+23
-66
lib/jmap_mail.ml
···
2
3
(** Module for managing JMAP Mail-specific capability URIs *)
4
module Capability = struct
5
-
(** Mail capability types *)
6
-
type mail = Mail
7
-
8
(** Mail capability URI *)
9
let mail_uri = "urn:ietf:params:jmap:mail"
10
11
-
(** Convert mail capability to URI string *)
12
-
let string_of_mail = function
13
-
| Mail -> mail_uri
14
-
15
-
(** Parse a string to mail capability *)
16
-
let mail_of_string = function
17
-
| s when s = mail_uri -> Some Mail
18
-
| _ -> None
19
-
20
-
(** Submission capability types *)
21
-
type submission = Submission
22
-
23
(** Submission capability URI *)
24
let submission_uri = "urn:ietf:params:jmap:submission"
25
26
-
(** Convert submission capability to URI string *)
27
-
let string_of_submission = function
28
-
| Submission -> submission_uri
29
-
30
-
(** Parse a string to submission capability *)
31
-
let submission_of_string = function
32
-
| s when s = submission_uri -> Some Submission
33
-
| _ -> None
34
-
35
-
(** Vacation response capability types *)
36
-
type vacation_response = VacationResponse
37
-
38
(** Vacation response capability URI *)
39
let vacation_response_uri = "urn:ietf:params:jmap:vacationresponse"
40
41
-
(** Convert vacation response capability to URI string *)
42
-
let string_of_vacation_response = function
43
-
| VacationResponse -> vacation_response_uri
44
-
45
-
(** Parse a string to vacation response capability *)
46
-
let vacation_response_of_string = function
47
-
| s when s = vacation_response_uri -> Some VacationResponse
48
-
| _ -> None
49
-
50
(** All mail extension capability types *)
51
type t =
52
-
| Mail of mail
53
-
| Submission of submission
54
-
| VacationResponse of vacation_response
55
-
| Extension of string
56
57
(** Convert capability to URI string *)
58
let to_string = function
59
-
| Mail m -> string_of_mail m
60
-
| Submission s -> string_of_submission s
61
-
| VacationResponse v -> string_of_vacation_response v
62
| Extension s -> s
63
64
(** Parse a string to a capability *)
65
let of_string s =
66
-
match mail_of_string s with
67
-
| Some m -> Mail m
68
-
| None ->
69
-
match submission_of_string s with
70
-
| Some s -> Submission s
71
-
| None ->
72
-
match vacation_response_of_string s with
73
-
| Some v -> VacationResponse v
74
-
| None -> Extension s
75
76
(** Check if a capability is a standard mail capability *)
77
let is_standard = function
78
-
| Mail _ | Submission _ | VacationResponse _ -> true
79
| Extension _ -> false
80
81
(** Check if a capability string is a standard mail capability *)
82
let is_standard_string s =
83
-
match of_string s with
84
-
| Extension _ -> false
85
-
| _ -> true
86
87
(** Create a list of capability strings *)
88
let strings_of_capabilities capabilities =
···
1297
let get_mailboxes conn ~account_id =
1298
let request = {
1299
using = [
1300
-
Jmap.Capability.to_string (Jmap.Capability.Core Core);
1301
-
Capability.to_string (Capability.Mail Mail)
1302
];
1303
method_calls = [
1304
{
···
1346
let get_mailbox conn ~account_id ~mailbox_id =
1347
let request = {
1348
using = [
1349
-
Jmap.Capability.to_string (Jmap.Capability.Core Core);
1350
-
Capability.to_string (Capability.Mail Mail)
1351
];
1352
method_calls = [
1353
{
···
1393
(* First query the emails in the mailbox *)
1394
let query_request = {
1395
using = [
1396
-
Jmap.Capability.to_string (Jmap.Capability.Core Core);
1397
-
Capability.to_string (Capability.Mail Mail)
1398
];
1399
method_calls = [
1400
{
···
1431
if List.length email_ids > 0 then
1432
let get_request = {
1433
using = [
1434
-
Jmap.Capability.to_string (Jmap.Capability.Core Core);
1435
-
Capability.to_string (Capability.Mail Mail)
1436
];
1437
method_calls = [
1438
{
···
1488
let get_email conn ~account_id ~email_id =
1489
let request = {
1490
using = [
1491
-
Jmap.Capability.to_string (Jmap.Capability.Core Core);
1492
-
Capability.to_string (Capability.Mail Mail)
1493
];
1494
method_calls = [
1495
{
···
2
3
(** Module for managing JMAP Mail-specific capability URIs *)
4
module Capability = struct
5
(** Mail capability URI *)
6
let mail_uri = "urn:ietf:params:jmap:mail"
7
8
(** Submission capability URI *)
9
let submission_uri = "urn:ietf:params:jmap:submission"
10
11
(** Vacation response capability URI *)
12
let vacation_response_uri = "urn:ietf:params:jmap:vacationresponse"
13
14
(** All mail extension capability types *)
15
type t =
16
+
| Mail (** Mail capability *)
17
+
| Submission (** Submission capability *)
18
+
| VacationResponse (** Vacation response capability *)
19
+
| Extension of string (** Custom extension *)
20
21
(** Convert capability to URI string *)
22
let to_string = function
23
+
| Mail -> mail_uri
24
+
| Submission -> submission_uri
25
+
| VacationResponse -> vacation_response_uri
26
| Extension s -> s
27
28
(** Parse a string to a capability *)
29
let of_string s =
30
+
if s = mail_uri then Mail
31
+
else if s = submission_uri then Submission
32
+
else if s = vacation_response_uri then VacationResponse
33
+
else Extension s
34
35
(** Check if a capability is a standard mail capability *)
36
let is_standard = function
37
+
| Mail | Submission | VacationResponse -> true
38
| Extension _ -> false
39
40
(** Check if a capability string is a standard mail capability *)
41
let is_standard_string s =
42
+
s = mail_uri || s = submission_uri || s = vacation_response_uri
43
44
(** Create a list of capability strings *)
45
let strings_of_capabilities capabilities =
···
1254
let get_mailboxes conn ~account_id =
1255
let request = {
1256
using = [
1257
+
Jmap.Capability.to_string Jmap.Capability.Core;
1258
+
Capability.to_string Capability.Mail
1259
];
1260
method_calls = [
1261
{
···
1303
let get_mailbox conn ~account_id ~mailbox_id =
1304
let request = {
1305
using = [
1306
+
Jmap.Capability.to_string Jmap.Capability.Core;
1307
+
Capability.to_string Capability.Mail
1308
];
1309
method_calls = [
1310
{
···
1350
(* First query the emails in the mailbox *)
1351
let query_request = {
1352
using = [
1353
+
Jmap.Capability.to_string Jmap.Capability.Core;
1354
+
Capability.to_string Capability.Mail
1355
];
1356
method_calls = [
1357
{
···
1388
if List.length email_ids > 0 then
1389
let get_request = {
1390
using = [
1391
+
Jmap.Capability.to_string Jmap.Capability.Core;
1392
+
Capability.to_string Capability.Mail
1393
];
1394
method_calls = [
1395
{
···
1445
let get_email conn ~account_id ~email_id =
1446
let request = {
1447
using = [
1448
+
Jmap.Capability.to_string Jmap.Capability.Core;
1449
+
Capability.to_string Capability.Mail
1450
];
1451
method_calls = [
1452
{
+4
-31
lib/jmap_mail.mli
+4
-31
lib/jmap_mail.mli
···
2
3
(** Module for managing JMAP Mail-specific capability URIs *)
4
module Capability : sig
5
-
(** Mail capability types *)
6
-
type mail = Mail
7
-
8
(** Mail capability URI *)
9
val mail_uri : string
10
11
-
(** Convert mail capability to URI string *)
12
-
val string_of_mail : mail -> string
13
-
14
-
(** Parse a string to mail capability *)
15
-
val mail_of_string : string -> mail option
16
-
17
-
(** Submission capability types *)
18
-
type submission = Submission
19
-
20
(** Submission capability URI *)
21
val submission_uri : string
22
23
-
(** Convert submission capability to URI string *)
24
-
val string_of_submission : submission -> string
25
-
26
-
(** Parse a string to submission capability *)
27
-
val submission_of_string : string -> submission option
28
-
29
-
(** Vacation response capability types *)
30
-
type vacation_response = VacationResponse
31
-
32
(** Vacation response capability URI *)
33
val vacation_response_uri : string
34
-
35
-
(** Convert vacation response capability to URI string *)
36
-
val string_of_vacation_response : vacation_response -> string
37
-
38
-
(** Parse a string to vacation response capability *)
39
-
val vacation_response_of_string : string -> vacation_response option
40
41
(** All mail extension capability types *)
42
type t =
43
-
| Mail of mail
44
-
| Submission of submission
45
-
| VacationResponse of vacation_response
46
-
| Extension of string
47
48
(** Convert capability to URI string *)
49
val to_string : t -> string
···
2
3
(** Module for managing JMAP Mail-specific capability URIs *)
4
module Capability : sig
5
(** Mail capability URI *)
6
val mail_uri : string
7
8
(** Submission capability URI *)
9
val submission_uri : string
10
11
(** Vacation response capability URI *)
12
val vacation_response_uri : string
13
14
(** All mail extension capability types *)
15
type t =
16
+
| Mail (** Mail capability *)
17
+
| Submission (** Submission capability *)
18
+
| VacationResponse (** Vacation response capability *)
19
+
| Extension of string (** Custom extension *)
20
21
(** Convert capability to URI string *)
22
val to_string : t -> string