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