This repository has no description
1(*---------------------------------------------------------------------------
2 Copyright (c) 2025 Anil Madhavapeddy. All rights reserved.
3 SPDX-License-Identifier: ISC
4 ---------------------------------------------------------------------------*)
5
6(** JMAP response object as defined in RFC 8620 Section 3.4
7
8 @canonical Jmap.Proto.Response *)
9
10type t = {
11 method_responses : Proto_invocation.t list;
12 (** The method responses. Each is [methodName, responseArgs, methodCallId]. *)
13 created_ids : (Proto_id.t * Proto_id.t) list option;
14 (** Map of client-created temporary ids to server-assigned ids. *)
15 session_state : string;
16 (** Current session state. Changes indicate session data has changed. *)
17}
18
19val method_responses : t -> Proto_invocation.t list
20val created_ids : t -> (Proto_id.t * Proto_id.t) list option
21val session_state : t -> string
22
23val jsont : t Jsont.t
24(** JSON codec for JMAP responses. *)
25
26(** {1 Response Inspection} *)
27
28val find_response : string -> t -> Proto_invocation.t option
29(** [find_response method_call_id response] finds the response for a method call. *)
30
31val get_response : string -> t -> Proto_invocation.t
32(** [get_response method_call_id response] gets the response for a method call.
33 @raise Not_found if not found. *)
34
35val is_error : Proto_invocation.t -> bool
36(** [is_error invocation] returns [true] if the invocation is an error response. *)
37
38val get_error : Proto_invocation.t -> Proto_error.method_error option
39(** [get_error invocation] returns the error if this is an error response. *)