···
1
-
(** Implementation of the JMAP Mail extension, as defined in RFC8621 *)
1
+
(** Implementation of the JMAP Mail extension, as defined in RFC8621
2
+
@see <https://datatracker.ietf.org/doc/html/rfc8621> RFC8621
4
+
This module implements the JMAP Mail specification, providing types and
5
+
functions for working with emails, mailboxes, threads, and other mail-related
6
+
objects in the JMAP protocol.
3
-
(** Module for managing JMAP Mail-specific capability URIs *)
9
+
(** Module for managing JMAP Mail-specific capability URIs as defined in RFC8621 Section 1.3
10
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3> RFC8621 Section 1.3
5
-
(** Mail capability URI *)
13
+
(** Mail capability URI as defined in RFC8621 Section 1.3
14
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
8
-
(** Submission capability URI *)
18
+
(** Submission capability URI as defined in RFC8621 Section 1.3
19
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
val submission_uri : string
11
-
(** Vacation response capability URI *)
23
+
(** Vacation response capability URI as defined in RFC8621 Section 1.3
24
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
val vacation_response_uri : string
14
-
(** All mail extension capability types *)
28
+
(** All mail extension capability types as defined in RFC8621 Section 1.3
29
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
16
-
| Mail (** Mail capability *)
17
-
| Submission (** Submission capability *)
18
-
| VacationResponse (** Vacation response capability *)
19
-
| Extension of string (** Custom extension *)
32
+
| Mail (** Mail capability for emails and mailboxes *)
33
+
| Submission (** Submission capability for sending emails *)
34
+
| VacationResponse (** Vacation response capability for auto-replies *)
35
+
| Extension of string (** Custom extension capabilities *)
21
-
(** Convert capability to URI string *)
37
+
(** Convert capability to URI string
38
+
@param capability The capability to convert
39
+
@return The full URI string for the capability
val to_string : t -> string
24
-
(** Parse a string to a capability *)
43
+
(** Parse a string to a capability
44
+
@param uri The capability URI string to parse
45
+
@return The parsed capability type
val of_string : string -> t
27
-
(** Check if a capability is a standard mail capability *)
49
+
(** Check if a capability is a standard mail capability
50
+
@param capability The capability to check
51
+
@return True if the capability is a standard JMAP Mail capability
val is_standard : t -> bool
30
-
(** Check if a capability string is a standard mail capability *)
55
+
(** Check if a capability string is a standard mail capability
56
+
@param uri The capability URI string to check
57
+
@return True if the string represents a standard JMAP Mail capability
val is_standard_string : string -> bool
33
-
(** Create a list of capability strings *)
61
+
(** Create a list of capability strings
62
+
@param capabilities List of capability types
63
+
@return List of capability URI strings
val strings_of_capabilities : t list -> string list
37
-
(** Types for the JMAP Mail extension *)
68
+
(** Types for the JMAP Mail extension as defined in RFC8621
69
+
@see <https://datatracker.ietf.org/doc/html/rfc8621>
41
-
(** {1 Mail capabilities} *)
74
+
(** {1 Mail capabilities}
75
+
Capability URIs for JMAP Mail extension as defined in RFC8621 Section 1.3
76
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
43
-
(** Capability URI for JMAP Mail*)
79
+
(** Capability URI for JMAP Mail as defined in RFC8621 Section 1.3
80
+
Identifies support for the Mail data model
81
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
val capability_mail : string
46
-
(** Capability URI for JMAP Submission *)
85
+
(** Capability URI for JMAP Submission as defined in RFC8621 Section 1.3
86
+
Identifies support for email submission
87
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
val capability_submission : string
49
-
(** Capability URI for JMAP Vacation Response *)
91
+
(** Capability URI for JMAP Vacation Response as defined in RFC8621 Section 1.3
92
+
Identifies support for vacation auto-reply functionality
93
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-1.3>
val capability_vacation_response : string
52
-
(** {1:mailbox Mailbox objects} *)
97
+
(** {1:mailbox Mailbox objects}
98
+
Mailbox types as defined in RFC8621 Section 2
99
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2>
54
-
(** A role for a mailbox. See RFC8621 Section 2. *)
102
+
(** A role for a mailbox as defined in RFC8621 Section 2.
103
+
Standardized roles for special mailboxes like Inbox, Sent, etc.
104
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2>
56
-
| All (** All mail *)
57
-
| Archive (** Archived mail *)
58
-
| Drafts (** Draft messages *)
59
-
| Flagged (** Starred/flagged mail *)
60
-
| Important (** Important mail *)
61
-
| Inbox (** Inbox *)
62
-
| Junk (** Spam/Junk mail *)
63
-
| Sent (** Sent mail *)
64
-
| Trash (** Deleted/Trash mail *)
65
-
| Unknown of string (** Server-specific roles *)
107
+
| All (** All mail mailbox *)
108
+
| Archive (** Archived mail mailbox *)
109
+
| Drafts (** Draft messages mailbox *)
110
+
| Flagged (** Starred/flagged mail mailbox *)
111
+
| Important (** Important mail mailbox *)
112
+
| Inbox (** Primary inbox mailbox *)
113
+
| Junk (** Spam/Junk mail mailbox *)
114
+
| Sent (** Sent mail mailbox *)
115
+
| Trash (** Deleted/Trash mail mailbox *)
116
+
| Unknown of string (** Server-specific custom roles *)
67
-
(** A mailbox (folder) in a mail account. See RFC8621 Section 2. *)
118
+
(** A mailbox (folder) in a mail account as defined in RFC8621 Section 2.
119
+
Represents an email folder or label in the account.
120
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2>
71
-
parent_id : id option;
72
-
role : mailbox_role option;
73
-
sort_order : unsigned_int;
74
-
total_emails : unsigned_int;
75
-
unread_emails : unsigned_int;
76
-
total_threads : unsigned_int;
77
-
unread_threads : unsigned_int;
78
-
is_subscribed : bool;
79
-
my_rights : mailbox_rights;
123
+
id : id; (** Server-assigned ID for the mailbox *)
124
+
name : string; (** User-visible name for the mailbox *)
125
+
parent_id : id option; (** ID of the parent mailbox, if any *)
126
+
role : mailbox_role option; (** The role of this mailbox, if it's a special mailbox *)
127
+
sort_order : unsigned_int; (** Position for mailbox in the UI *)
128
+
total_emails : unsigned_int; (** Total number of emails in the mailbox *)
129
+
unread_emails : unsigned_int; (** Number of unread emails in the mailbox *)
130
+
total_threads : unsigned_int; (** Total number of threads in the mailbox *)
131
+
unread_threads : unsigned_int; (** Number of threads with unread emails *)
132
+
is_subscribed : bool; (** Has the user subscribed to this mailbox *)
133
+
my_rights : mailbox_rights; (** Access rights for the user on this mailbox *)
82
-
(** Rights for a mailbox. See RFC8621 Section 2. *)
136
+
(** Rights for a mailbox as defined in RFC8621 Section 2.
137
+
Determines the operations a user can perform on a mailbox.
138
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2>
84
-
may_read_items : bool;
85
-
may_add_items : bool;
86
-
may_remove_items : bool;
87
-
may_set_seen : bool;
88
-
may_set_keywords : bool;
89
-
may_create_child : bool;
141
+
may_read_items : bool; (** Can the user read messages in this mailbox *)
142
+
may_add_items : bool; (** Can the user add messages to this mailbox *)
143
+
may_remove_items : bool; (** Can the user remove messages from this mailbox *)
144
+
may_set_seen : bool; (** Can the user mark messages as read/unread *)
145
+
may_set_keywords : bool; (** Can the user set keywords/flags on messages *)
146
+
may_create_child : bool; (** Can the user create child mailboxes *)
147
+
may_rename : bool; (** Can the user rename this mailbox *)
148
+
may_delete : bool; (** Can the user delete this mailbox *)
149
+
may_submit : bool; (** Can the user submit messages in this mailbox for delivery *)
95
-
(** Filter condition for mailbox queries. See RFC8621 Section 2.3. *)
152
+
(** Filter condition for mailbox queries as defined in RFC8621 Section 2.3.
153
+
Used to filter mailboxes in queries.
154
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.3>
type mailbox_filter_condition = {
97
-
parent_id : id option;
98
-
name : string option;
99
-
role : string option;
100
-
has_any_role : bool option;
101
-
is_subscribed : bool option;
157
+
parent_id : id option; (** Only include mailboxes with this parent *)
158
+
name : string option; (** Only include mailboxes with this name (case-insensitive substring match) *)
159
+
role : string option; (** Only include mailboxes with this role *)
160
+
has_any_role : bool option; (** If true, only include mailboxes with a role, if false those without *)
161
+
is_subscribed : bool option; (** If true, only include subscribed mailboxes, if false unsubscribed *)
164
+
(** Filter for mailbox queries as defined in RFC8621 Section 2.3.
165
+
Complex filter for Mailbox/query method.
166
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.3>
type mailbox_query_filter = [
105
-
| `And of mailbox_query_filter list
106
-
| `Or of mailbox_query_filter list
107
-
| `Not of mailbox_query_filter
108
-
| `Condition of mailbox_filter_condition
169
+
| `And of mailbox_query_filter list (** Logical AND of filters *)
170
+
| `Or of mailbox_query_filter list (** Logical OR of filters *)
171
+
| `Not of mailbox_query_filter (** Logical NOT of a filter *)
172
+
| `Condition of mailbox_filter_condition (** Simple condition filter *)
111
-
(** Mailbox/get request arguments. See RFC8621 Section 2.1. *)
175
+
(** Mailbox/get request arguments as defined in RFC8621 Section 2.1.
176
+
Used to fetch mailboxes by ID.
177
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.1>
type mailbox_get_arguments = {
114
-
ids : id list option;
115
-
properties : string list option;
180
+
account_id : id; (** The account to fetch mailboxes from *)
181
+
ids : id list option; (** The IDs of mailboxes to fetch, null means all *)
182
+
properties : string list option; (** Properties to return, null means all *)
118
-
(** Mailbox/get response. See RFC8621 Section 2.1. *)
185
+
(** Mailbox/get response as defined in RFC8621 Section 2.1.
186
+
Contains requested mailboxes.
187
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.1>
type mailbox_get_response = {
122
-
list : mailbox list;
123
-
not_found : id list;
190
+
account_id : id; (** The account from which mailboxes were fetched *)
191
+
state : string; (** A string representing the state on the server *)
192
+
list : mailbox list; (** The list of mailboxes requested *)
193
+
not_found : id list; (** IDs requested that could not be found *)
126
-
(** Mailbox/changes request arguments. See RFC8621 Section 2.2. *)
196
+
(** Mailbox/changes request arguments as defined in RFC8621 Section 2.2.
197
+
Used to get mailbox changes since a previous state.
198
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.2>
type mailbox_changes_arguments = {
129
-
since_state : string;
130
-
max_changes : unsigned_int option;
201
+
account_id : id; (** The account to get changes for *)
202
+
since_state : string; (** The previous state to compare to *)
203
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
133
-
(** Mailbox/changes response. See RFC8621 Section 2.2. *)
206
+
(** Mailbox/changes response as defined in RFC8621 Section 2.2.
207
+
Reports mailboxes that have changed since a previous state.
208
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.2>
type mailbox_changes_response = {
136
-
old_state : string;
137
-
new_state : string;
138
-
has_more_changes : bool;
141
-
destroyed : id list;
211
+
account_id : id; (** The account changes are for *)
212
+
old_state : string; (** The state provided in the request *)
213
+
new_state : string; (** The current state on the server *)
214
+
has_more_changes : bool; (** If true, more changes are available *)
215
+
created : id list; (** IDs of mailboxes created since old_state *)
216
+
updated : id list; (** IDs of mailboxes updated since old_state *)
217
+
destroyed : id list; (** IDs of mailboxes destroyed since old_state *)
144
-
(** Mailbox/query request arguments. See RFC8621 Section 2.3. *)
220
+
(** Mailbox/query request arguments as defined in RFC8621 Section 2.3.
221
+
Used to query mailboxes based on filter criteria.
222
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.3>
type mailbox_query_arguments = {
147
-
filter : mailbox_query_filter option;
148
-
sort : [ `name | `role | `sort_order ] list option;
149
-
limit : unsigned_int option;
225
+
account_id : id; (** The account to query *)
226
+
filter : mailbox_query_filter option; (** Filter to match mailboxes against *)
227
+
sort : [ `name | `role | `sort_order ] list option; (** Sort criteria *)
228
+
limit : unsigned_int option; (** Maximum number of results to return *)
152
-
(** Mailbox/query response. See RFC8621 Section 2.3. *)
231
+
(** Mailbox/query response as defined in RFC8621 Section 2.3.
232
+
Contains IDs of mailboxes matching the query.
233
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.3>
type mailbox_query_response = {
155
-
query_state : string;
156
-
can_calculate_changes : bool;
157
-
position : unsigned_int;
159
-
total : unsigned_int option;
236
+
account_id : id; (** The account that was queried *)
237
+
query_state : string; (** State string for the query results *)
238
+
can_calculate_changes : bool; (** Whether queryChanges can be used with these results *)
239
+
position : unsigned_int; (** Zero-based index of the first result *)
240
+
ids : id list; (** IDs of mailboxes matching the query *)
241
+
total : unsigned_int option; (** Total number of matches if requested *)
162
-
(** Mailbox/queryChanges request arguments. See RFC8621 Section 2.4. *)
244
+
(** Mailbox/queryChanges request arguments as defined in RFC8621 Section 2.4.
245
+
Used to get changes to mailbox query results.
246
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.4>
type mailbox_query_changes_arguments = {
165
-
filter : mailbox_query_filter option;
166
-
sort : [ `name | `role | `sort_order ] list option;
167
-
since_query_state : string;
168
-
max_changes : unsigned_int option;
169
-
up_to_id : id option;
249
+
account_id : id; (** The account to query *)
250
+
filter : mailbox_query_filter option; (** Same filter as the original query *)
251
+
sort : [ `name | `role | `sort_order ] list option; (** Same sort as the original query *)
252
+
since_query_state : string; (** The query_state from the previous result *)
253
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
254
+
up_to_id : id option; (** ID of the last mailbox to check for changes *)
172
-
(** Mailbox/queryChanges response. See RFC8621 Section 2.4. *)
257
+
(** Mailbox/queryChanges response as defined in RFC8621 Section 2.4.
258
+
Reports changes to a mailbox query since the previous state.
259
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.4>
type mailbox_query_changes_response = {
175
-
old_query_state : string;
176
-
new_query_state : string;
177
-
total : unsigned_int option;
179
-
added : mailbox_query_changes_added list;
262
+
account_id : id; (** The account that was queried *)
263
+
old_query_state : string; (** The query_state from the request *)
264
+
new_query_state : string; (** The current query_state on the server *)
265
+
total : unsigned_int option; (** Updated total number of matches, if requested *)
266
+
removed : id list; (** IDs that were in the old results but not the new *)
267
+
added : mailbox_query_changes_added list; (** IDs that are in the new results but not the old *)
270
+
(** Added item in mailbox query changes as defined in RFC8621 Section 2.4.
271
+
Represents a mailbox added to query results.
272
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.4>
and mailbox_query_changes_added = {
184
-
index : unsigned_int;
275
+
id : id; (** ID of the added mailbox *)
276
+
index : unsigned_int; (** Zero-based index of the added mailbox in the results *)
187
-
(** Mailbox/set request arguments. See RFC8621 Section 2.5. *)
279
+
(** Mailbox/set request arguments as defined in RFC8621 Section 2.5.
280
+
Used to create, update, and destroy mailboxes.
281
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.5>
type mailbox_set_arguments = {
190
-
if_in_state : string option;
191
-
create : (id * mailbox_creation) list option;
192
-
update : (id * mailbox_update) list option;
193
-
destroy : id list option;
284
+
account_id : id; (** The account to make changes in *)
285
+
if_in_state : string option; (** Only apply changes if in this state *)
286
+
create : (id * mailbox_creation) list option; (** Map of creation IDs to mailboxes to create *)
287
+
update : (id * mailbox_update) list option; (** Map of IDs to update properties *)
288
+
destroy : id list option; (** List of IDs to destroy *)
291
+
(** Properties for mailbox creation as defined in RFC8621 Section 2.5.
292
+
Used to create new mailboxes.
293
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.5>
198
-
parent_id : id option;
199
-
role : string option;
200
-
sort_order : unsigned_int option;
201
-
is_subscribed : bool option;
296
+
name : string; (** Name for the new mailbox *)
297
+
parent_id : id option; (** ID of the parent mailbox, if any *)
298
+
role : string option; (** Role for the mailbox, if it's a special-purpose mailbox *)
299
+
sort_order : unsigned_int option; (** Sort order, defaults to 0 *)
300
+
is_subscribed : bool option; (** Whether the mailbox is subscribed, defaults to true *)
303
+
(** Properties for mailbox update as defined in RFC8621 Section 2.5.
304
+
Used to update existing mailboxes.
305
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.5>
205
-
name : string option;
206
-
parent_id : id option;
207
-
role : string option;
208
-
sort_order : unsigned_int option;
209
-
is_subscribed : bool option;
308
+
name : string option; (** New name for the mailbox *)
309
+
parent_id : id option; (** New parent ID for the mailbox *)
310
+
role : string option; (** New role for the mailbox *)
311
+
sort_order : unsigned_int option; (** New sort order for the mailbox *)
312
+
is_subscribed : bool option; (** New subscription status for the mailbox *)
212
-
(** Mailbox/set response. See RFC8621 Section 2.5. *)
315
+
(** Mailbox/set response as defined in RFC8621 Section 2.5.
316
+
Reports the results of mailbox changes.
317
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-2.5>
type mailbox_set_response = {
215
-
old_state : string option;
216
-
new_state : string;
217
-
created : (id * mailbox) list option;
218
-
updated : id list option;
219
-
destroyed : id list option;
220
-
not_created : (id * set_error) list option;
221
-
not_updated : (id * set_error) list option;
222
-
not_destroyed : (id * set_error) list option;
320
+
account_id : id; (** The account that was modified *)
321
+
old_state : string option; (** The state before processing, if changed *)
322
+
new_state : string; (** The current state on the server *)
323
+
created : (id * mailbox) list option; (** Map of creation IDs to created mailboxes *)
324
+
updated : id list option; (** List of IDs that were successfully updated *)
325
+
destroyed : id list option; (** List of IDs that were successfully destroyed *)
326
+
not_created : (id * set_error) list option; (** Map of IDs to errors for failed creates *)
327
+
not_updated : (id * set_error) list option; (** Map of IDs to errors for failed updates *)
328
+
not_destroyed : (id * set_error) list option; (** Map of IDs to errors for failed destroys *)
225
-
(** {1:thread Thread objects} *)
331
+
(** {1:thread Thread objects}
332
+
Thread types as defined in RFC8621 Section 3
333
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-3>
227
-
(** A thread in a mail account. See RFC8621 Section 3. *)
336
+
(** A thread in a mail account as defined in RFC8621 Section 3.
337
+
Represents a group of related email messages.
338
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-3>
230
-
email_ids : id list;
341
+
id : id; (** Server-assigned ID for the thread *)
342
+
email_ids : id list; (** IDs of emails in the thread *)
233
-
(** Thread/get request arguments. See RFC8621 Section 3.1. *)
345
+
(** Thread/get request arguments as defined in RFC8621 Section 3.1.
346
+
Used to fetch threads by ID.
347
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-3.1>
type thread_get_arguments = {
236
-
ids : id list option;
237
-
properties : string list option;
350
+
account_id : id; (** The account to fetch threads from *)
351
+
ids : id list option; (** The IDs of threads to fetch, null means all *)
352
+
properties : string list option; (** Properties to return, null means all *)
240
-
(** Thread/get response. See RFC8621 Section 3.1. *)
355
+
(** Thread/get response as defined in RFC8621 Section 3.1.
356
+
Contains requested threads.
357
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-3.1>
type thread_get_response = {
244
-
list : thread list;
245
-
not_found : id list;
360
+
account_id : id; (** The account from which threads were fetched *)
361
+
state : string; (** A string representing the state on the server *)
362
+
list : thread list; (** The list of threads requested *)
363
+
not_found : id list; (** IDs requested that could not be found *)
248
-
(** Thread/changes request arguments. See RFC8621 Section 3.2. *)
366
+
(** Thread/changes request arguments as defined in RFC8621 Section 3.2.
367
+
Used to get thread changes since a previous state.
368
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-3.2>
type thread_changes_arguments = {
251
-
since_state : string;
252
-
max_changes : unsigned_int option;
371
+
account_id : id; (** The account to get changes for *)
372
+
since_state : string; (** The previous state to compare to *)
373
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
255
-
(** Thread/changes response. See RFC8621 Section 3.2. *)
376
+
(** Thread/changes response as defined in RFC8621 Section 3.2.
377
+
Reports threads that have changed since a previous state.
378
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-3.2>
type thread_changes_response = {
258
-
old_state : string;
259
-
new_state : string;
260
-
has_more_changes : bool;
263
-
destroyed : id list;
381
+
account_id : id; (** The account changes are for *)
382
+
old_state : string; (** The state provided in the request *)
383
+
new_state : string; (** The current state on the server *)
384
+
has_more_changes : bool; (** If true, more changes are available *)
385
+
created : id list; (** IDs of threads created since old_state *)
386
+
updated : id list; (** IDs of threads updated since old_state *)
387
+
destroyed : id list; (** IDs of threads destroyed since old_state *)
266
-
(** {1:email Email objects} *)
390
+
(** {1:email Email objects}
391
+
Email types as defined in RFC8621 Section 4
392
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4>
268
-
(** Addressing (mailbox) information. See RFC8621 Section 4.1.1. *)
395
+
(** Addressing (mailbox) information as defined in RFC8621 Section 4.1.1.
396
+
Represents an email address with optional display name.
397
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.1.1>
270
-
name : string option;
272
-
parameters : (string * string) list;
400
+
name : string option; (** Display name of the mailbox (e.g., "John Doe") *)
401
+
email : string; (** The email address (e.g., "john@example.com") *)
402
+
parameters : (string * string) list; (** Additional parameters for the address *)
275
-
(** Message header field. See RFC8621 Section 4.1.2. *)
405
+
(** Message header field as defined in RFC8621 Section 4.1.2.
406
+
Represents an email header.
407
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.1.2>
410
+
name : string; (** Name of the header field (e.g., "Subject") *)
411
+
value : string; (** Value of the header field *)
281
-
(** Email keyword (flag). See RFC8621 Section 4.3. *)
414
+
(** Email keyword (flag) as defined in RFC8621 Section 4.3.
415
+
Represents a flag or tag on an email message.
416
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.3>
419
+
| Flagged (** Message is flagged/starred *)
420
+
| Answered (** Message has been replied to *)
421
+
| Draft (** Message is a draft *)
422
+
| Forwarded (** Message has been forwarded *)
423
+
| Phishing (** Message has been reported as phishing *)
424
+
| Junk (** Message is spam/junk *)
425
+
| NotJunk (** Message is explicitly not spam *)
426
+
| Seen (** Message has been read *)
427
+
| Unread (** Message is unread (inverse of $seen) *)
428
+
| Custom of string (** Custom/non-standard keywords *)
294
-
(** Email message. See RFC8621 Section 4. *)
430
+
(** Email message as defined in RFC8621 Section 4.
431
+
Represents an email message in a mail account.
432
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4>
299
-
mailbox_ids : (id * bool) list;
300
-
keywords : (keyword * bool) list;
301
-
size : unsigned_int;
302
-
received_at : utc_date;
303
-
message_id : string list;
304
-
in_reply_to : string list option;
305
-
references : string list option;
306
-
sender : email_address list option;
307
-
from : email_address list option;
308
-
to_ : email_address list option;
309
-
cc : email_address list option;
310
-
bcc : email_address list option;
311
-
reply_to : email_address list option;
312
-
subject : string option;
313
-
sent_at : utc_date option;
314
-
has_attachment : bool option;
315
-
preview : string option;
316
-
body_values : (string * string) list option;
317
-
text_body : email_body_part list option;
318
-
html_body : email_body_part list option;
319
-
attachments : email_body_part list option;
320
-
headers : header list option;
435
+
id : id; (** Server-assigned ID for the message *)
436
+
blob_id : id; (** ID of the raw message content blob *)
437
+
thread_id : id; (** ID of the thread this message belongs to *)
438
+
mailbox_ids : (id * bool) list; (** Map of mailbox IDs to boolean (whether message belongs to mailbox) *)
439
+
keywords : (keyword * bool) list; (** Map of keywords to boolean (whether message has keyword) *)
440
+
size : unsigned_int; (** Size of the message in octets *)
441
+
received_at : utc_date; (** When the message was received by the server *)
442
+
message_id : string list; (** Message-ID header values *)
443
+
in_reply_to : string list option; (** In-Reply-To header values *)
444
+
references : string list option; (** References header values *)
445
+
sender : email_address list option; (** Sender header addresses *)
446
+
from : email_address list option; (** From header addresses *)
447
+
to_ : email_address list option; (** To header addresses *)
448
+
cc : email_address list option; (** Cc header addresses *)
449
+
bcc : email_address list option; (** Bcc header addresses *)
450
+
reply_to : email_address list option; (** Reply-To header addresses *)
451
+
subject : string option; (** Subject header value *)
452
+
sent_at : utc_date option; (** Date header value as a date-time *)
453
+
has_attachment : bool option; (** Does the message have any attachments *)
454
+
preview : string option; (** Preview of the message (first bit of text) *)
455
+
body_values : (string * string) list option; (** Map of part IDs to text content *)
456
+
text_body : email_body_part list option; (** Plain text message body parts *)
457
+
html_body : email_body_part list option; (** HTML message body parts *)
458
+
attachments : email_body_part list option; (** Attachment parts in the message *)
459
+
headers : header list option; (** All headers in the message *)
323
-
(** Email body part. See RFC8621 Section 4.1.4. *)
462
+
(** Email body part as defined in RFC8621 Section 4.1.4.
463
+
Represents a MIME part in an email message.
464
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.1.4>
325
-
part_id : string option;
326
-
blob_id : id option;
327
-
size : unsigned_int option;
328
-
headers : header list option;
329
-
name : string option;
330
-
type_ : string option;
331
-
charset : string option;
332
-
disposition : string option;
333
-
cid : string option;
334
-
language : string list option;
335
-
location : string option;
336
-
sub_parts : email_body_part list option;
337
-
header_parameter_name : string option;
338
-
header_parameter_value : string option;
467
+
part_id : string option; (** Server-assigned ID for the MIME part *)
468
+
blob_id : id option; (** ID of the raw content for this part *)
469
+
size : unsigned_int option; (** Size of the part in octets *)
470
+
headers : header list option; (** Headers for this MIME part *)
471
+
name : string option; (** Filename of this part, if any *)
472
+
type_ : string option; (** MIME type of the part *)
473
+
charset : string option; (** Character set of the part, if applicable *)
474
+
disposition : string option; (** Content-Disposition value *)
475
+
cid : string option; (** Content-ID value *)
476
+
language : string list option; (** Content-Language values *)
477
+
location : string option; (** Content-Location value *)
478
+
sub_parts : email_body_part list option; (** Child MIME parts for multipart types *)
479
+
header_parameter_name : string option; (** Header parameter name (for headers with parameters) *)
480
+
header_parameter_value : string option; (** Header parameter value (for headers with parameters) *)
341
-
(** Email query filter condition. See RFC8621 Section 4.4. *)
483
+
(** Email query filter condition as defined in RFC8621 Section 4.4.
484
+
Specifies conditions for filtering emails in queries.
485
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.4>
type email_filter_condition = {
343
-
in_mailbox : id option;
344
-
in_mailbox_other_than : id list option;
345
-
min_size : unsigned_int option;
346
-
max_size : unsigned_int option;
347
-
before : utc_date option;
348
-
after : utc_date option;
349
-
header : (string * string) option;
350
-
from : string option;
351
-
to_ : string option;
352
-
cc : string option;
353
-
bcc : string option;
354
-
subject : string option;
355
-
body : string option;
356
-
has_keyword : string option;
357
-
not_keyword : string option;
358
-
has_attachment : bool option;
359
-
text : string option;
488
+
in_mailbox : id option; (** Only include emails in this mailbox *)
489
+
in_mailbox_other_than : id list option; (** Only include emails not in these mailboxes *)
490
+
min_size : unsigned_int option; (** Only include emails of at least this size in octets *)
491
+
max_size : unsigned_int option; (** Only include emails of at most this size in octets *)
492
+
before : utc_date option; (** Only include emails received before this date-time *)
493
+
after : utc_date option; (** Only include emails received after this date-time *)
494
+
header : (string * string) option; (** Only include emails with header matching value (name, value) *)
495
+
from : string option; (** Only include emails with From containing this text *)
496
+
to_ : string option; (** Only include emails with To containing this text *)
497
+
cc : string option; (** Only include emails with CC containing this text *)
498
+
bcc : string option; (** Only include emails with BCC containing this text *)
499
+
subject : string option; (** Only include emails with Subject containing this text *)
500
+
body : string option; (** Only include emails with body containing this text *)
501
+
has_keyword : string option; (** Only include emails with this keyword *)
502
+
not_keyword : string option; (** Only include emails without this keyword *)
503
+
has_attachment : bool option; (** If true, only include emails with attachments *)
504
+
text : string option; (** Only include emails with this text in headers or body *)
507
+
(** Filter for email queries as defined in RFC8621 Section 4.4.
508
+
Complex filter for Email/query method.
509
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.4>
type email_query_filter = [
363
-
| `And of email_query_filter list
364
-
| `Or of email_query_filter list
365
-
| `Not of email_query_filter
366
-
| `Condition of email_filter_condition
512
+
| `And of email_query_filter list (** Logical AND of filters *)
513
+
| `Or of email_query_filter list (** Logical OR of filters *)
514
+
| `Not of email_query_filter (** Logical NOT of a filter *)
515
+
| `Condition of email_filter_condition (** Simple condition filter *)
369
-
(** Email/get request arguments. See RFC8621 Section 4.5. *)
518
+
(** Email/get request arguments as defined in RFC8621 Section 4.5.
519
+
Used to fetch emails by ID.
520
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.5>
type email_get_arguments = {
372
-
ids : id list option;
373
-
properties : string list option;
374
-
body_properties : string list option;
375
-
fetch_text_body_values : bool option;
376
-
fetch_html_body_values : bool option;
377
-
fetch_all_body_values : bool option;
378
-
max_body_value_bytes : unsigned_int option;
523
+
account_id : id; (** The account to fetch emails from *)
524
+
ids : id list option; (** The IDs of emails to fetch, null means all *)
525
+
properties : string list option; (** Properties to return, null means all *)
526
+
body_properties : string list option; (** Properties to return on body parts *)
527
+
fetch_text_body_values : bool option; (** Whether to fetch text body content *)
528
+
fetch_html_body_values : bool option; (** Whether to fetch HTML body content *)
529
+
fetch_all_body_values : bool option; (** Whether to fetch all body content *)
530
+
max_body_value_bytes : unsigned_int option; (** Maximum size of body values to return *)
381
-
(** Email/get response. See RFC8621 Section 4.5. *)
533
+
(** Email/get response as defined in RFC8621 Section 4.5.
534
+
Contains requested emails.
535
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.5>
type email_get_response = {
386
-
not_found : id list;
538
+
account_id : id; (** The account from which emails were fetched *)
539
+
state : string; (** A string representing the state on the server *)
540
+
list : email list; (** The list of emails requested *)
541
+
not_found : id list; (** IDs requested that could not be found *)
389
-
(** Email/changes request arguments. See RFC8621 Section 4.6. *)
544
+
(** Email/changes request arguments as defined in RFC8621 Section 4.6.
545
+
Used to get email changes since a previous state.
546
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.6>
type email_changes_arguments = {
392
-
since_state : string;
393
-
max_changes : unsigned_int option;
549
+
account_id : id; (** The account to get changes for *)
550
+
since_state : string; (** The previous state to compare to *)
551
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
396
-
(** Email/changes response. See RFC8621 Section 4.6. *)
554
+
(** Email/changes response as defined in RFC8621 Section 4.6.
555
+
Reports emails that have changed since a previous state.
556
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.6>
type email_changes_response = {
399
-
old_state : string;
400
-
new_state : string;
401
-
has_more_changes : bool;
404
-
destroyed : id list;
559
+
account_id : id; (** The account changes are for *)
560
+
old_state : string; (** The state provided in the request *)
561
+
new_state : string; (** The current state on the server *)
562
+
has_more_changes : bool; (** If true, more changes are available *)
563
+
created : id list; (** IDs of emails created since old_state *)
564
+
updated : id list; (** IDs of emails updated since old_state *)
565
+
destroyed : id list; (** IDs of emails destroyed since old_state *)
407
-
(** Email/query request arguments. See RFC8621 Section 4.4. *)
568
+
(** Email/query request arguments as defined in RFC8621 Section 4.4.
569
+
Used to query emails based on filter criteria.
570
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.4>
type email_query_arguments = {
410
-
filter : email_query_filter option;
411
-
sort : comparator list option;
412
-
collapse_threads : bool option;
413
-
position : unsigned_int option;
414
-
anchor : id option;
415
-
anchor_offset : int_t option;
416
-
limit : unsigned_int option;
417
-
calculate_total : bool option;
573
+
account_id : id; (** The account to query *)
574
+
filter : email_query_filter option; (** Filter to match emails against *)
575
+
sort : comparator list option; (** Sort criteria *)
576
+
collapse_threads : bool option; (** Whether to collapse threads in the results *)
577
+
position : unsigned_int option; (** Zero-based index of first result to return *)
578
+
anchor : id option; (** ID of email to use as reference point *)
579
+
anchor_offset : int_t option; (** Offset from anchor to start returning results *)
580
+
limit : unsigned_int option; (** Maximum number of results to return *)
581
+
calculate_total : bool option; (** Whether to calculate the total number of matching emails *)
420
-
(** Email/query response. See RFC8621 Section 4.4. *)
584
+
(** Email/query response as defined in RFC8621 Section 4.4.
585
+
Contains IDs of emails matching the query.
586
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.4>
type email_query_response = {
423
-
query_state : string;
424
-
can_calculate_changes : bool;
425
-
position : unsigned_int;
427
-
total : unsigned_int option;
428
-
thread_ids : id list option;
589
+
account_id : id; (** The account that was queried *)
590
+
query_state : string; (** State string for the query results *)
591
+
can_calculate_changes : bool; (** Whether queryChanges can be used with these results *)
592
+
position : unsigned_int; (** Zero-based index of the first result *)
593
+
ids : id list; (** IDs of emails matching the query *)
594
+
total : unsigned_int option; (** Total number of matches if requested *)
595
+
thread_ids : id list option; (** IDs of threads if collapse_threads was true *)
431
-
(** Email/queryChanges request arguments. See RFC8621 Section 4.7. *)
598
+
(** Email/queryChanges request arguments as defined in RFC8621 Section 4.7.
599
+
Used to get changes to email query results.
600
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.7>
type email_query_changes_arguments = {
434
-
filter : email_query_filter option;
435
-
sort : comparator list option;
436
-
collapse_threads : bool option;
437
-
since_query_state : string;
438
-
max_changes : unsigned_int option;
439
-
up_to_id : id option;
603
+
account_id : id; (** The account to query *)
604
+
filter : email_query_filter option; (** Same filter as the original query *)
605
+
sort : comparator list option; (** Same sort as the original query *)
606
+
collapse_threads : bool option; (** Same collapse_threads as the original query *)
607
+
since_query_state : string; (** The query_state from the previous result *)
608
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
609
+
up_to_id : id option; (** ID of the last email to check for changes *)
442
-
(** Email/queryChanges response. See RFC8621 Section 4.7. *)
612
+
(** Email/queryChanges response as defined in RFC8621 Section 4.7.
613
+
Reports changes to an email query since the previous state.
614
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.7>
type email_query_changes_response = {
445
-
old_query_state : string;
446
-
new_query_state : string;
447
-
total : unsigned_int option;
449
-
added : email_query_changes_added list;
617
+
account_id : id; (** The account that was queried *)
618
+
old_query_state : string; (** The query_state from the request *)
619
+
new_query_state : string; (** The current query_state on the server *)
620
+
total : unsigned_int option; (** Updated total number of matches, if requested *)
621
+
removed : id list; (** IDs that were in the old results but not the new *)
622
+
added : email_query_changes_added list; (** IDs that are in the new results but not the old *)
625
+
(** Added item in email query changes as defined in RFC8621 Section 4.7.
626
+
Represents an email added to query results.
627
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.7>
and email_query_changes_added = {
454
-
index : unsigned_int;
630
+
id : id; (** ID of the added email *)
631
+
index : unsigned_int; (** Zero-based index of the added email in the results *)
457
-
(** Email/set request arguments. See RFC8621 Section 4.8. *)
634
+
(** Email/set request arguments as defined in RFC8621 Section 4.8.
635
+
Used to create, update, and destroy emails.
636
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.8>
type email_set_arguments = {
460
-
if_in_state : string option;
461
-
create : (id * email_creation) list option;
462
-
update : (id * email_update) list option;
463
-
destroy : id list option;
639
+
account_id : id; (** The account to make changes in *)
640
+
if_in_state : string option; (** Only apply changes if in this state *)
641
+
create : (id * email_creation) list option; (** Map of creation IDs to emails to create *)
642
+
update : (id * email_update) list option; (** Map of IDs to update properties *)
643
+
destroy : id list option; (** List of IDs to destroy *)
646
+
(** Properties for email creation as defined in RFC8621 Section 4.8.
647
+
Used to create new emails.
648
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.8>
467
-
mailbox_ids : (id * bool) list;
468
-
keywords : (keyword * bool) list option;
469
-
received_at : utc_date option;
470
-
message_id : string list option;
471
-
in_reply_to : string list option;
472
-
references : string list option;
473
-
sender : email_address list option;
474
-
from : email_address list option;
475
-
to_ : email_address list option;
476
-
cc : email_address list option;
477
-
bcc : email_address list option;
478
-
reply_to : email_address list option;
479
-
subject : string option;
480
-
body_values : (string * string) list option;
481
-
text_body : email_body_part list option;
482
-
html_body : email_body_part list option;
483
-
attachments : email_body_part list option;
484
-
headers : header list option;
651
+
mailbox_ids : (id * bool) list; (** Map of mailbox IDs to boolean (whether message belongs to mailbox) *)
652
+
keywords : (keyword * bool) list option; (** Map of keywords to boolean (whether message has keyword) *)
653
+
received_at : utc_date option; (** When the message was received by the server *)
654
+
message_id : string list option; (** Message-ID header values *)
655
+
in_reply_to : string list option; (** In-Reply-To header values *)
656
+
references : string list option; (** References header values *)
657
+
sender : email_address list option; (** Sender header addresses *)
658
+
from : email_address list option; (** From header addresses *)
659
+
to_ : email_address list option; (** To header addresses *)
660
+
cc : email_address list option; (** Cc header addresses *)
661
+
bcc : email_address list option; (** Bcc header addresses *)
662
+
reply_to : email_address list option; (** Reply-To header addresses *)
663
+
subject : string option; (** Subject header value *)
664
+
body_values : (string * string) list option; (** Map of part IDs to text content *)
665
+
text_body : email_body_part list option; (** Plain text message body parts *)
666
+
html_body : email_body_part list option; (** HTML message body parts *)
667
+
attachments : email_body_part list option; (** Attachment parts in the message *)
668
+
headers : header list option; (** All headers in the message *)
671
+
(** Properties for email update as defined in RFC8621 Section 4.8.
672
+
Used to update existing emails.
673
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.8>
488
-
keywords : (keyword * bool) list option;
489
-
mailbox_ids : (id * bool) list option;
676
+
keywords : (keyword * bool) list option; (** New keywords to set on the email *)
677
+
mailbox_ids : (id * bool) list option; (** New mailboxes to set for the email *)
492
-
(** Email/set response. See RFC8621 Section 4.8. *)
680
+
(** Email/set response as defined in RFC8621 Section 4.8.
681
+
Reports the results of email changes.
682
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.8>
type email_set_response = {
495
-
old_state : string option;
496
-
new_state : string;
497
-
created : (id * email) list option;
498
-
updated : id list option;
499
-
destroyed : id list option;
500
-
not_created : (id * set_error) list option;
501
-
not_updated : (id * set_error) list option;
502
-
not_destroyed : (id * set_error) list option;
685
+
account_id : id; (** The account that was modified *)
686
+
old_state : string option; (** The state before processing, if changed *)
687
+
new_state : string; (** The current state on the server *)
688
+
created : (id * email) list option; (** Map of creation IDs to created emails *)
689
+
updated : id list option; (** List of IDs that were successfully updated *)
690
+
destroyed : id list option; (** List of IDs that were successfully destroyed *)
691
+
not_created : (id * set_error) list option; (** Map of IDs to errors for failed creates *)
692
+
not_updated : (id * set_error) list option; (** Map of IDs to errors for failed updates *)
693
+
not_destroyed : (id * set_error) list option; (** Map of IDs to errors for failed destroys *)
505
-
(** Email/copy request arguments. See RFC8621 Section 4.9. *)
696
+
(** Email/copy request arguments as defined in RFC8621 Section 4.9.
697
+
Used to copy emails between accounts.
698
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.9>
type email_copy_arguments = {
507
-
from_account_id : id;
509
-
create : (id * email_creation) list;
510
-
on_success_destroy_original : bool option;
701
+
from_account_id : id; (** The account to copy emails from *)
702
+
account_id : id; (** The account to copy emails to *)
703
+
create : (id * email_creation) list; (** Map of creation IDs to email creation properties *)
704
+
on_success_destroy_original : bool option; (** Whether to destroy originals after copying *)
513
-
(** Email/copy response. See RFC8621 Section 4.9. *)
707
+
(** Email/copy response as defined in RFC8621 Section 4.9.
708
+
Reports the results of copying emails.
709
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.9>
type email_copy_response = {
515
-
from_account_id : id;
517
-
created : (id * email) list option;
518
-
not_created : (id * set_error) list option;
712
+
from_account_id : id; (** The account emails were copied from *)
713
+
account_id : id; (** The account emails were copied to *)
714
+
created : (id * email) list option; (** Map of creation IDs to created emails *)
715
+
not_created : (id * set_error) list option; (** Map of IDs to errors for failed copies *)
521
-
(** Email/import request arguments. See RFC8621 Section 4.10. *)
718
+
(** Email/import request arguments as defined in RFC8621 Section 4.10.
719
+
Used to import raw emails from blobs.
720
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.10>
type email_import_arguments = {
524
-
emails : (id * email_import) list;
723
+
account_id : id; (** The account to import emails into *)
724
+
emails : (id * email_import) list; (** Map of creation IDs to import properties *)
727
+
(** Properties for email import as defined in RFC8621 Section 4.10.
728
+
Used to import raw emails from blobs.
729
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.10>
529
-
mailbox_ids : (id * bool) list;
530
-
keywords : (keyword * bool) list option;
531
-
received_at : utc_date option;
732
+
blob_id : id; (** ID of the blob containing the raw message *)
733
+
mailbox_ids : (id * bool) list; (** Map of mailbox IDs to boolean (whether message belongs to mailbox) *)
734
+
keywords : (keyword * bool) list option; (** Map of keywords to boolean (whether message has keyword) *)
735
+
received_at : utc_date option; (** When the message was received, defaults to now *)
534
-
(** Email/import response. See RFC8621 Section 4.10. *)
738
+
(** Email/import response as defined in RFC8621 Section 4.10.
739
+
Reports the results of importing emails.
740
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.10>
type email_import_response = {
537
-
created : (id * email) list option;
538
-
not_created : (id * set_error) list option;
743
+
account_id : id; (** The account emails were imported into *)
744
+
created : (id * email) list option; (** Map of creation IDs to created emails *)
745
+
not_created : (id * set_error) list option; (** Map of IDs to errors for failed imports *)
541
-
(** {1:search_snippet Search snippets} *)
748
+
(** {1:search_snippet Search snippets}
749
+
Search snippet types as defined in RFC8621 Section 4.11
750
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.11>
543
-
(** SearchSnippet/get request arguments. See RFC8621 Section 4.11. *)
753
+
(** SearchSnippet/get request arguments as defined in RFC8621 Section 4.11.
754
+
Used to get highlighted snippets from emails matching a search.
755
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.11>
type search_snippet_get_arguments = {
546
-
email_ids : id list;
547
-
filter : email_filter_condition;
758
+
account_id : id; (** The account to search in *)
759
+
email_ids : id list; (** The IDs of emails to get snippets for *)
760
+
filter : email_filter_condition; (** Filter containing the text to find and highlight *)
550
-
(** SearchSnippet/get response. See RFC8621 Section 4.11. *)
763
+
(** SearchSnippet/get response as defined in RFC8621 Section 4.11.
764
+
Contains search result snippets with highlighted text.
765
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.11>
type search_snippet_get_response = {
553
-
list : (id * search_snippet) list;
554
-
not_found : id list;
768
+
account_id : id; (** The account that was searched *)
769
+
list : (id * search_snippet) list; (** Map of email IDs to their search snippets *)
770
+
not_found : id list; (** IDs for which no snippet could be generated *)
773
+
(** Search snippet for an email as defined in RFC8621 Section 4.11.
774
+
Contains highlighted parts of emails matching a search.
775
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-4.11>
558
-
subject : string option;
559
-
preview : string option;
778
+
subject : string option; (** Subject with search terms highlighted *)
779
+
preview : string option; (** Email body preview with search terms highlighted *)
562
-
(** {1:submission EmailSubmission objects} *)
782
+
(** {1:submission EmailSubmission objects}
783
+
Email submission types as defined in RFC8621 Section 5
784
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5>
564
-
(** EmailSubmission address. See RFC8621 Section 5.1. *)
787
+
(** EmailSubmission address as defined in RFC8621 Section 5.1.
788
+
Represents an email address for mail submission.
789
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.1>
type submission_address = {
567
-
parameters : (string * string) list option;
792
+
email : string; (** The email address (e.g., "john@example.com") *)
793
+
parameters : (string * string) list option; (** SMTP extension parameters *)
570
-
(** Email submission object. See RFC8621 Section 5.1. *)
796
+
(** Email submission object as defined in RFC8621 Section 5.1.
797
+
Represents an email that has been or will be sent.
798
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.1>
type email_submission = {
576
-
envelope : envelope option;
577
-
send_at : utc_date option;
801
+
id : id; (** Server-assigned ID for the submission *)
802
+
identity_id : id; (** ID of the identity used to send the email *)
803
+
email_id : id; (** ID of the email to send *)
804
+
thread_id : id; (** ID of the thread containing the message *)
805
+
envelope : envelope option; (** SMTP envelope for the message *)
806
+
send_at : utc_date option; (** When to send the email, null for immediate *)
583
-
delivery_status : (string * submission_status) list option;
584
-
dsn_blob_ids : (string * id) list option;
585
-
mdn_blob_ids : (string * id) list option;
808
+
| `pending (** Submission can still be canceled *)
809
+
| `final (** Submission can no longer be canceled *)
810
+
| `canceled (** Submission was canceled *)
811
+
] option; (** Current undo status of the submission *)
812
+
delivery_status : (string * submission_status) list option; (** Map of recipient to delivery status *)
813
+
dsn_blob_ids : (string * id) list option; (** Map of recipient to DSN blob ID *)
814
+
mdn_blob_ids : (string * id) list option; (** Map of recipient to MDN blob ID *)
588
-
(** Envelope for mail submission. See RFC8621 Section 5.1. *)
817
+
(** Envelope for mail submission as defined in RFC8621 Section 5.1.
818
+
Represents the SMTP envelope for a message.
819
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.1>
590
-
mail_from : submission_address;
591
-
rcpt_to : submission_address list;
822
+
mail_from : submission_address; (** Return path for the message *)
823
+
rcpt_to : submission_address list; (** Recipients for the message *)
594
-
(** Delivery status for submitted email. See RFC8621 Section 5.1. *)
826
+
(** Delivery status for submitted email as defined in RFC8621 Section 5.1.
827
+
Represents the SMTP status of a delivery attempt.
828
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.1>
and submission_status = {
596
-
smtp_reply : string;
597
-
delivered : string option;
831
+
smtp_reply : string; (** SMTP response from the server *)
832
+
delivered : string option; (** Timestamp when message was delivered, if successful *)
600
-
(** EmailSubmission/get request arguments. See RFC8621 Section 5.3. *)
835
+
(** EmailSubmission/get request arguments as defined in RFC8621 Section 5.3.
836
+
Used to fetch email submissions by ID.
837
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.3>
type email_submission_get_arguments = {
603
-
ids : id list option;
604
-
properties : string list option;
840
+
account_id : id; (** The account to fetch submissions from *)
841
+
ids : id list option; (** The IDs of submissions to fetch, null means all *)
842
+
properties : string list option; (** Properties to return, null means all *)
607
-
(** EmailSubmission/get response. See RFC8621 Section 5.3. *)
845
+
(** EmailSubmission/get response as defined in RFC8621 Section 5.3.
846
+
Contains requested email submissions.
847
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.3>
type email_submission_get_response = {
611
-
list : email_submission list;
612
-
not_found : id list;
850
+
account_id : id; (** The account from which submissions were fetched *)
851
+
state : string; (** A string representing the state on the server *)
852
+
list : email_submission list; (** The list of submissions requested *)
853
+
not_found : id list; (** IDs requested that could not be found *)
615
-
(** EmailSubmission/changes request arguments. See RFC8621 Section 5.4. *)
856
+
(** EmailSubmission/changes request arguments as defined in RFC8621 Section 5.4.
857
+
Used to get submission changes since a previous state.
858
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.4>
type email_submission_changes_arguments = {
618
-
since_state : string;
619
-
max_changes : unsigned_int option;
861
+
account_id : id; (** The account to get changes for *)
862
+
since_state : string; (** The previous state to compare to *)
863
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
622
-
(** EmailSubmission/changes response. See RFC8621 Section 5.4. *)
866
+
(** EmailSubmission/changes response as defined in RFC8621 Section 5.4.
867
+
Reports submissions that have changed since a previous state.
868
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.4>
type email_submission_changes_response = {
625
-
old_state : string;
626
-
new_state : string;
627
-
has_more_changes : bool;
630
-
destroyed : id list;
871
+
account_id : id; (** The account changes are for *)
872
+
old_state : string; (** The state provided in the request *)
873
+
new_state : string; (** The current state on the server *)
874
+
has_more_changes : bool; (** If true, more changes are available *)
875
+
created : id list; (** IDs of submissions created since old_state *)
876
+
updated : id list; (** IDs of submissions updated since old_state *)
877
+
destroyed : id list; (** IDs of submissions destroyed since old_state *)
633
-
(** EmailSubmission/query filter condition. See RFC8621 Section 5.5. *)
880
+
(** EmailSubmission/query filter condition as defined in RFC8621 Section 5.5.
881
+
Specifies conditions for filtering email submissions in queries.
882
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.5>
type email_submission_filter_condition = {
635
-
identity_id : id option;
636
-
email_id : id option;
637
-
thread_id : id option;
638
-
before : utc_date option;
639
-
after : utc_date option;
640
-
subject : string option;
885
+
identity_id : id option; (** Only include submissions with this identity *)
886
+
email_id : id option; (** Only include submissions for this email *)
887
+
thread_id : id option; (** Only include submissions for emails in this thread *)
888
+
before : utc_date option; (** Only include submissions created before this date-time *)
889
+
after : utc_date option; (** Only include submissions created after this date-time *)
890
+
subject : string option; (** Only include submissions with matching subjects *)
893
+
(** Filter for email submission queries as defined in RFC8621 Section 5.5.
894
+
Complex filter for EmailSubmission/query method.
895
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.5>
type email_submission_query_filter = [
644
-
| `And of email_submission_query_filter list
645
-
| `Or of email_submission_query_filter list
646
-
| `Not of email_submission_query_filter
647
-
| `Condition of email_submission_filter_condition
898
+
| `And of email_submission_query_filter list (** Logical AND of filters *)
899
+
| `Or of email_submission_query_filter list (** Logical OR of filters *)
900
+
| `Not of email_submission_query_filter (** Logical NOT of a filter *)
901
+
| `Condition of email_submission_filter_condition (** Simple condition filter *)
650
-
(** EmailSubmission/query request arguments. See RFC8621 Section 5.5. *)
904
+
(** EmailSubmission/query request arguments as defined in RFC8621 Section 5.5.
905
+
Used to query email submissions based on filter criteria.
906
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.5>
type email_submission_query_arguments = {
653
-
filter : email_submission_query_filter option;
654
-
sort : comparator list option;
655
-
position : unsigned_int option;
656
-
anchor : id option;
657
-
anchor_offset : int_t option;
658
-
limit : unsigned_int option;
659
-
calculate_total : bool option;
909
+
account_id : id; (** The account to query *)
910
+
filter : email_submission_query_filter option; (** Filter to match submissions against *)
911
+
sort : comparator list option; (** Sort criteria *)
912
+
position : unsigned_int option; (** Zero-based index of first result to return *)
913
+
anchor : id option; (** ID of submission to use as reference point *)
914
+
anchor_offset : int_t option; (** Offset from anchor to start returning results *)
915
+
limit : unsigned_int option; (** Maximum number of results to return *)
916
+
calculate_total : bool option; (** Whether to calculate the total number of matching submissions *)
662
-
(** EmailSubmission/query response. See RFC8621 Section 5.5. *)
919
+
(** EmailSubmission/query response as defined in RFC8621 Section 5.5.
920
+
Contains IDs of email submissions matching the query.
921
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.5>
type email_submission_query_response = {
665
-
query_state : string;
666
-
can_calculate_changes : bool;
667
-
position : unsigned_int;
669
-
total : unsigned_int option;
924
+
account_id : id; (** The account that was queried *)
925
+
query_state : string; (** State string for the query results *)
926
+
can_calculate_changes : bool; (** Whether queryChanges can be used with these results *)
927
+
position : unsigned_int; (** Zero-based index of the first result *)
928
+
ids : id list; (** IDs of email submissions matching the query *)
929
+
total : unsigned_int option; (** Total number of matches if requested *)
672
-
(** EmailSubmission/set request arguments. See RFC8621 Section 5.6. *)
932
+
(** EmailSubmission/set request arguments as defined in RFC8621 Section 5.6.
933
+
Used to create, update, and destroy email submissions.
934
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.6>
type email_submission_set_arguments = {
675
-
if_in_state : string option;
676
-
create : (id * email_submission_creation) list option;
677
-
update : (id * email_submission_update) list option;
678
-
destroy : id list option;
679
-
on_success_update_email : (id * email_update) list option;
937
+
account_id : id; (** The account to make changes in *)
938
+
if_in_state : string option; (** Only apply changes if in this state *)
939
+
create : (id * email_submission_creation) list option; (** Map of creation IDs to submissions to create *)
940
+
update : (id * email_submission_update) list option; (** Map of IDs to update properties *)
941
+
destroy : id list option; (** List of IDs to destroy *)
942
+
on_success_update_email : (id * email_update) list option; (** Emails to update if submissions succeed *)
945
+
(** Properties for email submission creation as defined in RFC8621 Section 5.6.
946
+
Used to create new email submissions.
947
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.6>
and email_submission_creation = {
685
-
envelope : envelope option;
686
-
send_at : utc_date option;
950
+
email_id : id; (** ID of the email to send *)
951
+
identity_id : id; (** ID of the identity to send from *)
952
+
envelope : envelope option; (** Custom envelope, if needed *)
953
+
send_at : utc_date option; (** When to send the email, defaults to now *)
956
+
(** Properties for email submission update as defined in RFC8621 Section 5.6.
957
+
Used to update existing email submissions.
958
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.6>
and email_submission_update = {
690
-
email_id : id option;
691
-
identity_id : id option;
692
-
envelope : envelope option;
693
-
undo_status : [`canceled] option;
961
+
email_id : id option; (** New email ID to use for this submission *)
962
+
identity_id : id option; (** New identity ID to use for this submission *)
963
+
envelope : envelope option; (** New envelope to use for this submission *)
964
+
undo_status : [`canceled] option; (** Set to cancel a pending submission *)
696
-
(** EmailSubmission/set response. See RFC8621 Section 5.6. *)
967
+
(** EmailSubmission/set response as defined in RFC8621 Section 5.6.
968
+
Reports the results of email submission changes.
969
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-5.6>
type email_submission_set_response = {
699
-
old_state : string option;
700
-
new_state : string;
701
-
created : (id * email_submission) list option;
702
-
updated : id list option;
703
-
destroyed : id list option;
704
-
not_created : (id * set_error) list option;
705
-
not_updated : (id * set_error) list option;
706
-
not_destroyed : (id * set_error) list option;
972
+
account_id : id; (** The account that was modified *)
973
+
old_state : string option; (** The state before processing, if changed *)
974
+
new_state : string; (** The current state on the server *)
975
+
created : (id * email_submission) list option; (** Map of creation IDs to created submissions *)
976
+
updated : id list option; (** List of IDs that were successfully updated *)
977
+
destroyed : id list option; (** List of IDs that were successfully destroyed *)
978
+
not_created : (id * set_error) list option; (** Map of IDs to errors for failed creates *)
979
+
not_updated : (id * set_error) list option; (** Map of IDs to errors for failed updates *)
980
+
not_destroyed : (id * set_error) list option; (** Map of IDs to errors for failed destroys *)
709
-
(** {1:identity Identity objects} *)
983
+
(** {1:identity Identity objects}
984
+
Identity types as defined in RFC8621 Section 6
985
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6>
711
-
(** Identity for sending mail. See RFC8621 Section 6. *)
988
+
(** Identity for sending mail as defined in RFC8621 Section 6.
989
+
Represents an email identity that can be used to send messages.
990
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6>
716
-
reply_to : email_address list option;
717
-
bcc : email_address list option;
718
-
text_signature : string option;
719
-
html_signature : string option;
993
+
id : id; (** Server-assigned ID for the identity *)
994
+
name : string; (** Display name for the identity *)
995
+
email : string; (** Email address for the identity *)
996
+
reply_to : email_address list option; (** Reply-To addresses to use when sending *)
997
+
bcc : email_address list option; (** BCC addresses to automatically include *)
998
+
text_signature : string option; (** Plain text signature for the identity *)
999
+
html_signature : string option; (** HTML signature for the identity *)
1000
+
may_delete : bool; (** Whether this identity can be deleted *)
723
-
(** Identity/get request arguments. See RFC8621 Section 6.1. *)
1003
+
(** Identity/get request arguments as defined in RFC8621 Section 6.1.
1004
+
Used to fetch identities by ID.
1005
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.1>
type identity_get_arguments = {
726
-
ids : id list option;
727
-
properties : string list option;
1008
+
account_id : id; (** The account to fetch identities from *)
1009
+
ids : id list option; (** The IDs of identities to fetch, null means all *)
1010
+
properties : string list option; (** Properties to return, null means all *)
730
-
(** Identity/get response. See RFC8621 Section 6.1. *)
1013
+
(** Identity/get response as defined in RFC8621 Section 6.1.
1014
+
Contains requested identities.
1015
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.1>
type identity_get_response = {
734
-
list : identity list;
735
-
not_found : id list;
1018
+
account_id : id; (** The account from which identities were fetched *)
1019
+
state : string; (** A string representing the state on the server *)
1020
+
list : identity list; (** The list of identities requested *)
1021
+
not_found : id list; (** IDs requested that could not be found *)
738
-
(** Identity/changes request arguments. See RFC8621 Section 6.2. *)
1024
+
(** Identity/changes request arguments as defined in RFC8621 Section 6.2.
1025
+
Used to get identity changes since a previous state.
1026
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.2>
type identity_changes_arguments = {
741
-
since_state : string;
742
-
max_changes : unsigned_int option;
1029
+
account_id : id; (** The account to get changes for *)
1030
+
since_state : string; (** The previous state to compare to *)
1031
+
max_changes : unsigned_int option; (** Maximum number of changes to return *)
745
-
(** Identity/changes response. See RFC8621 Section 6.2. *)
1034
+
(** Identity/changes response as defined in RFC8621 Section 6.2.
1035
+
Reports identities that have changed since a previous state.
1036
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.2>
type identity_changes_response = {
748
-
old_state : string;
749
-
new_state : string;
750
-
has_more_changes : bool;
753
-
destroyed : id list;
1039
+
account_id : id; (** The account changes are for *)
1040
+
old_state : string; (** The state provided in the request *)
1041
+
new_state : string; (** The current state on the server *)
1042
+
has_more_changes : bool; (** If true, more changes are available *)
1043
+
created : id list; (** IDs of identities created since old_state *)
1044
+
updated : id list; (** IDs of identities updated since old_state *)
1045
+
destroyed : id list; (** IDs of identities destroyed since old_state *)
756
-
(** Identity/set request arguments. See RFC8621 Section 6.3. *)
1048
+
(** Identity/set request arguments as defined in RFC8621 Section 6.3.
1049
+
Used to create, update, and destroy identities.
1050
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.3>
type identity_set_arguments = {
759
-
if_in_state : string option;
760
-
create : (id * identity_creation) list option;
761
-
update : (id * identity_update) list option;
762
-
destroy : id list option;
1053
+
account_id : id; (** The account to make changes in *)
1054
+
if_in_state : string option; (** Only apply changes if in this state *)
1055
+
create : (id * identity_creation) list option; (** Map of creation IDs to identities to create *)
1056
+
update : (id * identity_update) list option; (** Map of IDs to update properties *)
1057
+
destroy : id list option; (** List of IDs to destroy *)
1060
+
(** Properties for identity creation as defined in RFC8621 Section 6.3.
1061
+
Used to create new identities.
1062
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.3>
and identity_creation = {
768
-
reply_to : email_address list option;
769
-
bcc : email_address list option;
770
-
text_signature : string option;
771
-
html_signature : string option;
1065
+
name : string; (** Display name for the identity *)
1066
+
email : string; (** Email address for the identity *)
1067
+
reply_to : email_address list option; (** Reply-To addresses to use when sending *)
1068
+
bcc : email_address list option; (** BCC addresses to automatically include *)
1069
+
text_signature : string option; (** Plain text signature for the identity *)
1070
+
html_signature : string option; (** HTML signature for the identity *)
1073
+
(** Properties for identity update as defined in RFC8621 Section 6.3.
1074
+
Used to update existing identities.
1075
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.3>
775
-
name : string option;
776
-
email : string option;
777
-
reply_to : email_address list option;
778
-
bcc : email_address list option;
779
-
text_signature : string option;
780
-
html_signature : string option;
1078
+
name : string option; (** New display name for the identity *)
1079
+
email : string option; (** New email address for the identity *)
1080
+
reply_to : email_address list option; (** New Reply-To addresses to use *)
1081
+
bcc : email_address list option; (** New BCC addresses to automatically include *)
1082
+
text_signature : string option; (** New plain text signature *)
1083
+
html_signature : string option; (** New HTML signature *)
783
-
(** Identity/set response. See RFC8621 Section 6.3. *)
1086
+
(** Identity/set response as defined in RFC8621 Section 6.3.
1087
+
Reports the results of identity changes.
1088
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-6.3>
type identity_set_response = {
786
-
old_state : string option;
787
-
new_state : string;
788
-
created : (id * identity) list option;
789
-
updated : id list option;
790
-
destroyed : id list option;
791
-
not_created : (id * set_error) list option;
792
-
not_updated : (id * set_error) list option;
793
-
not_destroyed : (id * set_error) list option;
1091
+
account_id : id; (** The account that was modified *)
1092
+
old_state : string option; (** The state before processing, if changed *)
1093
+
new_state : string; (** The current state on the server *)
1094
+
created : (id * identity) list option; (** Map of creation IDs to created identities *)
1095
+
updated : id list option; (** List of IDs that were successfully updated *)
1096
+
destroyed : id list option; (** List of IDs that were successfully destroyed *)
1097
+
not_created : (id * set_error) list option; (** Map of IDs to errors for failed creates *)
1098
+
not_updated : (id * set_error) list option; (** Map of IDs to errors for failed updates *)
1099
+
not_destroyed : (id * set_error) list option; (** Map of IDs to errors for failed destroys *)
796
-
(** {1:vacation_response VacationResponse objects} *)
1102
+
(** {1:vacation_response VacationResponse objects}
1103
+
Vacation response types as defined in RFC8621 Section 7
1104
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7>
798
-
(** Vacation auto-reply setting. See RFC8621 Section 7. *)
1107
+
(** Vacation auto-reply setting as defined in RFC8621 Section 7.
1108
+
Represents an automatic vacation/out-of-office response.
1109
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7>
type vacation_response = {
802
-
from_date : utc_date option;
803
-
to_date : utc_date option;
804
-
subject : string option;
805
-
text_body : string option;
806
-
html_body : string option;
1112
+
id : id; (** Server-assigned ID for the vacation response *)
1113
+
is_enabled : bool; (** Whether the vacation response is active *)
1114
+
from_date : utc_date option; (** Start date-time of the vacation period *)
1115
+
to_date : utc_date option; (** End date-time of the vacation period *)
1116
+
subject : string option; (** Subject line for the vacation response *)
1117
+
text_body : string option; (** Plain text body for the vacation response *)
1118
+
html_body : string option; (** HTML body for the vacation response *)
809
-
(** VacationResponse/get request arguments. See RFC8621 Section 7.2. *)
1121
+
(** VacationResponse/get request arguments as defined in RFC8621 Section 7.2.
1122
+
Used to fetch vacation responses by ID.
1123
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7.2>
type vacation_response_get_arguments = {
812
-
ids : id list option;
813
-
properties : string list option;
1126
+
account_id : id; (** The account to fetch vacation responses from *)
1127
+
ids : id list option; (** The IDs of vacation responses to fetch, null means all *)
1128
+
properties : string list option; (** Properties to return, null means all *)
816
-
(** VacationResponse/get response. See RFC8621 Section 7.2. *)
1131
+
(** VacationResponse/get response as defined in RFC8621 Section 7.2.
1132
+
Contains requested vacation responses.
1133
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7.2>
type vacation_response_get_response = {
820
-
list : vacation_response list;
821
-
not_found : id list;
1136
+
account_id : id; (** The account from which vacation responses were fetched *)
1137
+
state : string; (** A string representing the state on the server *)
1138
+
list : vacation_response list; (** The list of vacation responses requested *)
1139
+
not_found : id list; (** IDs requested that could not be found *)
824
-
(** VacationResponse/set request arguments. See RFC8621 Section 7.3. *)
1142
+
(** VacationResponse/set request arguments as defined in RFC8621 Section 7.3.
1143
+
Used to update vacation responses.
1144
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7.3>
type vacation_response_set_arguments = {
827
-
if_in_state : string option;
828
-
update : (id * vacation_response_update) list;
1147
+
account_id : id; (** The account to make changes in *)
1148
+
if_in_state : string option; (** Only apply changes if in this state *)
1149
+
update : (id * vacation_response_update) list; (** Map of IDs to update properties *)
1152
+
(** Properties for vacation response update as defined in RFC8621 Section 7.3.
1153
+
Used to update existing vacation responses.
1154
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7.3>
and vacation_response_update = {
832
-
is_enabled : bool option;
833
-
from_date : utc_date option;
834
-
to_date : utc_date option;
835
-
subject : string option;
836
-
text_body : string option;
837
-
html_body : string option;
1157
+
is_enabled : bool option; (** Whether the vacation response is active *)
1158
+
from_date : utc_date option; (** Start date-time of the vacation period *)
1159
+
to_date : utc_date option; (** End date-time of the vacation period *)
1160
+
subject : string option; (** Subject line for the vacation response *)
1161
+
text_body : string option; (** Plain text body for the vacation response *)
1162
+
html_body : string option; (** HTML body for the vacation response *)
840
-
(** VacationResponse/set response. See RFC8621 Section 7.3. *)
1165
+
(** VacationResponse/set response as defined in RFC8621 Section 7.3.
1166
+
Reports the results of vacation response changes.
1167
+
@see <https://datatracker.ietf.org/doc/html/rfc8621#section-7.3>
type vacation_response_set_response = {
843
-
old_state : string option;
844
-
new_state : string;
845
-
updated : id list option;
846
-
not_updated : (id * set_error) list option;
1170
+
account_id : id; (** The account that was modified *)
1171
+
old_state : string option; (** The state before processing, if changed *)
1172
+
new_state : string; (** The current state on the server *)
1173
+
updated : id list option; (** List of IDs that were successfully updated *)
1174
+
not_updated : (id * set_error) list option; (** Map of IDs to errors for failed updates *)
849
-
(** {1:message_flags Message Flags and Mailbox Attributes} *)
1177
+
(** {1:message_flags Message Flags and Mailbox Attributes}
1178
+
Message flag types as defined in draft-ietf-mailmaint-messageflag-mailboxattribute-02
1179
+
@see <https://datatracker.ietf.org/doc/html/draft-ietf-mailmaint-messageflag-mailboxattribute>
851
-
(** Flag color defined by the combination of MailFlagBit0, MailFlagBit1, and MailFlagBit2 keywords *)
1182
+
(** Flag color defined by the combination of MailFlagBit0, MailFlagBit1, and MailFlagBit2 keywords
1183
+
as defined in draft-ietf-mailmaint-messageflag-mailboxattribute-02 Section 3.
1184
+
@see <https://datatracker.ietf.org/doc/html/draft-ietf-mailmaint-messageflag-mailboxattribute#section-3>
853
-
| Red (** Bit pattern 000 *)
854
-
| Orange (** Bit pattern 100 *)
855
-
| Yellow (** Bit pattern 010 *)
856
-
| Green (** Bit pattern 111 *)
857
-
| Blue (** Bit pattern 001 *)
858
-
| Purple (** Bit pattern 101 *)
859
-
| Gray (** Bit pattern 011 *)
1187
+
| Red (** Bit pattern 000 - default color *)
1188
+
| Orange (** Bit pattern 100 - MailFlagBit2 set *)
1189
+
| Yellow (** Bit pattern 010 - MailFlagBit1 set *)
1190
+
| Green (** Bit pattern 111 - all bits set *)
1191
+
| Blue (** Bit pattern 001 - MailFlagBit0 set *)
1192
+
| Purple (** Bit pattern 101 - MailFlagBit2 and MailFlagBit0 set *)
1193
+
| Gray (** Bit pattern 011 - MailFlagBit1 and MailFlagBit0 set *)
861
-
(** Standard message keywords as defined in draft-ietf-mailmaint-messageflag-mailboxattribute-02 *)
1195
+
(** Standard message keywords as defined in draft-ietf-mailmaint-messageflag-mailboxattribute-02 Section 4.1.
1196
+
These are standardized keywords that can be applied to email messages.
1197
+
@see <https://datatracker.ietf.org/doc/html/draft-ietf-mailmaint-messageflag-mailboxattribute#section-4.1>
| Notify (** Indicate a notification should be shown for this message *)
| Muted (** User is not interested in future replies to this thread *)
···
| MailFlagBit2 (** Bit 2 of the 3-bit flag color pattern *)
| OtherKeyword of string (** Other non-standard keywords *)
882
-
(** Special mailbox attribute names as defined in draft-ietf-mailmaint-messageflag-mailboxattribute-02 *)
1219
+
(** Special mailbox attribute names as defined in draft-ietf-mailmaint-messageflag-mailboxattribute-02 Section 4.2.
1220
+
These are standardized attributes for special-purpose mailboxes.
1221
+
@see <https://datatracker.ietf.org/doc/html/draft-ietf-mailmaint-messageflag-mailboxattribute#section-4.2>
| Snoozed (** Mailbox containing messages that have been snoozed *)
| Scheduled (** Mailbox containing messages scheduled to be sent later *)
| Memos (** Mailbox containing messages with the $memo keyword *)
| OtherAttribute of string (** Other non-standard mailbox attributes *)
889
-
(** Functions for working with flag colors *)
1229
+
(** Convert bit values to a flag color
1230
+
@param bit0 Value of bit 0 (least significant bit)
1231
+
@param bit1 Value of bit 1
1232
+
@param bit2 Value of bit 2 (most significant bit)
1233
+
@return The corresponding flag color
val flag_color_of_bits : bool -> bool -> bool -> flag_color
892
-
(** Get bits for a flag color *)
1237
+
(** Get the bit values for a flag color
1238
+
@param color The flag color
1239
+
@return Tuple of (bit2, bit1, bit0) values
val bits_of_flag_color : flag_color -> bool * bool * bool
895
-
(** Check if a message has a flag color based on its keywords *)
1243
+
(** Check if a message has a flag color based on its keywords
1244
+
@param keywords The list of keywords for the message
1245
+
@return True if the message has one or more flag color bits set
val has_flag_color : (keyword * bool) list -> bool
898
-
(** Get the flag color from a message's keywords, if present *)
1249
+
(** Get the flag color from a message's keywords, if present
1250
+
@param keywords The list of keywords for the message
1251
+
@return The flag color if all required bits are present, None otherwise
val get_flag_color : (keyword * bool) list -> flag_color option
901
-
(** Convert a message keyword to its string representation *)
1255
+
(** Convert a message keyword to its string representation
1256
+
@param keyword The message keyword
1257
+
@return String representation with $ prefix (e.g., "$notify")
val string_of_message_keyword : message_keyword -> string
904
-
(** Parse a string into a message keyword *)
1261
+
(** Parse a string into a message keyword
1262
+
@param s The string to parse (with or without $ prefix)
1263
+
@return The corresponding message keyword
val message_keyword_of_string : string -> message_keyword
907
-
(** Convert a mailbox attribute to its string representation *)
1267
+
(** Convert a mailbox attribute to its string representation
1268
+
@param attr The mailbox attribute
1269
+
@return String representation with $ prefix (e.g., "$snoozed")
val string_of_mailbox_attribute : mailbox_attribute -> string
910
-
(** Parse a string into a mailbox attribute *)
1273
+
(** Parse a string into a mailbox attribute
1274
+
@param s The string to parse (with or without $ prefix)
1275
+
@return The corresponding mailbox attribute
val mailbox_attribute_of_string : string -> mailbox_attribute
913
-
(** Get a human-readable representation of a flag color *)
1279
+
(** Get a human-readable representation of a flag color
1280
+
@param color The flag color
1281
+
@return Human-readable name of the color
val human_readable_flag_color : flag_color -> string
916
-
(** Get a human-readable representation of a message keyword *)
1285
+
(** Get a human-readable representation of a message keyword
1286
+
@param keyword The message keyword
1287
+
@return Human-readable description of the keyword
val human_readable_message_keyword : message_keyword -> string
919
-
(** Format email keywords into a human-readable string representation *)
1291
+
(** Format email keywords into a human-readable string representation
1292
+
@param keywords The list of keywords and their values
1293
+
@return Human-readable comma-separated list of keywords
val format_email_keywords : (keyword * bool) list -> string
923
-
(** {1 JSON serialization} *)
1298
+
(** {1 JSON serialization}
1299
+
Functions for serializing and deserializing JMAP Mail objects to/from JSON
928
-
(** {2 Helper functions for serialization} *)
1305
+
(** {2 Helper functions for serialization}
1306
+
Utility functions for converting between OCaml types and JSON representation
1309
+
(** Convert a mailbox role to its string representation
1310
+
@param role The mailbox role
1311
+
@return String representation (e.g., "inbox", "drafts", etc.)
val string_of_mailbox_role : mailbox_role -> string
1315
+
(** Parse a string into a mailbox role
1316
+
@param s The string to parse
1317
+
@return The corresponding mailbox role, or Unknown if not recognized
val mailbox_role_of_string : string -> mailbox_role
1321
+
(** Convert an email keyword to its string representation
1322
+
@param keyword The email keyword
1323
+
@return String representation with $ prefix (e.g., "$flagged")
val string_of_keyword : keyword -> string
1327
+
(** Parse a string into an email keyword
1328
+
@param s The string to parse (with or without $ prefix)
1329
+
@return The corresponding email keyword
val keyword_of_string : string -> keyword
936
-
(** {2 Mailbox serialization} *)
1333
+
(** {2 Mailbox serialization}
1334
+
Functions for serializing and deserializing mailbox objects
(** TODO:claude - Need to implement all JSON serialization functions
for each type we've defined. This would be a substantial amount of
···
951
-
(** {1 API functions} *)
1350
+
(** {1 API functions}
1351
+
High-level functions for interacting with JMAP Mail servers
(** Authentication credentials for a JMAP server *)
1356
+
username: string; (** Username for authentication *)
1357
+
password: string; (** Password for authentication *)
(** Connection to a JMAP mail server *)
961
-
session: Jmap.Types.session;
962
-
config: Jmap.Api.config;
1362
+
session: Jmap.Types.session; (** Session information from the server *)
1363
+
config: Jmap.Api.config; (** Configuration for API requests *)
(** Login to a JMAP server and establish a connection
@param uri The URI of the JMAP server
@param credentials Authentication credentials
968
-
@return A connection object if successful
1369
+
@return A connection object if successful
1371
+
Creates a new connection to a JMAP server using username/password authentication.
credentials:credentials ->
···
@param api_token The API token for authentication
@return A connection object if successful
1383
+
Creates a new connection to a JMAP server using Bearer token authentication.
···
@param account_id The account ID to get mailboxes for
@return A list of mailboxes if successful
1395
+
Retrieves all mailboxes (folders) in the specified account.
account_id:Jmap.Types.id ->
···
@param mailbox_id The mailbox ID to retrieve
@return The mailbox if found
1408
+
Retrieves a single mailbox by its ID.
account_id:Jmap.Types.id ->
···
@param limit Optional limit on number of messages to return
@return The list of email messages if successful
1423
+
Retrieves email messages in the specified mailbox, with optional limit.
val get_messages_in_mailbox :
account_id:Jmap.Types.id ->
···
@param email_id The email ID to retrieve
@return The email message if found
1439
+
Retrieves a single email message by its ID.
account_id:Jmap.Types.id ->
···
@param keyword The message keyword to look for
@return true if the email has the keyword, false otherwise
1452
+
Tests whether an email has a particular keyword (flag) set.
val has_message_keyword :
···
@param keyword The message keyword to add
1466
+
Adds a keyword (flag) to an email message.
val add_message_keyword :
account_id:Jmap.Types.id ->
···
@param color The flag color to set
1482
+
Sets a flag color on an email message by setting the appropriate bit flags.
account_id:Jmap.Types.id ->
···
@param email The email to analyze
@return List of message keywords
1495
+
Extracts all message keywords from an email's keyword list.
val get_message_keywords :
Types.message_keyword list
···
@param limit Optional limit on number of emails to return
@return List of emails with the keyword if successful
1508
+
Retrieves all emails that have a specific keyword (flag) set.
val get_emails_with_keyword :
account_id:Jmap.Types.id ->
···
(Types.email list, Jmap.Api.error) result Lwt.t
1106
-
(** {1 Email Address Utilities} *)
1518
+
(** {1 Email Address Utilities}
1519
+
Utilities for working with email addresses
(** Check if an email address matches a filter string
@param email The email address to check
···
@param email The email object to check
@param pattern The sender filter pattern
@return True if any sender address matches the filter
1540
+
Tests whether any of an email's sender addresses match the provided pattern.
val email_matches_sender : Types.email -> string -> bool