This repository has no description
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** Mailbox type as defined in RFC 8621 Section 2
7
8 @canonical Jmap.Proto.Mailbox *)
9
10(** {1 Mailbox Rights} *)
11
12(** Rights the user has on a mailbox. *)
13module Rights : sig
14 type t = {
15 may_read_items : bool;
16 may_add_items : bool;
17 may_remove_items : bool;
18 may_set_seen : bool;
19 may_set_keywords : bool;
20 may_create_child : bool;
21 may_rename : bool;
22 may_delete : bool;
23 may_submit : bool;
24 }
25
26 val may_read_items : t -> bool
27 val may_add_items : t -> bool
28 val may_remove_items : t -> bool
29 val may_set_seen : t -> bool
30 val may_set_keywords : t -> bool
31 val may_create_child : t -> bool
32 val may_rename : t -> bool
33 val may_delete : t -> bool
34 val may_submit : t -> bool
35
36 val jsont : t Jsont.t
37end
38
39(** {1 Standard Roles} *)
40
41(** Standard mailbox roles per RFC 8621 Section 2 and draft-ietf-mailmaint. *)
42type role = [
43 | `All
44 | `Archive
45 | `Drafts
46 | `Flagged
47 | `Important
48 | `Inbox
49 | `Junk
50 | `Sent
51 | `Subscribed
52 | `Trash
53 | `Snoozed (** draft-ietf-mailmaint: Messages snoozed until a later time. *)
54 | `Scheduled (** draft-ietf-mailmaint: Messages scheduled to send. *)
55 | `Memos (** draft-ietf-mailmaint: Messages with the $memo keyword. *)
56 | `Other of string
57]
58
59val role_to_string : role -> string
60val role_of_string : string -> role
61val role_jsont : role Jsont.t
62
63(** {1 Mailbox} *)
64
65type t = {
66 id : Proto_id.t;
67 (** Server-assigned mailbox id. *)
68 name : string;
69 (** User-visible name (UTF-8). *)
70 parent_id : Proto_id.t option;
71 (** Id of parent mailbox, or [None] for root. *)
72 role : role option;
73 (** Standard role, if any. *)
74 sort_order : int64;
75 (** Sort order hint (lower = displayed first). *)
76 total_emails : int64;
77 (** Total number of emails in mailbox. *)
78 unread_emails : int64;
79 (** Number of unread emails. *)
80 total_threads : int64;
81 (** Total number of threads. *)
82 unread_threads : int64;
83 (** Number of threads with unread emails. *)
84 my_rights : Rights.t;
85 (** User's rights on this mailbox. *)
86 is_subscribed : bool;
87 (** Whether user is subscribed to this mailbox. *)
88}
89
90val id : t -> Proto_id.t
91val name : t -> string
92val parent_id : t -> Proto_id.t option
93val role : t -> role option
94val sort_order : t -> int64
95val total_emails : t -> int64
96val unread_emails : t -> int64
97val total_threads : t -> int64
98val unread_threads : t -> int64
99val my_rights : t -> Rights.t
100val is_subscribed : t -> bool
101
102val jsont : t Jsont.t
103
104(** {1 Mailbox Filter Conditions} *)
105
106(** Filter conditions for Mailbox/query. *)
107module Filter_condition : sig
108 type t = {
109 parent_id : Proto_id.t option option;
110 (** Filter by parent. [Some None] = top-level only. *)
111 name : string option;
112 (** Filter by exact name match. *)
113 role : role option option;
114 (** Filter by role. [Some None] = no role. *)
115 has_any_role : bool option;
116 (** Filter by whether mailbox has any role. *)
117 is_subscribed : bool option;
118 (** Filter by subscription status. *)
119 }
120
121 val jsont : t Jsont.t
122end