Testing a Gemini codegen run
1(** Unix-specific JMAP client implementation interface.
2
3 This module provides functions to interact with a JMAP server using
4 Unix sockets for network communication.
5*)
6
7open Jmap_types
8open Jmap_wire
9open Jmap_session
10open Jmap_push
11
12(** Represents an active JMAP connection context. Opaque type. *)
13type context
14
15(** Represents an active EventSource connection. Opaque type. *)
16type event_source_connection
17
18(** Exception raised for JMAP communication errors. *)
19exception Jmap_error of Jmap_error.Problem_details.t
20
21(** Connect to a JMAP server and retrieve the session.
22 This handles discovery (if needed) and authentication (mechanism TBD).
23 [host] is the server hostname.
24 [port] is the server port (default 443 if TLS enabled, TBD if not).
25 [credentials] is an opaque type representing authentication credentials.
26 @param ?session_url Optional direct URL to the Session resource.
27 @param ?username Optional username (e.g., email address) for discovery.
28*)
29val connect :
30 ?session_url:Uri.t ->
31 ?username:string ->
32 host:string ->
33 ?port:int ->
34 credentials:'a ->
35 (context * Session.t)
36
37(** Perform a JMAP API request.
38 @param ctx The connection context.
39 @param request The JMAP request object.
40*)
41val request : context -> Request.t -> Response.t
42
43(** Upload binary data.
44 @param ctx The connection context.
45 @param account_id The target account ID.
46 @param content_type The MIME type of the data.
47 @param data_stream A stream providing the binary data chunks.
48*)
49val upload :
50 context ->
51 account_id:id ->
52 content_type:string ->
53 data_stream:string Seq.t ->
54 Jmap_binary.Upload_response.t
55
56(** Download binary data.
57 @param ctx The connection context.
58 @param account_id The account ID.
59 @param blob_id The blob ID to download.
60 @param content_type The desired Content-Type for the download response.
61 @param name The desired filename for the download response.
62 @return A stream producing the binary data chunks.
63*)
64val download :
65 context ->
66 account_id:id ->
67 blob_id:id ->
68 content_type:string ->
69 name:string ->
70 string Seq.t
71
72(** Connect to the EventSource for push notifications.
73 @param ctx The connection context.
74 @param ?types List of types to subscribe to (default "*").
75 @param ?close_after Request server to close after first state event.
76 @param ?ping Request ping interval in seconds (default 0).
77 @return A tuple of the connection handle and a stream of push events.
78 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.3> RFC 8620, Section 7.3 *)
79val connect_event_source :
80 context ->
81 ?types:string list ->
82 ?close_after:[`State | `No] ->
83 ?ping:uint ->
84 (event_source_connection *
85 ([`State of State_change.t | `Ping of Event_source_ping_data.t ] Seq.t))
86
87(** Close an EventSource connection.
88 @param conn The EventSource connection handle.
89*)
90val close_event_source : event_source_connection -> unit
91
92(** Close the JMAP connection context. *)
93val close : context -> unit