···
(** Arguments for /get methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.1> RFC 8620, Section 5.1 *)
13
-
type 'record get_args = {
14
-
get_account_id : id;
15
-
get_ids : id list option;
16
-
get_properties : string list option;
13
+
module Get_args : sig
16
+
val account_id : 'record t -> id
17
+
val ids : 'record t -> id list option
18
+
val properties : 'record t -> string list option
23
+
?properties:string list ->
(** Response for /get methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.1> RFC 8620, Section 5.1 *)
21
-
type 'record get_response = {
22
-
get_resp_account_id : id;
23
-
get_resp_state : string;
24
-
get_resp_list : 'record list;
25
-
get_resp_not_found : id list;
30
+
module Get_response : sig
33
+
val account_id : 'record t -> id
34
+
val state : 'record t -> string
35
+
val list : 'record t -> 'record list
36
+
val not_found : 'record t -> id list
41
+
list:'record list ->
42
+
not_found:id list ->
(** Arguments for /changes methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.2> RFC 8620, Section 5.2 *)
30
-
type changes_args = {
31
-
changes_account_id : id;
32
-
changes_since_state : string;
33
-
changes_max_changes : uint option;
49
+
module Changes_args : sig
52
+
val account_id : t -> id
53
+
val since_state : t -> string
54
+
val max_changes : t -> uint option
58
+
since_state:string ->
59
+
?max_changes:uint ->
(** Response for /changes methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.2> RFC 8620, Section 5.2 *)
38
-
type changes_response = {
39
-
changes_resp_account_id : id;
40
-
changes_resp_old_state : string;
41
-
changes_resp_new_state : string;
42
-
changes_resp_has_more_changes : bool;
43
-
changes_resp_created : id list;
44
-
changes_resp_updated : id list;
45
-
changes_resp_destroyed : id list;
46
-
changes_resp_updated_properties : string list option; (* Mailbox/changes specific *)
66
+
module Changes_response : sig
69
+
val account_id : t -> id
70
+
val old_state : t -> string
71
+
val new_state : t -> string
72
+
val has_more_changes : t -> bool
73
+
val created : t -> id list
74
+
val updated : t -> id list
75
+
val destroyed : t -> id list
76
+
val updated_properties : t -> string list option
82
+
has_more_changes:bool ->
85
+
destroyed:id list ->
86
+
?updated_properties:string list ->
(** Patch object for /set update.
A list of (JSON Pointer path, value) pairs.
···
['create_record] is the record type without server-set/immutable fields.
['update_record] is the patch object type (usually [patch_object]).
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
58
-
type ('create_record, 'update_record) set_args = {
59
-
set_account_id : id;
60
-
set_if_in_state : string option;
61
-
set_create : 'create_record id_map option;
62
-
set_update : 'update_record id_map option;
63
-
set_destroy : id list option;
64
-
set_on_success_destroy_original : bool option; (* For /copy *)
65
-
set_destroy_from_if_in_state : string option; (* For /copy *)
66
-
set_on_destroy_remove_emails : bool option; (* For Mailbox/set *)
100
+
module Set_args : sig
101
+
type ('create_record, 'update_record) t
103
+
val account_id : ('a, 'b) t -> id
104
+
val if_in_state : ('a, 'b) t -> string option
105
+
val create : ('a, 'b) t -> 'a id_map option
106
+
val update : ('a, 'b) t -> 'b id_map option
107
+
val destroy : ('a, 'b) t -> id list option
108
+
val on_success_destroy_original : ('a, 'b) t -> bool option
109
+
val destroy_from_if_in_state : ('a, 'b) t -> string option
110
+
val on_destroy_remove_emails : ('a, 'b) t -> bool option
114
+
?if_in_state:string ->
115
+
?create:'a id_map ->
116
+
?update:'b id_map ->
117
+
?destroy:id list ->
118
+
?on_success_destroy_original:bool ->
119
+
?destroy_from_if_in_state:string ->
120
+
?on_destroy_remove_emails:bool ->
(** Response for /set methods.
['created_record_info] is the server-set info for created records.
['updated_record_info] is the server-set/computed info for updated records.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
73
-
type ('created_record_info, 'updated_record_info) set_response = {
74
-
set_resp_account_id : id;
75
-
set_resp_old_state : string option;
76
-
set_resp_new_state : string;
77
-
set_resp_created : 'created_record_info id_map option;
78
-
set_resp_updated : 'updated_record_info option id_map option;
79
-
set_resp_destroyed : id list option;
80
-
set_resp_not_created : set_error id_map option;
81
-
set_resp_not_updated : set_error id_map option;
82
-
set_resp_not_destroyed : set_error id_map option;
129
+
module Set_response : sig
130
+
type ('created_record_info, 'updated_record_info) t
132
+
val account_id : ('a, 'b) t -> id
133
+
val old_state : ('a, 'b) t -> string option
134
+
val new_state : ('a, 'b) t -> string
135
+
val created : ('a, 'b) t -> 'a id_map option
136
+
val updated : ('a, 'b) t -> 'b option id_map option
137
+
val destroyed : ('a, 'b) t -> id list option
138
+
val not_created : ('a, 'b) t -> Set_error.t id_map option
139
+
val not_updated : ('a, 'b) t -> Set_error.t id_map option
140
+
val not_destroyed : ('a, 'b) t -> Set_error.t id_map option
144
+
?old_state:string ->
145
+
new_state:string ->
146
+
?created:'a id_map ->
147
+
?updated:'b option id_map ->
148
+
?destroyed:id list ->
149
+
?not_created:Set_error.t id_map ->
150
+
?not_updated:Set_error.t id_map ->
151
+
?not_destroyed:Set_error.t id_map ->
(** Arguments for /copy methods.
['copy_record_override] contains the record id and override properties.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.4> RFC 8620, Section 5.4 *)
88
-
type 'copy_record_override copy_args = {
89
-
copy_from_account_id : id;
90
-
copy_if_from_in_state : string option;
91
-
copy_account_id : id;
92
-
copy_if_in_state : string option;
93
-
copy_create : 'copy_record_override id_map; (* Map from creation id *)
94
-
copy_on_success_destroy_original : bool; (* default: false *)
95
-
copy_destroy_from_if_in_state : string option;
159
+
module Copy_args : sig
160
+
type 'copy_record_override t
162
+
val from_account_id : 'a t -> id
163
+
val if_from_in_state : 'a t -> string option
164
+
val account_id : 'a t -> id
165
+
val if_in_state : 'a t -> string option
166
+
val create : 'a t -> 'a id_map
167
+
val on_success_destroy_original : 'a t -> bool
168
+
val destroy_from_if_in_state : 'a t -> string option
171
+
from_account_id:id ->
172
+
?if_from_in_state:string ->
174
+
?if_in_state:string ->
175
+
create:'a id_map ->
176
+
?on_success_destroy_original:bool ->
177
+
?destroy_from_if_in_state:string ->
(** Response for /copy methods.
['created_record_info] is the server-set info for the created copy.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.4> RFC 8620, Section 5.4 *)
101
-
type 'created_record_info copy_response = {
102
-
copy_resp_from_account_id : id;
103
-
copy_resp_account_id : id;
104
-
copy_resp_old_state : string option;
105
-
copy_resp_new_state : string;
106
-
copy_resp_created : 'created_record_info id_map option;
107
-
copy_resp_not_created : set_error id_map option;
185
+
module Copy_response : sig
186
+
type 'created_record_info t
188
+
val from_account_id : 'a t -> id
189
+
val account_id : 'a t -> id
190
+
val old_state : 'a t -> string option
191
+
val new_state : 'a t -> string
192
+
val created : 'a t -> 'a id_map option
193
+
val not_created : 'a t -> Set_error.t id_map option
196
+
from_account_id:id ->
198
+
?old_state:string ->
199
+
new_state:string ->
200
+
?created:'a id_map ->
201
+
?not_created:Set_error.t id_map ->
110
-
(** Base filter operator type.
206
+
(** Module for filter types.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
112
-
type filter_operator = {
113
-
operator : [ `AND | `OR | `NOT ];
114
-
conditions : filter list;
117
-
(** Represents either a filter operator or a filter condition.
118
-
['condition] is the type of the specific FilterCondition object.
119
-
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
121
-
| Filter_operator of filter_operator
122
-
| Filter_condition of Yojson.Safe.t (* Placeholder for specific condition type *)
208
+
module Filter : sig
211
+
(** Create a filter from a condition (raw JSON) *)
212
+
val condition : Yojson.Safe.t -> t
214
+
(** Create a filter from a logical operator and a list of filters *)
215
+
val operator : [ `AND | `OR | `NOT ] -> t list -> t
(** Comparator for sorting.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
126
-
type comparator = {
128
-
is_ascending : bool option; (* default: true *)
129
-
collation : string option;
130
-
keyword : string option; (* For Email/query keyword sorts *)
131
-
other_fields : Yojson.Safe.t string_map; (** Catch-all for extra fields *)
220
+
module Comparator : sig
223
+
val property : t -> string
224
+
val is_ascending : t -> bool option
225
+
val collation : t -> string option
226
+
val keyword : t -> string option
227
+
val other_fields : t -> Yojson.Safe.t string_map
231
+
?is_ascending:bool ->
232
+
?collation:string ->
234
+
?other_fields:Yojson.Safe.t string_map ->
(** Arguments for /query methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
136
-
type query_args = {
137
-
query_account_id : id;
138
-
query_filter : filter option;
139
-
query_sort : comparator list option;
140
-
query_position : jint option; (* default: 0 *)
141
-
query_anchor : id option;
142
-
query_anchor_offset : jint option; (* default: 0 *)
143
-
query_limit : uint option;
144
-
query_calculate_total : bool option; (* default: false *)
145
-
query_collapse_threads : bool option; (* For Email/query *)
146
-
query_sort_as_tree : bool option; (* For Mailbox/query *)
147
-
query_filter_as_tree : bool option; (* For Mailbox/query *)
241
+
module Query_args : sig
244
+
val account_id : t -> id
245
+
val filter : t -> Filter.t option
246
+
val sort : t -> Comparator.t list option
247
+
val position : t -> jint option
248
+
val anchor : t -> id option
249
+
val anchor_offset : t -> jint option
250
+
val limit : t -> uint option
251
+
val calculate_total : t -> bool option
252
+
val collapse_threads : t -> bool option
253
+
val sort_as_tree : t -> bool option
254
+
val filter_as_tree : t -> bool option
258
+
?filter:Filter.t ->
259
+
?sort:Comparator.t list ->
262
+
?anchor_offset:jint ->
264
+
?calculate_total:bool ->
265
+
?collapse_threads:bool ->
266
+
?sort_as_tree:bool ->
267
+
?filter_as_tree:bool ->
(** Response for /query methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
152
-
type query_response = {
153
-
query_resp_account_id : id;
154
-
query_resp_query_state : string;
155
-
query_resp_can_calculate_changes : bool;
156
-
query_resp_position : uint;
157
-
query_resp_ids : id list;
158
-
query_resp_total : uint option;
159
-
query_resp_limit : uint option;
274
+
module Query_response : sig
277
+
val account_id : t -> id
278
+
val query_state : t -> string
279
+
val can_calculate_changes : t -> bool
280
+
val position : t -> uint
281
+
val ids : t -> id list
282
+
val total : t -> uint option
283
+
val limit : t -> uint option
287
+
query_state:string ->
288
+
can_calculate_changes:bool ->
(** Item indicating an added record in /queryChanges.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
164
-
type added_item = {
165
-
added_item_id : id;
166
-
added_item_index : uint;
299
+
module Added_item : sig
303
+
val index : t -> uint
(** Arguments for /queryChanges methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
171
-
type query_changes_args = {
172
-
query_changes_account_id : id;
173
-
query_changes_filter : filter option;
174
-
query_changes_sort : comparator list option;
175
-
query_changes_since_query_state : string;
176
-
query_changes_max_changes : uint option;
177
-
query_changes_up_to_id : id option;
178
-
query_changes_calculate_total : bool option; (* default: false *)
179
-
query_changes_collapse_threads : bool option; (* For Email/queryChanges *)
314
+
module Query_changes_args : sig
317
+
val account_id : t -> id
318
+
val filter : t -> Filter.t option
319
+
val sort : t -> Comparator.t list option
320
+
val since_query_state : t -> string
321
+
val max_changes : t -> uint option
322
+
val up_to_id : t -> id option
323
+
val calculate_total : t -> bool option
324
+
val collapse_threads : t -> bool option
328
+
?filter:Filter.t ->
329
+
?sort:Comparator.t list ->
330
+
since_query_state:string ->
331
+
?max_changes:uint ->
333
+
?calculate_total:bool ->
334
+
?collapse_threads:bool ->
(** Response for /queryChanges methods.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
184
-
type query_changes_response = {
185
-
query_changes_resp_account_id : id;
186
-
query_changes_resp_old_query_state : string;
187
-
query_changes_resp_new_query_state : string;
188
-
query_changes_resp_total : uint option;
189
-
query_changes_resp_removed : id list;
190
-
query_changes_resp_added : added_item list;
341
+
module Query_changes_response : sig
344
+
val account_id : t -> id
345
+
val old_query_state : t -> string
346
+
val new_query_state : t -> string
347
+
val total : t -> uint option
348
+
val removed : t -> id list
349
+
val added : t -> Added_item.t list
353
+
old_query_state:string ->
354
+
new_query_state:string ->
357
+
added:Added_item.t list ->
(** Core/echo method: Arguments are mirrored in the response.
@see <https://www.rfc-editor.org/rfc/rfc8620.html#section-4> RFC 8620, Section 4 *)