this repo has no description
1(** JMAP Thread.
2 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3> RFC 8621, Section 3 *)
3
4open Jmap.Types
5open Jmap.Methods
6
7(** Thread object.
8 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3> RFC 8621, Section 3 *)
9module Thread : sig
10 type t
11
12 (** Get the thread ID (server-set, immutable) *)
13 val id : t -> id
14
15 (** Get the IDs of emails in the thread (server-set) *)
16 val email_ids : t -> id list
17
18 (** Create a new Thread object *)
19 val v : id:id -> email_ids:id list -> t
20end
21
22(** Thread properties that can be requested in Thread/get.
23 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3.1> RFC 8621, Section 3.1 *)
24type property =
25 | Id (** The Thread id *)
26 | EmailIds (** The list of email IDs in the Thread *)
27
28(** Convert a property variant to its string representation *)
29val property_to_string : property -> string
30
31(** Parse a string into a property variant *)
32val string_to_property : string -> property
33
34(** Get a list of all standard Thread properties *)
35val all_properties : property list
36
37(** {1 Thread Methods} *)
38
39(** Arguments for Thread/get - extends standard get arguments.
40 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3.1> RFC 8621, Section 3.1 *)
41module Get_args : sig
42 type t
43
44 val account_id : t -> id
45 val ids : t -> id list option
46 val properties : t -> string list option
47
48 val v :
49 account_id:id ->
50 ?ids:id list ->
51 ?properties:string list ->
52 unit -> t
53end
54
55(** Response for Thread/get - extends standard get response.
56 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3.1> RFC 8621, Section 3.1 *)
57module Get_response : sig
58 type t
59
60 val account_id : t -> id
61 val state : t -> string
62 val list : t -> Thread.t list
63 val not_found : t -> id list
64
65 val v :
66 account_id:id ->
67 state:string ->
68 list:Thread.t list ->
69 not_found:id list ->
70 unit -> t
71end
72
73(** Arguments for Thread/changes - extends standard changes arguments.
74 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3.2> RFC 8621, Section 3.2 *)
75module Changes_args : sig
76 type t
77
78 val account_id : t -> id
79 val since_state : t -> string
80 val max_changes : t -> uint option
81
82 val v :
83 account_id:id ->
84 since_state:string ->
85 ?max_changes:uint ->
86 unit -> t
87end
88
89(** Response for Thread/changes - extends standard changes response.
90 @see <https://www.rfc-editor.org/rfc/rfc8621.html#section-3.2> RFC 8621, Section 3.2 *)
91module Changes_response : sig
92 type t
93
94 val account_id : t -> id
95 val old_state : t -> string
96 val new_state : t -> string
97 val has_more_changes : t -> bool
98 val created : t -> id list
99 val updated : t -> id list
100 val destroyed : t -> id list
101
102 val v :
103 account_id:id ->
104 old_state:string ->
105 new_state:string ->
106 has_more_changes:bool ->
107 created:id list ->
108 updated:id list ->
109 destroyed:id list ->
110 unit -> t
111end
112
113(** {1 Helper Functions} *)
114
115(** Create a filter to find threads with specific email ID *)
116val filter_has_email : id -> Filter.t
117
118(** Create a filter to find threads with emails from a specific sender *)
119val filter_from : string -> Filter.t
120
121(** Create a filter to find threads with emails to a specific recipient *)
122val filter_to : string -> Filter.t
123
124(** Create a filter to find threads with specific subject *)
125val filter_subject : string -> Filter.t
126
127(** Create a filter to find threads with emails received before a date *)
128val filter_before : date -> Filter.t
129
130(** Create a filter to find threads with emails received after a date *)
131val filter_after : date -> Filter.t