forked from
anil.recoil.org/ocaml-jmap
this repo has no description
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** JMAP request object as defined in RFC 8620 Section 3.3
7
8 @canonical Jmap.Proto.Request *)
9
10type t = {
11 using : string list;
12 (** Capability URIs required for this request. *)
13 method_calls : Proto_invocation.t list;
14 (** The method calls to execute. *)
15 created_ids : (Proto_id.t * Proto_id.t) list option;
16 (** Map of client-created temporary ids to server-assigned ids.
17 Used for result references in batch operations. *)
18}
19
20val create :
21 using:string list ->
22 method_calls:Proto_invocation.t list ->
23 ?created_ids:(Proto_id.t * Proto_id.t) list ->
24 unit ->
25 t
26(** [create ~using ~method_calls ?created_ids ()] creates a JMAP request. *)
27
28val using : t -> string list
29val method_calls : t -> Proto_invocation.t list
30val created_ids : t -> (Proto_id.t * Proto_id.t) list option
31
32val jsont : t Jsont.t
33(** JSON codec for JMAP requests. *)
34
35(** {1 Request Builders} *)
36
37val single :
38 using:string list ->
39 Proto_invocation.t ->
40 t
41(** [single ~using invocation] creates a request with a single method call. *)
42
43val batch :
44 using:string list ->
45 Proto_invocation.t list ->
46 t
47(** [batch ~using invocations] creates a request with multiple method calls. *)