My agentic slop goes here. Not intended for anyone else!
1(** JMAP Standard Method Types *)
2
3(** Standard /get method (RFC 8620 Section 5.1) *)
4module Get : sig
5 type 'a request = {
6 account_id : Jmap_id.t;
7 ids : Jmap_id.t list option;
8 properties : string list option;
9 }
10
11 type 'a response = {
12 account_id : Jmap_id.t;
13 state : string;
14 list : 'a list;
15 not_found : Jmap_id.t list;
16 }
17
18 (** Accessors for request *)
19 val account_id : 'a request -> Jmap_id.t
20 val ids : 'a request -> Jmap_id.t list option
21 val properties : 'a request -> string list option
22
23 (** Constructor for request *)
24 val v : account_id:Jmap_id.t -> ?ids:Jmap_id.t list -> ?properties:string list -> unit -> 'a request
25
26 (** Accessors for response *)
27 val response_account_id : 'a response -> Jmap_id.t
28 val state : 'a response -> string
29 val list : 'a response -> 'a list
30 val not_found : 'a response -> Jmap_id.t list
31
32 (** Constructor for response *)
33 val response_v : account_id:Jmap_id.t -> state:string -> list:'a list -> not_found:Jmap_id.t list -> 'a response
34
35 (** Convert request to JSON *)
36 val request_to_json : 'a request -> Ezjsonm.value
37
38 (** Parse request from JSON *)
39 val request_of_json : (Ezjsonm.value -> 'a) -> Ezjsonm.value -> 'a request
40
41 (** Parse response from JSON *)
42 val response_of_json : (Ezjsonm.value -> 'a) -> Ezjsonm.value -> 'a response
43end
44
45(** Standard /changes method (RFC 8620 Section 5.2) *)
46module Changes : sig
47 type request = {
48 account_id : Jmap_id.t;
49 since_state : string;
50 max_changes : Jmap_primitives.UnsignedInt.t option;
51 }
52
53 type response = {
54 account_id : Jmap_id.t;
55 old_state : string;
56 new_state : string;
57 has_more_changes : bool;
58 created : Jmap_id.t list;
59 updated : Jmap_id.t list;
60 destroyed : Jmap_id.t list;
61 }
62
63 (** Accessors for request *)
64 val account_id : request -> Jmap_id.t
65 val since_state : request -> string
66 val max_changes : request -> Jmap_primitives.UnsignedInt.t option
67
68 (** Constructor for request *)
69 val v : account_id:Jmap_id.t -> since_state:string -> ?max_changes:Jmap_primitives.UnsignedInt.t -> unit -> request
70
71 (** Accessors for response *)
72 val response_account_id : response -> Jmap_id.t
73 val old_state : response -> string
74 val new_state : response -> string
75 val has_more_changes : response -> bool
76 val created : response -> Jmap_id.t list
77 val updated : response -> Jmap_id.t list
78 val destroyed : response -> Jmap_id.t list
79
80 (** Constructor for response *)
81 val response_v :
82 account_id:Jmap_id.t ->
83 old_state:string ->
84 new_state:string ->
85 has_more_changes:bool ->
86 created:Jmap_id.t list ->
87 updated:Jmap_id.t list ->
88 destroyed:Jmap_id.t list ->
89 response
90
91 (** Parse request from JSON *)
92 val request_of_json : Ezjsonm.value -> request
93
94 (** Parse response from JSON *)
95 val response_of_json : Ezjsonm.value -> response
96end
97
98(** Standard /set method (RFC 8620 Section 5.3) *)
99module Set : sig
100 (** PatchObject - JSON Pointer paths to values *)
101 type patch_object = (string * Ezjsonm.value option) list
102
103 type 'a request = {
104 account_id : Jmap_id.t;
105 if_in_state : string option;
106 create : (Jmap_id.t * 'a) list option;
107 update : (Jmap_id.t * patch_object) list option;
108 destroy : Jmap_id.t list option;
109 }
110
111 type 'a response = {
112 account_id : Jmap_id.t;
113 old_state : string option;
114 new_state : string;
115 created : (Jmap_id.t * 'a) list option;
116 updated : (Jmap_id.t * 'a option) list option;
117 destroyed : Jmap_id.t list option;
118 not_created : (Jmap_id.t * Jmap_error.set_error_detail) list option;
119 not_updated : (Jmap_id.t * Jmap_error.set_error_detail) list option;
120 not_destroyed : (Jmap_id.t * Jmap_error.set_error_detail) list option;
121 }
122
123 (** Accessors for request *)
124 val account_id : 'a request -> Jmap_id.t
125 val if_in_state : 'a request -> string option
126 val create : 'a request -> (Jmap_id.t * 'a) list option
127 val update : 'a request -> (Jmap_id.t * patch_object) list option
128 val destroy : 'a request -> Jmap_id.t list option
129
130 (** Constructor for request *)
131 val v :
132 account_id:Jmap_id.t ->
133 ?if_in_state:string ->
134 ?create:(Jmap_id.t * 'a) list ->
135 ?update:(Jmap_id.t * patch_object) list ->
136 ?destroy:Jmap_id.t list ->
137 unit ->
138 'a request
139
140 (** Accessors for response *)
141 val response_account_id : 'a response -> Jmap_id.t
142 val old_state : 'a response -> string option
143 val new_state : 'a response -> string
144 val created : 'a response -> (Jmap_id.t * 'a) list option
145 val updated : 'a response -> (Jmap_id.t * 'a option) list option
146 val destroyed : 'a response -> Jmap_id.t list option
147 val not_created : 'a response -> (Jmap_id.t * Jmap_error.set_error_detail) list option
148 val not_updated : 'a response -> (Jmap_id.t * Jmap_error.set_error_detail) list option
149 val not_destroyed : 'a response -> (Jmap_id.t * Jmap_error.set_error_detail) list option
150
151 (** Constructor for response *)
152 val response_v :
153 account_id:Jmap_id.t ->
154 ?old_state:string ->
155 new_state:string ->
156 ?created:(Jmap_id.t * 'a) list ->
157 ?updated:(Jmap_id.t * 'a option) list ->
158 ?destroyed:Jmap_id.t list ->
159 ?not_created:(Jmap_id.t * Jmap_error.set_error_detail) list ->
160 ?not_updated:(Jmap_id.t * Jmap_error.set_error_detail) list ->
161 ?not_destroyed:(Jmap_id.t * Jmap_error.set_error_detail) list ->
162 unit ->
163 'a response
164
165 (** Parse request from JSON *)
166 val request_of_json : (Ezjsonm.value -> 'a) -> Ezjsonm.value -> 'a request
167
168 (** Parse response from JSON *)
169 val response_of_json : (Ezjsonm.value -> 'a) -> Ezjsonm.value -> 'a response
170end
171
172(** Standard /copy method (RFC 8620 Section 5.4) *)
173module Copy : sig
174 type 'a request = {
175 from_account_id : Jmap_id.t;
176 if_from_in_state : string option;
177 account_id : Jmap_id.t;
178 if_in_state : string option;
179 create : (Jmap_id.t * 'a) list;
180 on_success_destroy_original : bool option;
181 destroy_from_if_in_state : string option;
182 }
183
184 type 'a response = {
185 from_account_id : Jmap_id.t;
186 account_id : Jmap_id.t;
187 old_state : string option;
188 new_state : string;
189 created : (Jmap_id.t * 'a) list option;
190 not_created : (Jmap_id.t * Jmap_error.set_error_detail) list option;
191 }
192
193 (** Accessors for request *)
194 val from_account_id : 'a request -> Jmap_id.t
195 val if_from_in_state : 'a request -> string option
196 val account_id : 'a request -> Jmap_id.t
197 val if_in_state : 'a request -> string option
198 val create : 'a request -> (Jmap_id.t * 'a) list
199 val on_success_destroy_original : 'a request -> bool option
200 val destroy_from_if_in_state : 'a request -> string option
201
202 (** Constructor for request *)
203 val v :
204 from_account_id:Jmap_id.t ->
205 ?if_from_in_state:string ->
206 account_id:Jmap_id.t ->
207 ?if_in_state:string ->
208 create:(Jmap_id.t * 'a) list ->
209 ?on_success_destroy_original:bool ->
210 ?destroy_from_if_in_state:string ->
211 unit ->
212 'a request
213
214 (** Accessors for response *)
215 val response_from_account_id : 'a response -> Jmap_id.t
216 val response_account_id : 'a response -> Jmap_id.t
217 val old_state : 'a response -> string option
218 val new_state : 'a response -> string
219 val created : 'a response -> (Jmap_id.t * 'a) list option
220 val not_created : 'a response -> (Jmap_id.t * Jmap_error.set_error_detail) list option
221
222 (** Constructor for response *)
223 val response_v :
224 from_account_id:Jmap_id.t ->
225 account_id:Jmap_id.t ->
226 ?old_state:string ->
227 new_state:string ->
228 ?created:(Jmap_id.t * 'a) list ->
229 ?not_created:(Jmap_id.t * Jmap_error.set_error_detail) list ->
230 unit ->
231 'a response
232
233 (** Parse request from JSON *)
234 val request_of_json : (Ezjsonm.value -> 'a) -> Ezjsonm.value -> 'a request
235
236 (** Parse response from JSON *)
237 val response_of_json : (Ezjsonm.value -> 'a) -> Ezjsonm.value -> 'a response
238end
239
240(** Standard /query method (RFC 8620 Section 5.5) *)
241module Query : sig
242 type 'filter request = {
243 account_id : Jmap_id.t;
244 filter : 'filter Jmap_filter.t option;
245 sort : Jmap_comparator.t list option;
246 position : Jmap_primitives.Int53.t option;
247 anchor : Jmap_id.t option;
248 anchor_offset : Jmap_primitives.Int53.t option;
249 limit : Jmap_primitives.UnsignedInt.t option;
250 calculate_total : bool option;
251 }
252
253 type response = {
254 account_id : Jmap_id.t;
255 query_state : string;
256 can_calculate_changes : bool;
257 position : Jmap_primitives.UnsignedInt.t;
258 ids : Jmap_id.t list;
259 total : Jmap_primitives.UnsignedInt.t option;
260 limit : Jmap_primitives.UnsignedInt.t option;
261 }
262
263 (** Accessors for request *)
264 val account_id : 'filter request -> Jmap_id.t
265 val filter : 'filter request -> 'filter Jmap_filter.t option
266 val sort : 'filter request -> Jmap_comparator.t list option
267 val position : 'filter request -> Jmap_primitives.Int53.t option
268 val anchor : 'filter request -> Jmap_id.t option
269 val anchor_offset : 'filter request -> Jmap_primitives.Int53.t option
270 val limit : 'filter request -> Jmap_primitives.UnsignedInt.t option
271 val calculate_total : 'filter request -> bool option
272
273 (** Constructor for request *)
274 val v :
275 account_id:Jmap_id.t ->
276 ?filter:'filter Jmap_filter.t ->
277 ?sort:Jmap_comparator.t list ->
278 ?position:Jmap_primitives.Int53.t ->
279 ?anchor:Jmap_id.t ->
280 ?anchor_offset:Jmap_primitives.Int53.t ->
281 ?limit:Jmap_primitives.UnsignedInt.t ->
282 ?calculate_total:bool ->
283 unit ->
284 'filter request
285
286 (** Accessors for response *)
287 val response_account_id : response -> Jmap_id.t
288 val query_state : response -> string
289 val can_calculate_changes : response -> bool
290 val response_position : response -> Jmap_primitives.UnsignedInt.t
291 val ids : response -> Jmap_id.t list
292 val total : response -> Jmap_primitives.UnsignedInt.t option
293 val response_limit : response -> Jmap_primitives.UnsignedInt.t option
294
295 (** Constructor for response *)
296 val response_v :
297 account_id:Jmap_id.t ->
298 query_state:string ->
299 can_calculate_changes:bool ->
300 position:Jmap_primitives.UnsignedInt.t ->
301 ids:Jmap_id.t list ->
302 ?total:Jmap_primitives.UnsignedInt.t ->
303 ?limit:Jmap_primitives.UnsignedInt.t ->
304 unit ->
305 response
306
307 (** Parse request from JSON *)
308 val request_of_json : (Ezjsonm.value -> 'filter) -> Ezjsonm.value -> 'filter request
309
310 (** Parse response from JSON *)
311 val response_of_json : Ezjsonm.value -> response
312end
313
314(** Standard /queryChanges method (RFC 8620 Section 5.6) *)
315module QueryChanges : sig
316 (** Item added to query results *)
317 type added_item = {
318 id : Jmap_id.t;
319 index : Jmap_primitives.UnsignedInt.t;
320 }
321
322 type 'filter request = {
323 account_id : Jmap_id.t;
324 filter : 'filter Jmap_filter.t option;
325 sort : Jmap_comparator.t list option;
326 since_query_state : string;
327 max_changes : Jmap_primitives.UnsignedInt.t option;
328 up_to_id : Jmap_id.t option;
329 calculate_total : bool option;
330 }
331
332 type response = {
333 account_id : Jmap_id.t;
334 old_query_state : string;
335 new_query_state : string;
336 total : Jmap_primitives.UnsignedInt.t option;
337 removed : Jmap_id.t list;
338 added : added_item list;
339 }
340
341 (** Accessors for added_item *)
342 val added_item_id : added_item -> Jmap_id.t
343 val added_item_index : added_item -> Jmap_primitives.UnsignedInt.t
344
345 (** Constructor for added_item *)
346 val added_item_v : id:Jmap_id.t -> index:Jmap_primitives.UnsignedInt.t -> added_item
347
348 (** Accessors for request *)
349 val account_id : 'filter request -> Jmap_id.t
350 val filter : 'filter request -> 'filter Jmap_filter.t option
351 val sort : 'filter request -> Jmap_comparator.t list option
352 val since_query_state : 'filter request -> string
353 val max_changes : 'filter request -> Jmap_primitives.UnsignedInt.t option
354 val up_to_id : 'filter request -> Jmap_id.t option
355 val calculate_total : 'filter request -> bool option
356
357 (** Constructor for request *)
358 val v :
359 account_id:Jmap_id.t ->
360 ?filter:'filter Jmap_filter.t ->
361 ?sort:Jmap_comparator.t list ->
362 since_query_state:string ->
363 ?max_changes:Jmap_primitives.UnsignedInt.t ->
364 ?up_to_id:Jmap_id.t ->
365 ?calculate_total:bool ->
366 unit ->
367 'filter request
368
369 (** Accessors for response *)
370 val response_account_id : response -> Jmap_id.t
371 val old_query_state : response -> string
372 val new_query_state : response -> string
373 val total : response -> Jmap_primitives.UnsignedInt.t option
374 val removed : response -> Jmap_id.t list
375 val added : response -> added_item list
376
377 (** Constructor for response *)
378 val response_v :
379 account_id:Jmap_id.t ->
380 old_query_state:string ->
381 new_query_state:string ->
382 ?total:Jmap_primitives.UnsignedInt.t ->
383 removed:Jmap_id.t list ->
384 added:added_item list ->
385 unit ->
386 response
387
388 (** Parse request from JSON *)
389 val request_of_json : (Ezjsonm.value -> 'filter) -> Ezjsonm.value -> 'filter request
390
391 (** Parse response from JSON *)
392 val response_of_json : Ezjsonm.value -> response
393end
394
395(** Core/echo method (RFC 8620 Section 7.3) *)
396module Echo : sig
397 (** Echo simply returns the arguments unchanged *)
398 type t = Ezjsonm.value
399
400 val of_json : Ezjsonm.value -> t
401 val to_json : t -> Ezjsonm.value
402end