Testing a Gemini codegen run
1(** Standard JMAP Methods and Core/echo.
2 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-4> RFC 8620, Section 4
3 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5> RFC 8620, Section 5 *)
4
5open Jmap_types
6open Jmap_error
7
8(** Generic representation of a record type. Actual types defined elsewhere. *)
9type generic_record
10
11(** Arguments for /get methods.
12 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.1> RFC 8620, Section 5.1 *)
13module Get_args : sig
14 type 'record t
15
16 val account_id : 'record t -> id
17 val ids : 'record t -> id list option
18 val properties : 'record t -> string list option
19
20 val v :
21 account_id:id ->
22 ?ids:id list ->
23 ?properties:string list ->
24 unit ->
25 'record t
26end
27
28(** Response for /get methods.
29 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.1> RFC 8620, Section 5.1 *)
30module Get_response : sig
31 type 'record t
32
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
37
38 val v :
39 account_id:id ->
40 state:string ->
41 list:'record list ->
42 not_found:id list ->
43 unit ->
44 'record t
45end
46
47(** Arguments for /changes methods.
48 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.2> RFC 8620, Section 5.2 *)
49module Changes_args : sig
50 type t
51
52 val account_id : t -> id
53 val since_state : t -> string
54 val max_changes : t -> uint option
55
56 val v :
57 account_id:id ->
58 since_state:string ->
59 ?max_changes:uint ->
60 unit ->
61 t
62end
63
64(** Response for /changes methods.
65 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.2> RFC 8620, Section 5.2 *)
66module Changes_response : sig
67 type t
68
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
77
78 val v :
79 account_id:id ->
80 old_state:string ->
81 new_state:string ->
82 has_more_changes:bool ->
83 created:id list ->
84 updated:id list ->
85 destroyed:id list ->
86 ?updated_properties:string list ->
87 unit ->
88 t
89end
90
91(** Patch object for /set update.
92 A list of (JSON Pointer path, value) pairs.
93 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
94type patch_object = (json_pointer * Yojson.Safe.t) list
95
96(** Arguments for /set methods.
97 ['create_record] is the record type without server-set/immutable fields.
98 ['update_record] is the patch object type (usually [patch_object]).
99 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
100module Set_args : sig
101 type ('create_record, 'update_record) t
102
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
111
112 val v :
113 account_id:id ->
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 ->
121 unit ->
122 ('a, 'b) t
123end
124
125(** Response for /set methods.
126 ['created_record_info] is the server-set info for created records.
127 ['updated_record_info] is the server-set/computed info for updated records.
128 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.3> RFC 8620, Section 5.3 *)
129module Set_response : sig
130 type ('created_record_info, 'updated_record_info) t
131
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
141
142 val v :
143 account_id:id ->
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 ->
152 unit ->
153 ('a, 'b) t
154end
155
156(** Arguments for /copy methods.
157 ['copy_record_override] contains the record id and override properties.
158 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.4> RFC 8620, Section 5.4 *)
159module Copy_args : sig
160 type 'copy_record_override t
161
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
169
170 val v :
171 from_account_id:id ->
172 ?if_from_in_state:string ->
173 account_id:id ->
174 ?if_in_state:string ->
175 create:'a id_map ->
176 ?on_success_destroy_original:bool ->
177 ?destroy_from_if_in_state:string ->
178 unit ->
179 'a t
180end
181
182(** Response for /copy methods.
183 ['created_record_info] is the server-set info for the created copy.
184 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.4> RFC 8620, Section 5.4 *)
185module Copy_response : sig
186 type 'created_record_info t
187
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
194
195 val v :
196 from_account_id:id ->
197 account_id:id ->
198 ?old_state:string ->
199 new_state:string ->
200 ?created:'a id_map ->
201 ?not_created:Set_error.t id_map ->
202 unit ->
203 'a t
204end
205
206(** Module for filter types.
207 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
208module Filter : sig
209 type t
210
211 (** Create a filter from a condition (raw JSON) *)
212 val condition : Yojson.Safe.t -> t
213
214 (** Create a filter from a logical operator and a list of filters *)
215 val operator : [ `AND | `OR | `NOT ] -> t list -> t
216end
217
218(** Comparator for sorting.
219 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
220module Comparator : sig
221 type t
222
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
228
229 val v :
230 property:string ->
231 ?is_ascending:bool ->
232 ?collation:string ->
233 ?keyword:string ->
234 ?other_fields:Yojson.Safe.t string_map ->
235 unit ->
236 t
237end
238
239(** Arguments for /query methods.
240 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
241module Query_args : sig
242 type t
243
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
255
256 val v :
257 account_id:id ->
258 ?filter:Filter.t ->
259 ?sort:Comparator.t list ->
260 ?position:jint ->
261 ?anchor:id ->
262 ?anchor_offset:jint ->
263 ?limit:uint ->
264 ?calculate_total:bool ->
265 ?collapse_threads:bool ->
266 ?sort_as_tree:bool ->
267 ?filter_as_tree:bool ->
268 unit ->
269 t
270end
271
272(** Response for /query methods.
273 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.5> RFC 8620, Section 5.5 *)
274module Query_response : sig
275 type t
276
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
284
285 val v :
286 account_id:id ->
287 query_state:string ->
288 can_calculate_changes:bool ->
289 position:uint ->
290 ids:id list ->
291 ?total:uint ->
292 ?limit:uint ->
293 unit ->
294 t
295end
296
297(** Item indicating an added record in /queryChanges.
298 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
299module Added_item : sig
300 type t
301
302 val id : t -> id
303 val index : t -> uint
304
305 val v :
306 id:id ->
307 index:uint ->
308 unit ->
309 t
310end
311
312(** Arguments for /queryChanges methods.
313 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
314module Query_changes_args : sig
315 type t
316
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
325
326 val v :
327 account_id:id ->
328 ?filter:Filter.t ->
329 ?sort:Comparator.t list ->
330 since_query_state:string ->
331 ?max_changes:uint ->
332 ?up_to_id:id ->
333 ?calculate_total:bool ->
334 ?collapse_threads:bool ->
335 unit ->
336 t
337end
338
339(** Response for /queryChanges methods.
340 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-5.6> RFC 8620, Section 5.6 *)
341module Query_changes_response : sig
342 type t
343
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
350
351 val v :
352 account_id:id ->
353 old_query_state:string ->
354 new_query_state:string ->
355 ?total:uint ->
356 removed:id list ->
357 added:Added_item.t list ->
358 unit ->
359 t
360end
361
362(** Core/echo method: Arguments are mirrored in the response.
363 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-4> RFC 8620, Section 4 *)
364type core_echo_args = Yojson.Safe.t
365type core_echo_response = Yojson.Safe.t