···2828### ✅ Good - Using the typed JMAP library API:
2929```ocaml
3030(* Build Email/query request using typed constructors *)
3131-let query_request = Jmap_mail.Jmap_email.Query.request_v
3232- ~account_id:(Jmap_core.Jmap_id.of_string account_id)
3333- ~limit:(Jmap_core.Jmap_primitives.UnsignedInt.of_int 10)
3434- ~sort:[Jmap_core.Jmap_comparator.v ~property:"receivedAt" ~is_ascending:false ()]
3131+let query_request = Jmap_mail.Email.Query.request_v
3232+ ~account_id:(Jmap_core.Id.of_string account_id)
3333+ ~limit:(Jmap_core.Primitives.UnsignedInt.of_int 10)
3434+ ~sort:[Jmap_core.Comparator.v ~property:"receivedAt" ~is_ascending:false ()]
3535 ~calculate_total:true
3636 () in
37373838(* Convert to JSON *)
3939-let query_args = Jmap_mail.Jmap_email.Query.request_to_json query_request in
3939+let query_args = Jmap_mail.Email.Query.request_to_json query_request in
40404141(* Create invocation using Echo witness *)
4242-let query_invocation = Jmap_core.Jmap_invocation.Invocation {
4242+let query_invocation = Jmap_core.Invocation.Invocation {
4343 method_name = "Email/query";
4444 arguments = query_args;
4545 call_id = "q1";
4646- witness = Jmap_core.Jmap_invocation.Echo;
4646+ witness = Jmap_core.Invocation.Echo;
4747} in
48484949(* Build request using constructors *)
5050-let req = Jmap_core.Jmap_request.make
5151- ~using:[Jmap_core.Jmap_capability.core; Jmap_core.Jmap_capability.mail]
5252- [Jmap_core.Jmap_invocation.Packed query_invocation]
5050+let req = Jmap_core.Request.make
5151+ ~using:[Jmap_core.Capability.core; Jmap_core.Capability.mail]
5252+ [Jmap_core.Invocation.Packed query_invocation]
5353in
54545555(* Make the call *)
5656let query_resp = Jmap_client.call client req in
57575858(* Extract results using type-safe response_to_json *)
5959-let method_responses = Jmap_core.Jmap_response.method_responses query_resp in
5959+let method_responses = Jmap_core.Response.method_responses query_resp in
6060match method_responses with
6161| [packed_resp] ->
6262- let response_json = Jmap_core.Jmap_invocation.response_to_json packed_resp in
6262+ let response_json = Jmap_core.Invocation.response_to_json packed_resp in
6363 (* Now parse response_json... *)
6464 (match response_json with
6565 | `O fields ->
···7070| _ -> failwith "Unexpected response"
7171```
72727373+**Using the unified Jmap module (recommended)**:
7474+```ocaml
7575+(* Even cleaner with the unified Jmap module *)
7676+let query_request = Jmap.Email.Query.request_v
7777+ ~account_id:(Jmap.Id.of_string account_id)
7878+ ~limit:(Jmap.Primitives.UnsignedInt.of_int 10)
7979+ ~sort:[Jmap.Comparator.v ~property:"receivedAt" ~is_ascending:false ()]
8080+ ~calculate_total:true
8181+ () in
8282+8383+let query_args = Jmap.Email.Query.request_to_json query_request in
8484+let query_invocation = Jmap.Invocation.Invocation {
8585+ method_name = "Email/query";
8686+ arguments = query_args;
8787+ call_id = "q1";
8888+ witness = Jmap.Invocation.Echo;
8989+} in
9090+9191+let req = Jmap.Request.make
9292+ ~using:[Jmap.Capability.core; Jmap.Capability.mail]
9393+ [Jmap.Invocation.Packed query_invocation]
9494+in
9595+9696+let query_resp = Jmap.Client.call client req in
9797+9898+let method_responses = Jmap.Response.method_responses query_resp in
9999+match method_responses with
100100+| [packed_resp] ->
101101+ let response_json = Jmap.Invocation.response_to_json packed_resp in
102102+ (* process response... *)
103103+| _ -> failwith "Unexpected response"
104104+```
105105+73106The key principles:
741071. Use typed `request_v` constructors (e.g., `Email.Query.request_v`, `Email.Get.request_v`)
751082. Convert typed requests to JSON with `request_to_json`
7676-3. Wrap in invocations and build JMAP requests with `Jmap_request.make`
7777-4. Use `Jmap_invocation.response_to_json` to safely extract response data from packed responses
109109+3. Wrap in invocations and build JMAP requests with `Request.make`
110110+4. Use `Invocation.response_to_json` to safely extract response data from packed responses
7811179112## Architecture
80113114114+- **jmap**: Unified ergonomic interface (recommended for most users)
81115- **jmap-core**: Core JMAP types (Session, Request, Response, Invocations, Standard Methods)
82116- **jmap-mail**: Email-specific types (RFC 8621)
83117- **jmap-client**: HTTP client implementation using Eio and the Requests library
8411885119## Key Modules
861208787-### Jmap_request
8888-Build JMAP requests using `Jmap_request.make`:
121121+### Jmap.Request (or Jmap_core.Request)
122122+Build JMAP requests using `Request.make`:
89123```ocaml
90124val make :
9191- ?created_ids:(Jmap_id.t * Jmap_id.t) list option ->
9292- using:Jmap_capability.t list ->
9393- Jmap_invocation.invocation_list ->
125125+ ?created_ids:(Id.t * Id.t) list option ->
126126+ using:Capability.t list ->
127127+ Invocation.invocation_list ->
94128 t
95129```
961309797-### Jmap_invocation
131131+### Jmap.Invocation (or Jmap_core.Invocation)
98132Type-safe method invocations using GADT witnesses:
99133```ocaml
100134type ('args, 'resp) method_witness =
···106140107141For generic JSON methods, use the Echo witness. For typed methods, use the appropriate witness.
108142109109-### Jmap_capability
143143+### Jmap.Capability (or Jmap_core.Capability)
110144Use predefined capability constants:
111145```ocaml
112112-let caps = [Jmap_capability.core; Jmap_capability.mail]
146146+let caps = [Jmap.Capability.core; Jmap.Capability.mail]
113147```
114148115149Or create from URN strings:
116150```ocaml
117117-let cap = Jmap_capability.of_string "urn:ietf:params:jmap:core"
151151+let cap = Jmap.Capability.of_string "urn:ietf:params:jmap:core"
118152```
119153120154## Testing Against Real Servers
+43-33
stack/jmap/README.md
···11# JMAP Implementation
2233-OCaml implementation of the JMAP protocol (RFC 8620) with Eio for async I/O.
33+OCaml implementation of the JMAP protocol (RFC 8620, RFC 8621) with Eio for async I/O.
4455-## Structure
55+## Packages
6677-- **jmap-core**: Core JMAP protocol types and parsers
77+- **jmap**: Unified, ergonomic interface combining all libraries (recommended)
88+- **jmap-core**: Core JMAP protocol types and parsers (RFC 8620)
89- **jmap-mail**: JMAP Mail extension (RFC 8621)
910- **jmap-client**: HTTP client for JMAP servers using Eio
10111112## Features
12131414+- ✅ **Ergonomic API**: Clean, unified `Jmap` module with short aliases
1515+- ✅ **Type-safe**: Uses GADTs to ensure compile-time correctness
1316- ✅ Full Eio-based async I/O
1417- ✅ Uses `Requests` library for HTTP client layer
1518- ✅ Bearer token and Basic authentication
···1720- ✅ API calls with proper JSON serialization
1821- ✅ Upload and download support
19222020-## Usage
2323+## Installation
2424+2525+```bash
2626+# Recommended: Install the unified package
2727+opam install jmap
21282222-### Creating a Client
2929+# Or install individual packages for specialized use
3030+opam install jmap-core jmap-mail jmap-client
3131+```
3232+3333+## Quick Start
3434+3535+### Using the Unified API (Recommended)
23362437```ocaml
2538Eio_main.run @@ fun env ->
2639Eio.Switch.run @@ fun sw ->
27402841(* Create connection with authentication *)
2929-let conn = Jmap_connection.v
3030- ~auth:(Jmap_connection.Bearer "your-api-token")
3131- () in
4242+let conn = Jmap.Connection.bearer_auth ~token:"your-api-token" () in
32433344(* Create client *)
3434-let client = Jmap_client.create
4545+let client = Jmap.Client.create
3546 ~sw
3647 ~env
3748 ~conn
···3950 () in
40514152(* Fetch session *)
4242-let session = Jmap_client.fetch_session client in
4343-Printf.printf "Username: %s\n" (Jmap_core.Jmap_session.username session);
4444-```
5353+let session = Jmap.Client.get_session client in
5454+Printf.printf "Username: %s\n" (Jmap.Session.username session);
45554646-### Making API Calls
5656+(* Query emails using typed API *)
5757+let query_req = Jmap.Email.Query.request_v
5858+ ~account_id:(Jmap.Id.of_string account_id)
5959+ ~limit:(Jmap.Primitives.UnsignedInt.of_int 10)
6060+ ()
6161+in
47624848-```ocaml
4949-(* Build a JMAP request *)
5050-let request_json = \`O [
5151- ("using", \`A [\`String "urn:ietf:params:jmap:core"; \`String "urn:ietf:params:jmap:mail"]);
5252- ("methodCalls", \`A [
5353- \`A [
5454- \`String "Email/query";
5555- \`O [("accountId", \`String account_id); ("limit", \`Float 10.)];
5656- \`String "c1"
5757- ]
5858- ])
5959-] in
6363+let query_args = Jmap.Email.Query.request_to_json query_req in
6464+let invocation = Jmap.Invocation.make_echo "Email/query" query_args "q1" in
6565+let req = Jmap.Request.make
6666+ ~using:[Jmap.Capability.core; Jmap.Capability.mail]
6767+ [invocation]
6868+in
60696161-let req = Jmap_core.Jmap_request.Parser.of_json request_json in
6262-let resp = Jmap_client.call client req in
7070+let resp = Jmap.Client.call client req
6371```
7272+7373+For more examples and advanced usage, see [USAGE_GUIDE.md](USAGE_GUIDE.md).
64746575## Testing with Fastmail
6676···7686 dune exec jmap/test/test_fastmail.exe
7787 ```
78887979-## Migration from Unix to Eio
8989+## Architecture
80908181-The JMAP client has been migrated from Unix-based I/O to Eio:
9191+The library is organized into clean, modular packages:
82928383-- ✅ Replaced blocking I/O with Eio structured concurrency
8484-- ✅ Integrated with `Requests` library for HTTP
8585-- ✅ Added proper resource management with switches
8686-- ✅ Maintained backward-compatible API where possible
9393+- ✅ Unified `Jmap` module for ergonomic, everyday use
9494+- ✅ Specialized submodules (`Jmap_core`, `Jmap_mail`) for advanced cases
9595+- ✅ Full Eio integration with structured concurrency
9696+- ✅ Type-safe GADTs for compile-time correctness
87978898## Dependencies
8999
+169
stack/jmap/USAGE_GUIDE.md
···11+# JMAP Library Usage Guide
22+33+## Ergonomic API Design
44+55+The JMAP library provides a clean, ergonomic API with short module names and a unified entry point.
66+77+## Module Structure
88+99+### Unified `Jmap` Module (Recommended)
1010+1111+The unified `Jmap` module combines `jmap-core`, `jmap-mail`, and `jmap-client` into a single, easy-to-use interface.
1212+1313+```ocaml
1414+let id = Jmap.Id.of_string "abc123"
1515+let email_req = Jmap.Email.Query.request_v ~account_id ...
1616+let client = Jmap.Client.create ...
1717+```
1818+1919+### Submodules (For Specialized Use)
2020+2121+You can also use the submodules directly:
2222+2323+**Jmap_core**:
2424+```ocaml
2525+Jmap_core.Session.t
2626+Jmap_core.Id.of_string
2727+Jmap_core.Request.make
2828+```
2929+3030+**Jmap_mail**:
3131+```ocaml
3232+Jmap_mail.Email.Query.request_v
3333+Jmap_mail.Mailbox.get
3434+```
3535+3636+## Module Hierarchy
3737+3838+### High-Level API (Recommended for Most Users)
3939+4040+```
4141+Jmap -- Unified interface (START HERE)
4242+├── Client -- HTTP client (from jmap-client)
4343+├── Connection -- Connection config (from jmap-client)
4444+│
4545+├── Email -- Email operations (from jmap-mail)
4646+├── Mailbox -- Mailbox operations (from jmap-mail)
4747+├── Thread -- Thread operations (from jmap-mail)
4848+├── Identity -- Identity management (from jmap-mail)
4949+├── Email_submission -- Email submission (from jmap-mail)
5050+├── Vacation_response -- Vacation responses (from jmap-mail)
5151+├── Search_snippet -- Search snippets (from jmap-mail)
5252+│
5353+├── Session -- JMAP Session (from jmap-core)
5454+├── Request -- Request building (from jmap-core)
5555+├── Response -- Response handling (from jmap-core)
5656+├── Invocation -- Method invocations (from jmap-core)
5757+├── Id -- JMAP IDs (from jmap-core)
5858+├── Capability -- Capabilities (from jmap-core)
5959+├── Filter -- Filters (from jmap-core)
6060+├── Comparator -- Sorting (from jmap-core)
6161+├── Primitives -- Primitive types (from jmap-core)
6262+├── Error -- Error handling (from jmap-core)
6363+├── Binary -- Upload/download (from jmap-core)
6464+├── Push -- Push notifications (from jmap-core)
6565+│
6666+├── Core -- Full jmap-core access
6767+└── Mail -- Full jmap-mail access
6868+```
6969+7070+### Specialized APIs (For Advanced Use Cases)
7171+7272+```
7373+Jmap_core -- Core protocol library
7474+├── Session
7575+├── Id
7676+├── Request
7777+├── Response
7878+└── ...
7979+8080+Jmap_mail -- Mail extension library
8181+├── Email
8282+├── Mailbox
8383+├── Thread
8484+└── ...
8585+8686+Jmap_client -- HTTP client library
8787+└── (unwrapped: Jmap_client, Jmap_connection)
8888+```
8989+9090+## Usage Examples
9191+9292+### Example 1: Creating a Client and Querying Emails
9393+9494+```ocaml
9595+let conn = Jmap.Connection.bearer_auth ~token:"..." () in
9696+let client = Jmap.Client.create ~sw ~env ~conn ~session_url:"..." () in
9797+let session = Jmap.Client.get_session client in
9898+9999+let query_req = Jmap.Email.Query.request_v
100100+ ~account_id:(Jmap.Id.of_string account_id)
101101+ ~limit:(Jmap.Primitives.UnsignedInt.of_int 10)
102102+ ~sort:[Jmap.Comparator.v ~property:"receivedAt" ~is_ascending:false ()]
103103+ ()
104104+in
105105+106106+let query_args = Jmap.Email.Query.request_to_json query_req in
107107+let invocation = Jmap.Invocation.Invocation {
108108+ method_name = "Email/query";
109109+ arguments = query_args;
110110+ call_id = "q1";
111111+ witness = Jmap.Invocation.Echo;
112112+} in
113113+114114+let req = Jmap.Request.make
115115+ ~using:[Jmap.Capability.core; Jmap.Capability.mail]
116116+ [Jmap.Invocation.Packed invocation]
117117+in
118118+119119+let resp = Jmap.Client.call client req in
120120+```
121121+122122+### Example 2: Using Submodules
123123+124124+```ocaml
125125+(* Use Jmap_core for core protocol operations *)
126126+let session = Jmap_core.Session.of_json json in
127127+let account_id = Jmap_core.Id.of_string "abc123" in
128128+129129+(* Use Jmap_mail for mail-specific operations *)
130130+let email_req = Jmap_mail.Email.Query.request_v
131131+ ~account_id
132132+ ~limit:(Jmap_core.Primitives.UnsignedInt.of_int 50)
133133+ ()
134134+in
135135+```
136136+137137+### Example 3: Working with IDs and Primitives
138138+139139+```ocaml
140140+let account_id = Jmap.Id.of_string "abc123" in
141141+let limit = Jmap.Primitives.UnsignedInt.of_int 50 in
142142+let id_str = Jmap.Id.to_string account_id in
143143+```
144144+145145+## Package Structure
146146+147147+- **`jmap`** - Unified interface (recommended for applications)
148148+- **`jmap-core`** - Core protocol (RFC 8620)
149149+- **`jmap-mail`** - Mail extension (RFC 8621)
150150+- **`jmap-client`** - HTTP client implementation
151151+- **`jmap-test`** - Test suite
152152+153153+Most users should depend on `jmap`, which pulls in all three libraries. For specialized use cases (e.g., you only need parsing), you can depend on individual packages.
154154+155155+## Quick Reference
156156+157157+| Use Case | Unified API | Submodule API |
158158+|----------|-------------|---------------|
159159+| IDs | `Jmap.Id` | `Jmap_core.Id` |
160160+| Requests | `Jmap.Request` | `Jmap_core.Request` |
161161+| Emails | `Jmap.Email` | `Jmap_mail.Email` |
162162+| Mailboxes | `Jmap.Mailbox` | `Jmap_mail.Mailbox` |
163163+| Client | `Jmap.Client` | `Jmap_client` |
164164+165165+## Need Help?
166166+167167+- See `jmap/lib/jmap.mli` for the complete unified API documentation
168168+- Check `jmap/test/test_unified_api.ml` for working examples
169169+- Refer to `jmap/test/test_fastmail.ml` for real-world usage
+11
stack/jmap/dune-project
···4040 (jmap-mail (= :version))))
41414242(package
4343+ (name jmap)
4444+ (synopsis "Unified JMAP library combining core, mail, and client")
4545+ (description "Ergonomic, unified interface to the complete JMAP library (RFC 8620, RFC 8621). This is the recommended entry point for most users.")
4646+ (depends
4747+ (ocaml (>= 4.14))
4848+ (dune (>= 3.0))
4949+ (jmap-core (= :version))
5050+ (jmap-mail (= :version))
5151+ (jmap-client (= :version))))
5252+5353+(package
4354 (name jmap-test)
4455 (synopsis "Test suite for JMAP libraries")
4556 (allow_empty)
+8-8
stack/jmap/jmap-client/jmap_client.ml
···55 get_request : timeout:Requests.Timeout.t -> string -> Requests.Response.t;
66 post_request : timeout:Requests.Timeout.t -> headers:Requests.Headers.t -> body:Requests.Body.t -> string -> Requests.Response.t;
77 conn : Jmap_connection.t;
88- session : Jmap_core.Jmap_session.t option ref;
88+ session : Jmap_core.Session.t option ref;
99}
10101111let create ~sw ~env ~conn ~session_url () =
···4646 Buffer.contents buf
4747 in
48484949- let session = Jmap_core.Jmap_session.Parser.of_string body_str in
4949+ let session = Jmap_core.Session.Parser.of_string body_str in
5050 t.session := Some session;
5151 session
5252···57575858let call t req =
5959 let session = get_session t in
6060- let api_url = Jmap_core.Jmap_session.api_url session in
6060+ let api_url = Jmap_core.Session.api_url session in
6161 let config = Jmap_connection.config t.conn in
6262 let timeout = Requests.Timeout.create ~total:(Jmap_connection.timeout config) () in
63636464 (* Convert request to JSON *)
6565- let req_json = Jmap_core.Jmap_request.to_json req in
6565+ let req_json = Jmap_core.Request.to_json req in
66666767 (* Set up headers *)
6868 let headers = Requests.Headers.(empty
···8686 (Requests.Response.status_code response))
8787 );
88888989- Jmap_core.Jmap_response.Parser.of_string body_str
8989+ Jmap_core.Response.Parser.of_string body_str
90909191let upload t ~account_id ~content_type:ct data =
9292 let session = get_session t in
9393- let upload_url = Jmap_core.Jmap_session.upload_url session in
9393+ let upload_url = Jmap_core.Session.upload_url session in
9494 let config = Jmap_connection.config t.conn in
9595 let timeout = Requests.Timeout.create ~total:(Jmap_connection.timeout config) () in
9696···115115 in
116116117117 let json = Ezjsonm.value_from_string body_str in
118118- Jmap_core.Jmap_binary.Upload.of_json json
118118+ Jmap_core.Binary.Upload.of_json json
119119120120let download t ~account_id ~blob_id ~name =
121121 let session = get_session t in
122122- let download_url = Jmap_core.Jmap_session.download_url session in
122122+ let download_url = Jmap_core.Session.download_url session in
123123 let config = Jmap_connection.config t.conn in
124124 let timeout = Requests.Timeout.create ~total:(Jmap_connection.timeout config) () in
125125
+4-4
stack/jmap/jmap-client/jmap_client.mli
···1818 t
19192020(** Fetch session from server *)
2121-val fetch_session : t -> Jmap_core.Jmap_session.t
2121+val fetch_session : t -> Jmap_core.Session.t
22222323(** Get cached session or fetch if needed *)
2424-val get_session : t -> Jmap_core.Jmap_session.t
2424+val get_session : t -> Jmap_core.Session.t
25252626(** Make a JMAP API call *)
2727-val call : t -> Jmap_core.Jmap_request.t -> Jmap_core.Jmap_response.t
2727+val call : t -> Jmap_core.Request.t -> Jmap_core.Response.t
28282929(** Upload a blob *)
3030val upload :
···3232 account_id:string ->
3333 content_type:string ->
3434 string ->
3535- Jmap_core.Jmap_binary.Upload.t
3535+ Jmap_core.Binary.Upload.t
36363737(** Download a blob *)
3838val download :
···3939 }
4040 *)
4141 let of_json json =
4242- let open Jmap_core.Jmap_parser.Helpers in
4242+ let open Jmap_core.Parser.Helpers in
4343 let fields = expect_object json in
4444 let name = get_string_opt "name" fields in
4545 let email = get_string "email" fields in
···7070 }
71717272 let of_json json =
7373- let open Jmap_core.Jmap_parser.Helpers in
7373+ let open Jmap_core.Parser.Helpers in
7474 let fields = expect_object json in
7575 let name = get_string "name" fields in
7676 let value = get_string "value" fields in
···9595module BodyPart = struct
9696 type t = {
9797 part_id : string option; (** Part ID for referencing this part *)
9898- blob_id : Jmap_core.Jmap_id.t option; (** Blob ID for fetching raw content *)
9999- size : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Size in octets *)
9898+ blob_id : Jmap_core.Id.t option; (** Blob ID for fetching raw content *)
9999+ size : Jmap_core.Primitives.UnsignedInt.t; (** Size in octets *)
100100 headers : EmailHeader.t list; (** All header fields *)
101101 name : string option; (** Name from Content-Disposition or Content-Type *)
102102 type_ : string; (** Content-Type value (e.g., "text/plain") *)
···132132 }
133133 *)
134134 let rec of_json json =
135135- let open Jmap_core.Jmap_parser.Helpers in
135135+ let open Jmap_core.Parser.Helpers in
136136 let fields = expect_object json in
137137 let part_id = get_string_opt "partId" fields in
138138 let blob_id = match find_field "blobId" fields with
139139- | Some (`String s) -> Some (Jmap_core.Jmap_id.of_string s)
139139+ | Some (`String s) -> Some (Jmap_core.Id.of_string s)
140140 | Some `Null | None -> None
141141- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "blobId must be a string")
141141+ | Some _ -> raise (Jmap_core.Error.Parse_error "blobId must be a string")
142142 in
143143 let size = match find_field "size" fields with
144144- | Some s -> Jmap_core.Jmap_primitives.UnsignedInt.of_json s
145145- | None -> Jmap_core.Jmap_primitives.UnsignedInt.of_int 0
144144+ | Some s -> Jmap_core.Primitives.UnsignedInt.of_json s
145145+ | None -> Jmap_core.Primitives.UnsignedInt.of_int 0
146146 in
147147 let headers = match find_field "headers" fields with
148148 | Some (`A items) -> List.map EmailHeader.of_json items
149149 | Some `Null | None -> []
150150- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "headers must be an array")
150150+ | Some _ -> raise (Jmap_core.Error.Parse_error "headers must be an array")
151151 in
152152 let name = get_string_opt "name" fields in
153153 let type_ = get_string "type" fields in
···157157 let language = match find_field "language" fields with
158158 | Some (`A items) -> Some (List.map expect_string items)
159159 | Some `Null | None -> None
160160- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "language must be an array")
160160+ | Some _ -> raise (Jmap_core.Error.Parse_error "language must be an array")
161161 in
162162 let location = get_string_opt "location" fields in
163163 let sub_parts = match find_field "subParts" fields with
164164 | Some (`A items) -> Some (List.map of_json items)
165165 | Some `Null | None -> None
166166- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "subParts must be an array")
166166+ | Some _ -> raise (Jmap_core.Error.Parse_error "subParts must be an array")
167167 in
168168 { part_id; blob_id; size; headers; name; type_; charset;
169169 disposition; cid; language; location; sub_parts }
···175175 | None -> fields
176176 in
177177 let fields = match t.blob_id with
178178- | Some id -> ("blobId", Jmap_core.Jmap_id.to_json id) :: fields
178178+ | Some id -> ("blobId", Jmap_core.Id.to_json id) :: fields
179179 | None -> fields
180180 in
181181- let fields = ("size", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.size) :: fields in
181181+ let fields = ("size", Jmap_core.Primitives.UnsignedInt.to_json t.size) :: fields in
182182 let fields = if t.headers <> [] then
183183 ("headers", `A (List.map EmailHeader.to_json t.headers)) :: fields
184184 else
···254254 }
255255 *)
256256 let of_json json =
257257- let open Jmap_core.Jmap_parser.Helpers in
257257+ let open Jmap_core.Parser.Helpers in
258258 let fields = expect_object json in
259259 let value = get_string "value" fields in
260260 let is_encoding_problem = get_bool_opt "isEncodingProblem" fields false in
···281281(** Email object type (RFC 8621 Section 4.1) *)
282282type t = {
283283 (* Metadata properties *)
284284- id : Jmap_core.Jmap_id.t; (** Immutable server-assigned id *)
285285- blob_id : Jmap_core.Jmap_id.t; (** Blob ID for downloading raw message *)
286286- thread_id : Jmap_core.Jmap_id.t; (** Thread ID this email belongs to *)
287287- mailbox_ids : (Jmap_core.Jmap_id.t * bool) list; (** Map of mailbox IDs to true *)
284284+ id : Jmap_core.Id.t; (** Immutable server-assigned id *)
285285+ blob_id : Jmap_core.Id.t; (** Blob ID for downloading raw message *)
286286+ thread_id : Jmap_core.Id.t; (** Thread ID this email belongs to *)
287287+ mailbox_ids : (Jmap_core.Id.t * bool) list; (** Map of mailbox IDs to true *)
288288 keywords : (string * bool) list; (** Map of keywords to true (e.g., "$seen") *)
289289- size : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Size in octets *)
290290- received_at : Jmap_core.Jmap_primitives.UTCDate.t; (** Date message was received *)
289289+ size : Jmap_core.Primitives.UnsignedInt.t; (** Size in octets *)
290290+ received_at : Jmap_core.Primitives.UTCDate.t; (** Date message was received *)
291291292292 (* Header properties - commonly used headers *)
293293 message_id : string list option; (** Message-ID header field values *)
···300300 bcc : EmailAddress.t list option; (** Bcc header *)
301301 reply_to : EmailAddress.t list option; (** Reply-To header *)
302302 subject : string option; (** Subject header *)
303303- sent_at : Jmap_core.Jmap_primitives.Date.t option; (** Date header *)
303303+ sent_at : Jmap_core.Primitives.Date.t option; (** Date header *)
304304305305 (* Body properties *)
306306 body_structure : BodyPart.t option; (** Full MIME structure *)
···365365 }
366366*)
367367let of_json json =
368368- let open Jmap_core.Jmap_parser.Helpers in
368368+ let open Jmap_core.Parser.Helpers in
369369 let fields = expect_object json in
370370371371 (* Required fields *)
372372- let id = Jmap_core.Jmap_id.of_json (require_field "id" fields) in
373373- let blob_id = Jmap_core.Jmap_id.of_json (require_field "blobId" fields) in
374374- let thread_id = Jmap_core.Jmap_id.of_json (require_field "threadId" fields) in
372372+ let id = Jmap_core.Id.of_json (require_field "id" fields) in
373373+ let blob_id = Jmap_core.Id.of_json (require_field "blobId" fields) in
374374+ let thread_id = Jmap_core.Id.of_json (require_field "threadId" fields) in
375375376376 (* mailboxIds - map of id -> bool *)
377377 let mailbox_ids = match require_field "mailboxIds" fields with
378378 | `O map_fields ->
379379 List.map (fun (k, v) ->
380380- (Jmap_core.Jmap_id.of_string k, expect_bool v)
380380+ (Jmap_core.Id.of_string k, expect_bool v)
381381 ) map_fields
382382- | _ -> raise (Jmap_core.Jmap_error.Parse_error "mailboxIds must be an object")
382382+ | _ -> raise (Jmap_core.Error.Parse_error "mailboxIds must be an object")
383383 in
384384385385 (* keywords - map of string -> bool *)
386386 let keywords = match require_field "keywords" fields with
387387 | `O map_fields ->
388388 List.map (fun (k, v) -> (k, expect_bool v)) map_fields
389389- | _ -> raise (Jmap_core.Jmap_error.Parse_error "keywords must be an object")
389389+ | _ -> raise (Jmap_core.Error.Parse_error "keywords must be an object")
390390 in
391391392392- let size = Jmap_core.Jmap_primitives.UnsignedInt.of_json (require_field "size" fields) in
393393- let received_at = Jmap_core.Jmap_primitives.UTCDate.of_json (require_field "receivedAt" fields) in
392392+ let size = Jmap_core.Primitives.UnsignedInt.of_json (require_field "size" fields) in
393393+ let received_at = Jmap_core.Primitives.UTCDate.of_json (require_field "receivedAt" fields) in
394394395395 (* Optional header fields *)
396396 let message_id = match find_field "messageId" fields with
397397 | Some (`A items) -> Some (List.map expect_string items)
398398 | Some `Null | None -> None
399399- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "messageId must be an array")
399399+ | Some _ -> raise (Jmap_core.Error.Parse_error "messageId must be an array")
400400 in
401401 let in_reply_to = match find_field "inReplyTo" fields with
402402 | Some (`A items) -> Some (List.map expect_string items)
403403 | Some `Null | None -> None
404404- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "inReplyTo must be an array")
404404+ | Some _ -> raise (Jmap_core.Error.Parse_error "inReplyTo must be an array")
405405 in
406406 let references = match find_field "references" fields with
407407 | Some (`A items) -> Some (List.map expect_string items)
408408 | Some `Null | None -> None
409409- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "references must be an array")
409409+ | Some _ -> raise (Jmap_core.Error.Parse_error "references must be an array")
410410 in
411411 let sender = match find_field "sender" fields with
412412 | Some (`A items) -> Some (List.map EmailAddress.of_json items)
413413 | Some `Null | None -> None
414414- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "sender must be an array")
414414+ | Some _ -> raise (Jmap_core.Error.Parse_error "sender must be an array")
415415 in
416416 let from = match find_field "from" fields with
417417 | Some (`A items) -> Some (List.map EmailAddress.of_json items)
418418 | Some `Null | None -> None
419419- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "from must be an array")
419419+ | Some _ -> raise (Jmap_core.Error.Parse_error "from must be an array")
420420 in
421421 let to_ = match find_field "to" fields with
422422 | Some (`A items) -> Some (List.map EmailAddress.of_json items)
423423 | Some `Null | None -> None
424424- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "to must be an array")
424424+ | Some _ -> raise (Jmap_core.Error.Parse_error "to must be an array")
425425 in
426426 let cc = match find_field "cc" fields with
427427 | Some (`A items) -> Some (List.map EmailAddress.of_json items)
428428 | Some `Null | None -> None
429429- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "cc must be an array")
429429+ | Some _ -> raise (Jmap_core.Error.Parse_error "cc must be an array")
430430 in
431431 let bcc = match find_field "bcc" fields with
432432 | Some (`A items) -> Some (List.map EmailAddress.of_json items)
433433 | Some `Null | None -> None
434434- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "bcc must be an array")
434434+ | Some _ -> raise (Jmap_core.Error.Parse_error "bcc must be an array")
435435 in
436436 let reply_to = match find_field "replyTo" fields with
437437 | Some (`A items) -> Some (List.map EmailAddress.of_json items)
438438 | Some `Null | None -> None
439439- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "replyTo must be an array")
439439+ | Some _ -> raise (Jmap_core.Error.Parse_error "replyTo must be an array")
440440 in
441441 let subject = get_string_opt "subject" fields in
442442 let sent_at = match find_field "sentAt" fields with
443443- | Some (`String s) -> Some (Jmap_core.Jmap_primitives.Date.of_string s)
443443+ | Some (`String s) -> Some (Jmap_core.Primitives.Date.of_string s)
444444 | Some `Null | None -> None
445445- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "sentAt must be a string")
445445+ | Some _ -> raise (Jmap_core.Error.Parse_error "sentAt must be a string")
446446 in
447447448448 (* Body properties *)
449449 let body_structure = match find_field "bodyStructure" fields with
450450 | Some ((`O _) as json) -> Some (BodyPart.of_json json)
451451 | Some `Null | None -> None
452452- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "bodyStructure must be an object")
452452+ | Some _ -> raise (Jmap_core.Error.Parse_error "bodyStructure must be an object")
453453 in
454454455455 (* bodyValues - map of partId -> BodyValue *)
···457457 | Some (`O map_fields) ->
458458 Some (List.map (fun (k, v) -> (k, BodyValue.of_json v)) map_fields)
459459 | Some `Null | None -> None
460460- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "bodyValues must be an object")
460460+ | Some _ -> raise (Jmap_core.Error.Parse_error "bodyValues must be an object")
461461 in
462462463463 let text_body = match find_field "textBody" fields with
464464 | Some (`A items) -> Some (List.map BodyPart.of_json items)
465465 | Some `Null | None -> None
466466- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "textBody must be an array")
466466+ | Some _ -> raise (Jmap_core.Error.Parse_error "textBody must be an array")
467467 in
468468 let html_body = match find_field "htmlBody" fields with
469469 | Some (`A items) -> Some (List.map BodyPart.of_json items)
470470 | Some `Null | None -> None
471471- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "htmlBody must be an array")
471471+ | Some _ -> raise (Jmap_core.Error.Parse_error "htmlBody must be an array")
472472 in
473473 let attachments = match find_field "attachments" fields with
474474 | Some (`A items) -> Some (List.map BodyPart.of_json items)
475475 | Some `Null | None -> None
476476- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "attachments must be an array")
476476+ | Some _ -> raise (Jmap_core.Error.Parse_error "attachments must be an array")
477477 in
478478479479 let has_attachment = get_bool_opt "hasAttachment" fields false in
···486486487487let to_json t =
488488 let fields = [
489489- ("id", Jmap_core.Jmap_id.to_json t.id);
490490- ("blobId", Jmap_core.Jmap_id.to_json t.blob_id);
491491- ("threadId", Jmap_core.Jmap_id.to_json t.thread_id);
489489+ ("id", Jmap_core.Id.to_json t.id);
490490+ ("blobId", Jmap_core.Id.to_json t.blob_id);
491491+ ("threadId", Jmap_core.Id.to_json t.thread_id);
492492 ("mailboxIds", `O (List.map (fun (id, b) ->
493493- (Jmap_core.Jmap_id.to_string id, `Bool b)) t.mailbox_ids));
493493+ (Jmap_core.Id.to_string id, `Bool b)) t.mailbox_ids));
494494 ("keywords", `O (List.map (fun (k, b) -> (k, `Bool b)) t.keywords));
495495- ("size", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.size);
496496- ("receivedAt", Jmap_core.Jmap_primitives.UTCDate.to_json t.received_at);
495495+ ("size", Jmap_core.Primitives.UnsignedInt.to_json t.size);
496496+ ("receivedAt", Jmap_core.Primitives.UTCDate.to_json t.received_at);
497497 ("hasAttachment", `Bool t.has_attachment);
498498 ("preview", `String t.preview);
499499 ] in
···540540 | None -> fields
541541 in
542542 let fields = match t.sent_at with
543543- | Some d -> ("sentAt", Jmap_core.Jmap_primitives.Date.to_json d) :: fields
543543+ | Some d -> ("sentAt", Jmap_core.Primitives.Date.to_json d) :: fields
544544 | None -> fields
545545 in
546546 let fields = match t.body_structure with
···569569(** Email-specific filter for /query (RFC 8621 Section 4.4) *)
570570module Filter = struct
571571 type t = {
572572- in_mailbox : Jmap_core.Jmap_id.t option; (** Email is in this mailbox *)
573573- in_mailbox_other_than : Jmap_core.Jmap_id.t list option; (** Email is in a mailbox other than these *)
574574- before : Jmap_core.Jmap_primitives.UTCDate.t option; (** receivedAt < this date *)
575575- after : Jmap_core.Jmap_primitives.UTCDate.t option; (** receivedAt >= this date *)
576576- min_size : Jmap_core.Jmap_primitives.UnsignedInt.t option; (** size >= this value *)
577577- max_size : Jmap_core.Jmap_primitives.UnsignedInt.t option; (** size < this value *)
572572+ in_mailbox : Jmap_core.Id.t option; (** Email is in this mailbox *)
573573+ in_mailbox_other_than : Jmap_core.Id.t list option; (** Email is in a mailbox other than these *)
574574+ before : Jmap_core.Primitives.UTCDate.t option; (** receivedAt < this date *)
575575+ after : Jmap_core.Primitives.UTCDate.t option; (** receivedAt >= this date *)
576576+ min_size : Jmap_core.Primitives.UnsignedInt.t option; (** size >= this value *)
577577+ max_size : Jmap_core.Primitives.UnsignedInt.t option; (** size < this value *)
578578 all_in_thread_have_keyword : string option; (** All emails in thread have this keyword *)
579579 some_in_thread_have_keyword : string option; (** Some email in thread has this keyword *)
580580 none_in_thread_have_keyword : string option; (** No email in thread has this keyword *)
···592592 }
593593594594 let of_json json =
595595- let open Jmap_core.Jmap_parser.Helpers in
595595+ let open Jmap_core.Parser.Helpers in
596596 let fields = expect_object json in
597597 let in_mailbox = match find_field "inMailbox" fields with
598598- | Some (`String s) -> Some (Jmap_core.Jmap_id.of_string s)
598598+ | Some (`String s) -> Some (Jmap_core.Id.of_string s)
599599 | Some `Null | None -> None
600600- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "inMailbox must be a string")
600600+ | Some _ -> raise (Jmap_core.Error.Parse_error "inMailbox must be a string")
601601 in
602602 let in_mailbox_other_than = match find_field "inMailboxOtherThan" fields with
603603- | Some (`A items) -> Some (List.map (fun s -> Jmap_core.Jmap_id.of_json s) items)
603603+ | Some (`A items) -> Some (List.map (fun s -> Jmap_core.Id.of_json s) items)
604604 | Some `Null | None -> None
605605- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "inMailboxOtherThan must be an array")
605605+ | Some _ -> raise (Jmap_core.Error.Parse_error "inMailboxOtherThan must be an array")
606606 in
607607 let before = match find_field "before" fields with
608608- | Some (`String s) -> Some (Jmap_core.Jmap_primitives.UTCDate.of_string s)
608608+ | Some (`String s) -> Some (Jmap_core.Primitives.UTCDate.of_string s)
609609 | Some `Null | None -> None
610610- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "before must be a string")
610610+ | Some _ -> raise (Jmap_core.Error.Parse_error "before must be a string")
611611 in
612612 let after = match find_field "after" fields with
613613- | Some (`String s) -> Some (Jmap_core.Jmap_primitives.UTCDate.of_string s)
613613+ | Some (`String s) -> Some (Jmap_core.Primitives.UTCDate.of_string s)
614614 | Some `Null | None -> None
615615- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "after must be a string")
615615+ | Some _ -> raise (Jmap_core.Error.Parse_error "after must be a string")
616616 in
617617 let min_size = match find_field "minSize" fields with
618618- | Some s -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json s)
618618+ | Some s -> Some (Jmap_core.Primitives.UnsignedInt.of_json s)
619619 | None -> None
620620 in
621621 let max_size = match find_field "maxSize" fields with
622622- | Some s -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json s)
622622+ | Some s -> Some (Jmap_core.Primitives.UnsignedInt.of_json s)
623623 | None -> None
624624 in
625625 let all_in_thread_have_keyword = get_string_opt "allInThreadHaveKeyword" fields in
···630630 let has_attachment = match find_field "hasAttachment" fields with
631631 | Some (`Bool b) -> Some b
632632 | Some `Null | None -> None
633633- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "hasAttachment must be a boolean")
633633+ | Some _ -> raise (Jmap_core.Error.Parse_error "hasAttachment must be a boolean")
634634 in
635635 let text = get_string_opt "text" fields in
636636 let from = get_string_opt "from" fields in
···648648 (name, value)
649649 ) items)
650650 | Some `Null | None -> None
651651- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "header must be an array")
651651+ | Some _ -> raise (Jmap_core.Error.Parse_error "header must be an array")
652652 in
653653 { in_mailbox; in_mailbox_other_than; before; after; min_size; max_size;
654654 all_in_thread_have_keyword; some_in_thread_have_keyword;
···691691 let to_json t =
692692 let fields = [] in
693693 let fields = match t.in_mailbox with
694694- | Some id -> ("inMailbox", Jmap_core.Jmap_id.to_json id) :: fields
694694+ | Some id -> ("inMailbox", Jmap_core.Id.to_json id) :: fields
695695 | None -> fields
696696 in
697697 let fields = match t.in_mailbox_other_than with
698698- | Some ids -> ("inMailboxOtherThan", `A (List.map Jmap_core.Jmap_id.to_json ids)) :: fields
698698+ | Some ids -> ("inMailboxOtherThan", `A (List.map Jmap_core.Id.to_json ids)) :: fields
699699 | None -> fields
700700 in
701701 let fields = match t.before with
702702- | Some d -> ("before", `String (Jmap_core.Jmap_primitives.UTCDate.to_string d)) :: fields
702702+ | Some d -> ("before", `String (Jmap_core.Primitives.UTCDate.to_string d)) :: fields
703703 | None -> fields
704704 in
705705 let fields = match t.after with
706706- | Some d -> ("after", `String (Jmap_core.Jmap_primitives.UTCDate.to_string d)) :: fields
706706+ | Some d -> ("after", `String (Jmap_core.Primitives.UTCDate.to_string d)) :: fields
707707 | None -> fields
708708 in
709709 let fields = match t.min_size with
710710- | Some s -> ("minSize", Jmap_core.Jmap_primitives.UnsignedInt.to_json s) :: fields
710710+ | Some s -> ("minSize", Jmap_core.Primitives.UnsignedInt.to_json s) :: fields
711711 | None -> fields
712712 in
713713 let fields = match t.max_size with
714714- | Some s -> ("maxSize", Jmap_core.Jmap_primitives.UnsignedInt.to_json s) :: fields
714714+ | Some s -> ("maxSize", Jmap_core.Primitives.UnsignedInt.to_json s) :: fields
715715 | None -> fields
716716 in
717717 let fields = match t.all_in_thread_have_keyword with
···780780(** Standard /get method (RFC 8621 Section 4.2) *)
781781module Get = struct
782782 type request = {
783783- account_id : Jmap_core.Jmap_id.t;
784784- ids : Jmap_core.Jmap_id.t list option;
783783+ account_id : Jmap_core.Id.t;
784784+ ids : Jmap_core.Id.t list option;
785785 properties : string list option;
786786 (* Email-specific get arguments *)
787787 body_properties : string list option; (** Properties to fetch for bodyStructure parts *)
788788 fetch_text_body_values : bool option; (** Fetch bodyValues for textBody parts *)
789789 fetch_html_body_values : bool option; (** Fetch bodyValues for htmlBody parts *)
790790 fetch_all_body_values : bool option; (** Fetch bodyValues for all parts *)
791791- max_body_value_bytes : Jmap_core.Jmap_primitives.UnsignedInt.t option; (** Truncate large body values *)
791791+ max_body_value_bytes : Jmap_core.Primitives.UnsignedInt.t option; (** Truncate large body values *)
792792 }
793793794794- type response = t Jmap_core.Jmap_standard_methods.Get.response
794794+ type response = t Jmap_core.Standard_methods.Get.response
795795796796 (* Accessors for request *)
797797 let account_id req = req.account_id
···816816 - test/data/mail/email_get_full_request.json
817817 *)
818818 let request_of_json json =
819819- let open Jmap_core.Jmap_parser.Helpers in
819819+ let open Jmap_core.Parser.Helpers in
820820 let fields = expect_object json in
821821- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
821821+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
822822 let ids = match find_field "ids" fields with
823823- | Some (`A items) -> Some (List.map Jmap_core.Jmap_id.of_json items)
823823+ | Some (`A items) -> Some (List.map Jmap_core.Id.of_json items)
824824 | Some `Null | None -> None
825825- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "ids must be an array")
825825+ | Some _ -> raise (Jmap_core.Error.Parse_error "ids must be an array")
826826 in
827827 let properties = match find_field "properties" fields with
828828 | Some (`A items) -> Some (List.map expect_string items)
829829 | Some `Null | None -> None
830830- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "properties must be an array")
830830+ | Some _ -> raise (Jmap_core.Error.Parse_error "properties must be an array")
831831 in
832832 let body_properties = match find_field "bodyProperties" fields with
833833 | Some (`A items) -> Some (List.map expect_string items)
834834 | Some `Null | None -> None
835835- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "bodyProperties must be an array")
835835+ | Some _ -> raise (Jmap_core.Error.Parse_error "bodyProperties must be an array")
836836 in
837837 let fetch_text_body_values = match find_field "fetchTextBodyValues" fields with
838838 | Some (`Bool b) -> Some b
839839 | Some `Null | None -> None
840840- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "fetchTextBodyValues must be a boolean")
840840+ | Some _ -> raise (Jmap_core.Error.Parse_error "fetchTextBodyValues must be a boolean")
841841 in
842842 let fetch_html_body_values = match find_field "fetchHTMLBodyValues" fields with
843843 | Some (`Bool b) -> Some b
844844 | Some `Null | None -> None
845845- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "fetchHTMLBodyValues must be a boolean")
845845+ | Some _ -> raise (Jmap_core.Error.Parse_error "fetchHTMLBodyValues must be a boolean")
846846 in
847847 let fetch_all_body_values = match find_field "fetchAllBodyValues" fields with
848848 | Some (`Bool b) -> Some b
849849 | Some `Null | None -> None
850850- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "fetchAllBodyValues must be a boolean")
850850+ | Some _ -> raise (Jmap_core.Error.Parse_error "fetchAllBodyValues must be a boolean")
851851 in
852852 let max_body_value_bytes = match find_field "maxBodyValueBytes" fields with
853853- | Some v -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json v)
853853+ | Some v -> Some (Jmap_core.Primitives.UnsignedInt.of_json v)
854854 | None -> None
855855 in
856856 { account_id; ids; properties; body_properties; fetch_text_body_values;
···862862 - test/data/mail/email_get_full_response.json
863863 *)
864864 let response_of_json json =
865865- Jmap_core.Jmap_standard_methods.Get.response_of_json of_json json
865865+ Jmap_core.Standard_methods.Get.response_of_json of_json json
866866867867 (** Convert get request to JSON *)
868868 let request_to_json req =
869869 let fields = [
870870- ("accountId", Jmap_core.Jmap_id.to_json req.account_id);
870870+ ("accountId", Jmap_core.Id.to_json req.account_id);
871871 ] in
872872 let fields = match req.ids with
873873- | Some ids -> ("ids", `A (List.map Jmap_core.Jmap_id.to_json ids)) :: fields
873873+ | Some ids -> ("ids", `A (List.map Jmap_core.Id.to_json ids)) :: fields
874874 | None -> fields
875875 in
876876 let fields = match req.properties with
···894894 | None -> fields
895895 in
896896 let fields = match req.max_body_value_bytes with
897897- | Some mbvb -> ("maxBodyValueBytes", Jmap_core.Jmap_primitives.UnsignedInt.to_json mbvb) :: fields
897897+ | Some mbvb -> ("maxBodyValueBytes", Jmap_core.Primitives.UnsignedInt.to_json mbvb) :: fields
898898 | None -> fields
899899 in
900900 `O fields
···902902903903(** Standard /changes method (RFC 8621 Section 4.3) *)
904904module Changes = struct
905905- type request = Jmap_core.Jmap_standard_methods.Changes.request
906906- type response = Jmap_core.Jmap_standard_methods.Changes.response
905905+ type request = Jmap_core.Standard_methods.Changes.request
906906+ type response = Jmap_core.Standard_methods.Changes.response
907907908908 let request_of_json json =
909909- Jmap_core.Jmap_standard_methods.Changes.request_of_json json
909909+ Jmap_core.Standard_methods.Changes.request_of_json json
910910911911 let response_of_json json =
912912- Jmap_core.Jmap_standard_methods.Changes.response_of_json json
912912+ Jmap_core.Standard_methods.Changes.response_of_json json
913913end
914914915915(** Standard /query method (RFC 8621 Section 4.4) *)
916916module Query = struct
917917 type request = {
918918- account_id : Jmap_core.Jmap_id.t;
919919- filter : Filter.t Jmap_core.Jmap_filter.t option;
920920- sort : Jmap_core.Jmap_comparator.t list option;
921921- position : Jmap_core.Jmap_primitives.Int53.t option;
922922- anchor : Jmap_core.Jmap_id.t option;
923923- anchor_offset : Jmap_core.Jmap_primitives.Int53.t option;
924924- limit : Jmap_core.Jmap_primitives.UnsignedInt.t option;
918918+ account_id : Jmap_core.Id.t;
919919+ filter : Filter.t Jmap_core.Filter.t option;
920920+ sort : Jmap_core.Comparator.t list option;
921921+ position : Jmap_core.Primitives.Int53.t option;
922922+ anchor : Jmap_core.Id.t option;
923923+ anchor_offset : Jmap_core.Primitives.Int53.t option;
924924+ limit : Jmap_core.Primitives.UnsignedInt.t option;
925925 calculate_total : bool option;
926926 (* Email-specific query arguments *)
927927 collapse_threads : bool option; (** Return only one email per thread *)
928928 }
929929930930- type response = Jmap_core.Jmap_standard_methods.Query.response
930930+ type response = Jmap_core.Standard_methods.Query.response
931931932932 (* Accessors for request *)
933933 let account_id req = req.account_id
···949949 (** Parse query request from JSON.
950950 Test files: test/data/mail/email_query_request.json *)
951951 let request_of_json json =
952952- let open Jmap_core.Jmap_parser.Helpers in
952952+ let open Jmap_core.Parser.Helpers in
953953 let fields = expect_object json in
954954- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
954954+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
955955 let filter = match find_field "filter" fields with
956956- | Some v -> Some (Jmap_core.Jmap_filter.of_json Filter.of_json v)
956956+ | Some v -> Some (Jmap_core.Filter.of_json Filter.of_json v)
957957 | None -> None
958958 in
959959 let sort = match find_field "sort" fields with
960960- | Some (`A items) -> Some (List.map Jmap_core.Jmap_comparator.of_json items)
960960+ | Some (`A items) -> Some (List.map Jmap_core.Comparator.of_json items)
961961 | Some `Null | None -> None
962962- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "sort must be an array")
962962+ | Some _ -> raise (Jmap_core.Error.Parse_error "sort must be an array")
963963 in
964964 let position = match find_field "position" fields with
965965- | Some v -> Some (Jmap_core.Jmap_primitives.Int53.of_json v)
965965+ | Some v -> Some (Jmap_core.Primitives.Int53.of_json v)
966966 | None -> None
967967 in
968968 let anchor = match find_field "anchor" fields with
969969- | Some (`String s) -> Some (Jmap_core.Jmap_id.of_string s)
969969+ | Some (`String s) -> Some (Jmap_core.Id.of_string s)
970970 | Some `Null | None -> None
971971- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "anchor must be a string")
971971+ | Some _ -> raise (Jmap_core.Error.Parse_error "anchor must be a string")
972972 in
973973 let anchor_offset = match find_field "anchorOffset" fields with
974974- | Some v -> Some (Jmap_core.Jmap_primitives.Int53.of_json v)
974974+ | Some v -> Some (Jmap_core.Primitives.Int53.of_json v)
975975 | None -> None
976976 in
977977 let limit = match find_field "limit" fields with
978978- | Some v -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json v)
978978+ | Some v -> Some (Jmap_core.Primitives.UnsignedInt.of_json v)
979979 | None -> None
980980 in
981981 let calculate_total = match find_field "calculateTotal" fields with
982982 | Some (`Bool b) -> Some b
983983 | Some `Null | None -> None
984984- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "calculateTotal must be a boolean")
984984+ | Some _ -> raise (Jmap_core.Error.Parse_error "calculateTotal must be a boolean")
985985 in
986986 let collapse_threads = match find_field "collapseThreads" fields with
987987 | Some (`Bool b) -> Some b
988988 | Some `Null | None -> None
989989- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "collapseThreads must be a boolean")
989989+ | Some _ -> raise (Jmap_core.Error.Parse_error "collapseThreads must be a boolean")
990990 in
991991 { account_id; filter; sort; position; anchor; anchor_offset;
992992 limit; calculate_total; collapse_threads }
···994994 (** Parse query response from JSON.
995995 Test files: test/data/mail/email_query_response.json *)
996996 let response_of_json json =
997997- Jmap_core.Jmap_standard_methods.Query.response_of_json json
997997+ Jmap_core.Standard_methods.Query.response_of_json json
998998999999 (** Convert query request to JSON *)
10001000 let request_to_json req =
10011001 let fields = [
10021002- ("accountId", Jmap_core.Jmap_id.to_json req.account_id);
10021002+ ("accountId", Jmap_core.Id.to_json req.account_id);
10031003 ] in
10041004 let fields = match req.filter with
10051005- | Some f -> ("filter", Jmap_core.Jmap_filter.to_json Filter.to_json f) :: fields
10051005+ | Some f -> ("filter", Jmap_core.Filter.to_json Filter.to_json f) :: fields
10061006 | None -> fields
10071007 in
10081008 let fields = match req.sort with
10091009- | Some s -> ("sort", `A (List.map Jmap_core.Jmap_comparator.to_json s)) :: fields
10091009+ | Some s -> ("sort", `A (List.map Jmap_core.Comparator.to_json s)) :: fields
10101010 | None -> fields
10111011 in
10121012 let fields = match req.position with
10131013- | Some p -> ("position", Jmap_core.Jmap_primitives.Int53.to_json p) :: fields
10131013+ | Some p -> ("position", Jmap_core.Primitives.Int53.to_json p) :: fields
10141014 | None -> fields
10151015 in
10161016 let fields = match req.anchor with
10171017- | Some a -> ("anchor", Jmap_core.Jmap_id.to_json a) :: fields
10171017+ | Some a -> ("anchor", Jmap_core.Id.to_json a) :: fields
10181018 | None -> fields
10191019 in
10201020 let fields = match req.anchor_offset with
10211021- | Some ao -> ("anchorOffset", Jmap_core.Jmap_primitives.Int53.to_json ao) :: fields
10211021+ | Some ao -> ("anchorOffset", Jmap_core.Primitives.Int53.to_json ao) :: fields
10221022 | None -> fields
10231023 in
10241024 let fields = match req.limit with
10251025- | Some l -> ("limit", Jmap_core.Jmap_primitives.UnsignedInt.to_json l) :: fields
10251025+ | Some l -> ("limit", Jmap_core.Primitives.UnsignedInt.to_json l) :: fields
10261026 | None -> fields
10271027 in
10281028 let fields = match req.calculate_total with
···10391039(** Standard /queryChanges method (RFC 8621 Section 4.5) *)
10401040module QueryChanges = struct
10411041 type request = {
10421042- account_id : Jmap_core.Jmap_id.t;
10431043- filter : Filter.t Jmap_core.Jmap_filter.t option;
10441044- sort : Jmap_core.Jmap_comparator.t list option;
10421042+ account_id : Jmap_core.Id.t;
10431043+ filter : Filter.t Jmap_core.Filter.t option;
10441044+ sort : Jmap_core.Comparator.t list option;
10451045 since_query_state : string;
10461046- max_changes : Jmap_core.Jmap_primitives.UnsignedInt.t option;
10471047- up_to_id : Jmap_core.Jmap_id.t option;
10461046+ max_changes : Jmap_core.Primitives.UnsignedInt.t option;
10471047+ up_to_id : Jmap_core.Id.t option;
10481048 calculate_total : bool option;
10491049 (* Email-specific *)
10501050 collapse_threads : bool option;
10511051 }
1052105210531053- type response = Jmap_core.Jmap_standard_methods.QueryChanges.response
10531053+ type response = Jmap_core.Standard_methods.QueryChanges.response
1054105410551055 (* Accessors for request *)
10561056 let account_id req = req.account_id
···10691069 up_to_id; calculate_total; collapse_threads }
1070107010711071 let request_of_json json =
10721072- let open Jmap_core.Jmap_parser.Helpers in
10721072+ let open Jmap_core.Parser.Helpers in
10731073 let fields = expect_object json in
10741074- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
10741074+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
10751075 let filter = match find_field "filter" fields with
10761076- | Some v -> Some (Jmap_core.Jmap_filter.of_json Filter.of_json v)
10761076+ | Some v -> Some (Jmap_core.Filter.of_json Filter.of_json v)
10771077 | None -> None
10781078 in
10791079 let sort = match find_field "sort" fields with
10801080- | Some (`A items) -> Some (List.map Jmap_core.Jmap_comparator.of_json items)
10801080+ | Some (`A items) -> Some (List.map Jmap_core.Comparator.of_json items)
10811081 | Some `Null | None -> None
10821082- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "sort must be an array")
10821082+ | Some _ -> raise (Jmap_core.Error.Parse_error "sort must be an array")
10831083 in
10841084 let since_query_state = get_string "sinceQueryState" fields in
10851085 let max_changes = match find_field "maxChanges" fields with
10861086- | Some v -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json v)
10861086+ | Some v -> Some (Jmap_core.Primitives.UnsignedInt.of_json v)
10871087 | None -> None
10881088 in
10891089 let up_to_id = match find_field "upToId" fields with
10901090- | Some (`String s) -> Some (Jmap_core.Jmap_id.of_string s)
10901090+ | Some (`String s) -> Some (Jmap_core.Id.of_string s)
10911091 | Some `Null | None -> None
10921092- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "upToId must be a string")
10921092+ | Some _ -> raise (Jmap_core.Error.Parse_error "upToId must be a string")
10931093 in
10941094 let calculate_total = match find_field "calculateTotal" fields with
10951095 | Some (`Bool b) -> Some b
10961096 | Some `Null | None -> None
10971097- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "calculateTotal must be a boolean")
10971097+ | Some _ -> raise (Jmap_core.Error.Parse_error "calculateTotal must be a boolean")
10981098 in
10991099 let collapse_threads = match find_field "collapseThreads" fields with
11001100 | Some (`Bool b) -> Some b
11011101 | Some `Null | None -> None
11021102- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "collapseThreads must be a boolean")
11021102+ | Some _ -> raise (Jmap_core.Error.Parse_error "collapseThreads must be a boolean")
11031103 in
11041104 { account_id; filter; sort; since_query_state; max_changes;
11051105 up_to_id; calculate_total; collapse_threads }
1106110611071107 let response_of_json json =
11081108- Jmap_core.Jmap_standard_methods.QueryChanges.response_of_json json
11081108+ Jmap_core.Standard_methods.QueryChanges.response_of_json json
11091109end
1110111011111111(** Standard /set method (RFC 8621 Section 4.6) *)
11121112module Set = struct
11131113- type request = t Jmap_core.Jmap_standard_methods.Set.request
11141114- type response = t Jmap_core.Jmap_standard_methods.Set.response
11131113+ type request = t Jmap_core.Standard_methods.Set.request
11141114+ type response = t Jmap_core.Standard_methods.Set.response
1115111511161116 (** Parse set request from JSON.
11171117 Test files: test/data/mail/email_set_request.json *)
11181118 let request_of_json json =
11191119- Jmap_core.Jmap_standard_methods.Set.request_of_json of_json json
11191119+ Jmap_core.Standard_methods.Set.request_of_json of_json json
1120112011211121 (** Parse set response from JSON.
11221122 Test files: test/data/mail/email_set_response.json *)
11231123 let response_of_json json =
11241124- Jmap_core.Jmap_standard_methods.Set.response_of_json of_json json
11241124+ Jmap_core.Standard_methods.Set.response_of_json of_json json
11251125end
1126112611271127(** Standard /copy method (RFC 8621 Section 4.7) *)
11281128module Copy = struct
11291129- type request = t Jmap_core.Jmap_standard_methods.Copy.request
11301130- type response = t Jmap_core.Jmap_standard_methods.Copy.response
11291129+ type request = t Jmap_core.Standard_methods.Copy.request
11301130+ type response = t Jmap_core.Standard_methods.Copy.response
1131113111321132 let request_of_json json =
11331133- Jmap_core.Jmap_standard_methods.Copy.request_of_json of_json json
11331133+ Jmap_core.Standard_methods.Copy.request_of_json of_json json
1134113411351135 let response_of_json json =
11361136- Jmap_core.Jmap_standard_methods.Copy.response_of_json of_json json
11361136+ Jmap_core.Standard_methods.Copy.response_of_json of_json json
11371137end
1138113811391139(** Email/import method (RFC 8621 Section 4.8) *)
11401140module Import = struct
11411141 (** Email import request object *)
11421142 type import_email = {
11431143- blob_id : Jmap_core.Jmap_id.t; (** Blob ID containing raw RFC 5322 message *)
11441144- mailbox_ids : (Jmap_core.Jmap_id.t * bool) list; (** Mailboxes to add email to *)
11431143+ blob_id : Jmap_core.Id.t; (** Blob ID containing raw RFC 5322 message *)
11441144+ mailbox_ids : (Jmap_core.Id.t * bool) list; (** Mailboxes to add email to *)
11451145 keywords : (string * bool) list; (** Keywords to set *)
11461146- received_at : Jmap_core.Jmap_primitives.UTCDate.t option; (** Override received date *)
11461146+ received_at : Jmap_core.Primitives.UTCDate.t option; (** Override received date *)
11471147 }
1148114811491149 type request = {
11501150- account_id : Jmap_core.Jmap_id.t;
11501150+ account_id : Jmap_core.Id.t;
11511151 if_in_state : string option;
11521152- emails : (Jmap_core.Jmap_id.t * import_email) list; (** Map of creation id to import object *)
11521152+ emails : (Jmap_core.Id.t * import_email) list; (** Map of creation id to import object *)
11531153 }
1154115411551155 type response = {
11561156- account_id : Jmap_core.Jmap_id.t;
11561156+ account_id : Jmap_core.Id.t;
11571157 old_state : string option;
11581158 new_state : string;
11591159- created : (Jmap_core.Jmap_id.t * t) list option;
11601160- not_created : (Jmap_core.Jmap_id.t * Jmap_core.Jmap_error.set_error_detail) list option;
11591159+ created : (Jmap_core.Id.t * t) list option;
11601160+ not_created : (Jmap_core.Id.t * Jmap_core.Error.set_error_detail) list option;
11611161 }
1162116211631163 (* Accessors for import_email *)
···11931193 (** Parse import request from JSON.
11941194 Test files: test/data/mail/email_import_request.json *)
11951195 let request_of_json json =
11961196- let open Jmap_core.Jmap_parser.Helpers in
11961196+ let open Jmap_core.Parser.Helpers in
11971197 let fields = expect_object json in
11981198- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
11981198+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
11991199 let if_in_state = get_string_opt "ifInState" fields in
12001200 let emails = match require_field "emails" fields with
12011201 | `O pairs ->
12021202 List.map (fun (k, v) ->
12031203 let ie_fields = expect_object v in
12041204- let blob_id = Jmap_core.Jmap_id.of_json (require_field "blobId" ie_fields) in
12041204+ let blob_id = Jmap_core.Id.of_json (require_field "blobId" ie_fields) in
12051205 let mailbox_ids = match require_field "mailboxIds" ie_fields with
12061206 | `O map_fields ->
12071207 List.map (fun (mid, b) ->
12081208- (Jmap_core.Jmap_id.of_string mid, expect_bool b)
12081208+ (Jmap_core.Id.of_string mid, expect_bool b)
12091209 ) map_fields
12101210- | _ -> raise (Jmap_core.Jmap_error.Parse_error "mailboxIds must be an object")
12101210+ | _ -> raise (Jmap_core.Error.Parse_error "mailboxIds must be an object")
12111211 in
12121212 let keywords = match require_field "keywords" ie_fields with
12131213 | `O map_fields ->
12141214 List.map (fun (kw, b) -> (kw, expect_bool b)) map_fields
12151215- | _ -> raise (Jmap_core.Jmap_error.Parse_error "keywords must be an object")
12151215+ | _ -> raise (Jmap_core.Error.Parse_error "keywords must be an object")
12161216 in
12171217 let received_at = match find_field "receivedAt" ie_fields with
12181218- | Some (`String s) -> Some (Jmap_core.Jmap_primitives.UTCDate.of_string s)
12181218+ | Some (`String s) -> Some (Jmap_core.Primitives.UTCDate.of_string s)
12191219 | Some `Null | None -> None
12201220- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "receivedAt must be a string")
12201220+ | Some _ -> raise (Jmap_core.Error.Parse_error "receivedAt must be a string")
12211221 in
12221222 let import_email = { blob_id; mailbox_ids; keywords; received_at } in
12231223- (Jmap_core.Jmap_id.of_string k, import_email)
12231223+ (Jmap_core.Id.of_string k, import_email)
12241224 ) pairs
12251225- | _ -> raise (Jmap_core.Jmap_error.Parse_error "emails must be an object")
12251225+ | _ -> raise (Jmap_core.Error.Parse_error "emails must be an object")
12261226 in
12271227 { account_id; if_in_state; emails }
1228122812291229 (** Parse import response from JSON.
12301230 Test files: test/data/mail/email_import_response.json *)
12311231 let response_of_json json =
12321232- let open Jmap_core.Jmap_parser.Helpers in
12321232+ let open Jmap_core.Parser.Helpers in
12331233 let fields = expect_object json in
12341234- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
12341234+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
12351235 let old_state = get_string_opt "oldState" fields in
12361236 let new_state = get_string "newState" fields in
12371237 let created = match find_field "created" fields with
12381238 | Some `Null | None -> None
12391239 | Some (`O pairs) ->
12401240 Some (List.map (fun (k, v) ->
12411241- (Jmap_core.Jmap_id.of_string k, of_json v)
12411241+ (Jmap_core.Id.of_string k, of_json v)
12421242 ) pairs)
12431243- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "created must be an object")
12431243+ | Some _ -> raise (Jmap_core.Error.Parse_error "created must be an object")
12441244 in
12451245 let not_created = match find_field "notCreated" fields with
12461246 | Some `Null | None -> None
12471247 | Some (`O pairs) ->
12481248 Some (List.map (fun (k, v) ->
12491249- (Jmap_core.Jmap_id.of_string k, Jmap_core.Jmap_error.parse_set_error_detail v)
12491249+ (Jmap_core.Id.of_string k, Jmap_core.Error.parse_set_error_detail v)
12501250 ) pairs)
12511251- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "notCreated must be an object")
12511251+ | Some _ -> raise (Jmap_core.Error.Parse_error "notCreated must be an object")
12521252 in
12531253 { account_id; old_state; new_state; created; not_created }
12541254end
···12561256(** Email/parse method (RFC 8621 Section 4.9) *)
12571257module Parse = struct
12581258 type request = {
12591259- account_id : Jmap_core.Jmap_id.t;
12601260- blob_ids : Jmap_core.Jmap_id.t list; (** Blob IDs to parse *)
12591259+ account_id : Jmap_core.Id.t;
12601260+ blob_ids : Jmap_core.Id.t list; (** Blob IDs to parse *)
12611261 properties : string list option; (** Email properties to return *)
12621262 body_properties : string list option; (** BodyPart properties to return *)
12631263 fetch_text_body_values : bool option;
12641264 fetch_html_body_values : bool option;
12651265 fetch_all_body_values : bool option;
12661266- max_body_value_bytes : Jmap_core.Jmap_primitives.UnsignedInt.t option;
12661266+ max_body_value_bytes : Jmap_core.Primitives.UnsignedInt.t option;
12671267 }
1268126812691269 type response = {
12701270- account_id : Jmap_core.Jmap_id.t;
12711271- parsed : (Jmap_core.Jmap_id.t * t) list option; (** Map of blob ID to parsed email *)
12721272- not_parsable : Jmap_core.Jmap_id.t list option; (** Blob IDs that couldn't be parsed *)
12731273- not_found : Jmap_core.Jmap_id.t list option; (** Blob IDs that don't exist *)
12701270+ account_id : Jmap_core.Id.t;
12711271+ parsed : (Jmap_core.Id.t * t) list option; (** Map of blob ID to parsed email *)
12721272+ not_parsable : Jmap_core.Id.t list option; (** Blob IDs that couldn't be parsed *)
12731273+ not_found : Jmap_core.Id.t list option; (** Blob IDs that don't exist *)
12741274 }
1275127512761276 (* Accessors for request *)
···13031303 (** Parse parse request from JSON.
13041304 Test files: test/data/mail/email_parse_request.json *)
13051305 let request_of_json json =
13061306- let open Jmap_core.Jmap_parser.Helpers in
13061306+ let open Jmap_core.Parser.Helpers in
13071307 let fields = expect_object json in
13081308- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
13081308+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
13091309 let blob_ids = match require_field "blobIds" fields with
13101310- | `A items -> List.map Jmap_core.Jmap_id.of_json items
13111311- | _ -> raise (Jmap_core.Jmap_error.Parse_error "blobIds must be an array")
13101310+ | `A items -> List.map Jmap_core.Id.of_json items
13111311+ | _ -> raise (Jmap_core.Error.Parse_error "blobIds must be an array")
13121312 in
13131313 let properties = match find_field "properties" fields with
13141314 | Some (`A items) -> Some (List.map expect_string items)
13151315 | Some `Null | None -> None
13161316- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "properties must be an array")
13161316+ | Some _ -> raise (Jmap_core.Error.Parse_error "properties must be an array")
13171317 in
13181318 let body_properties = match find_field "bodyProperties" fields with
13191319 | Some (`A items) -> Some (List.map expect_string items)
13201320 | Some `Null | None -> None
13211321- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "bodyProperties must be an array")
13211321+ | Some _ -> raise (Jmap_core.Error.Parse_error "bodyProperties must be an array")
13221322 in
13231323 let fetch_text_body_values = match find_field "fetchTextBodyValues" fields with
13241324 | Some (`Bool b) -> Some b
13251325 | Some `Null | None -> None
13261326- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "fetchTextBodyValues must be a boolean")
13261326+ | Some _ -> raise (Jmap_core.Error.Parse_error "fetchTextBodyValues must be a boolean")
13271327 in
13281328 let fetch_html_body_values = match find_field "fetchHTMLBodyValues" fields with
13291329 | Some (`Bool b) -> Some b
13301330 | Some `Null | None -> None
13311331- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "fetchHTMLBodyValues must be a boolean")
13311331+ | Some _ -> raise (Jmap_core.Error.Parse_error "fetchHTMLBodyValues must be a boolean")
13321332 in
13331333 let fetch_all_body_values = match find_field "fetchAllBodyValues" fields with
13341334 | Some (`Bool b) -> Some b
13351335 | Some `Null | None -> None
13361336- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "fetchAllBodyValues must be a boolean")
13361336+ | Some _ -> raise (Jmap_core.Error.Parse_error "fetchAllBodyValues must be a boolean")
13371337 in
13381338 let max_body_value_bytes = match find_field "maxBodyValueBytes" fields with
13391339- | Some v -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json v)
13391339+ | Some v -> Some (Jmap_core.Primitives.UnsignedInt.of_json v)
13401340 | None -> None
13411341 in
13421342 { account_id; blob_ids; properties; body_properties; fetch_text_body_values;
···13451345 (** Parse parse response from JSON.
13461346 Test files: test/data/mail/email_parse_response.json *)
13471347 let response_of_json json =
13481348- let open Jmap_core.Jmap_parser.Helpers in
13481348+ let open Jmap_core.Parser.Helpers in
13491349 let fields = expect_object json in
13501350- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
13501350+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
13511351 let parsed = match find_field "parsed" fields with
13521352 | Some `Null | None -> None
13531353 | Some (`O pairs) ->
13541354 Some (List.map (fun (k, v) ->
13551355- (Jmap_core.Jmap_id.of_string k, of_json v)
13551355+ (Jmap_core.Id.of_string k, of_json v)
13561356 ) pairs)
13571357- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "parsed must be an object")
13571357+ | Some _ -> raise (Jmap_core.Error.Parse_error "parsed must be an object")
13581358 in
13591359 let not_parsable = match find_field "notParsable" fields with
13601360- | Some (`A items) -> Some (List.map Jmap_core.Jmap_id.of_json items)
13601360+ | Some (`A items) -> Some (List.map Jmap_core.Id.of_json items)
13611361 | Some `Null | None -> None
13621362- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "notParsable must be an array")
13621362+ | Some _ -> raise (Jmap_core.Error.Parse_error "notParsable must be an array")
13631363 in
13641364 let not_found = match find_field "notFound" fields with
13651365- | Some (`A items) -> Some (List.map Jmap_core.Jmap_id.of_json items)
13651365+ | Some (`A items) -> Some (List.map Jmap_core.Id.of_json items)
13661366 | Some `Null | None -> None
13671367- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "notFound must be an array")
13671367+ | Some _ -> raise (Jmap_core.Error.Parse_error "notFound must be an array")
13681368 in
13691369 { account_id; parsed; not_parsable; not_found }
13701370end
+144-144
stack/jmap/jmap-mail/jmap_email.mli
···4242module BodyPart : sig
4343 type t = {
4444 part_id : string option;
4545- blob_id : Jmap_id.t option;
4646- size : Jmap_primitives.UnsignedInt.t;
4545+ blob_id : Id.t option;
4646+ size : Primitives.UnsignedInt.t;
4747 headers : EmailHeader.t list;
4848 name : string option;
4949 type_ : string;
···57575858 (** Accessors *)
5959 val part_id : t -> string option
6060- val blob_id : t -> Jmap_id.t option
6161- val size : t -> Jmap_primitives.UnsignedInt.t
6060+ val blob_id : t -> Id.t option
6161+ val size : t -> Primitives.UnsignedInt.t
6262 val headers : t -> EmailHeader.t list
6363 val name : t -> string option
6464 val type_ : t -> string
···7272 (** Constructor *)
7373 val v :
7474 ?part_id:string ->
7575- ?blob_id:Jmap_id.t ->
7676- size:Jmap_primitives.UnsignedInt.t ->
7575+ ?blob_id:Id.t ->
7676+ size:Primitives.UnsignedInt.t ->
7777 headers:EmailHeader.t list ->
7878 ?name:string ->
7979 type_:string ->
···112112113113(** Email object type (RFC 8621 Section 4.1) *)
114114type t = {
115115- id : Jmap_id.t;
116116- blob_id : Jmap_id.t;
117117- thread_id : Jmap_id.t;
118118- mailbox_ids : (Jmap_id.t * bool) list;
115115+ id : Id.t;
116116+ blob_id : Id.t;
117117+ thread_id : Id.t;
118118+ mailbox_ids : (Id.t * bool) list;
119119 keywords : (string * bool) list;
120120- size : Jmap_primitives.UnsignedInt.t;
121121- received_at : Jmap_primitives.UTCDate.t;
120120+ size : Primitives.UnsignedInt.t;
121121+ received_at : Primitives.UTCDate.t;
122122 message_id : string list option;
123123 in_reply_to : string list option;
124124 references : string list option;
···129129 bcc : EmailAddress.t list option;
130130 reply_to : EmailAddress.t list option;
131131 subject : string option;
132132- sent_at : Jmap_primitives.Date.t option;
132132+ sent_at : Primitives.Date.t option;
133133 body_structure : BodyPart.t option;
134134 body_values : (string * BodyValue.t) list option;
135135 text_body : BodyPart.t list option;
···140140}
141141142142(** Accessors *)
143143-val id : t -> Jmap_id.t
144144-val blob_id : t -> Jmap_id.t
145145-val thread_id : t -> Jmap_id.t
146146-val mailbox_ids : t -> (Jmap_id.t * bool) list
143143+val id : t -> Id.t
144144+val blob_id : t -> Id.t
145145+val thread_id : t -> Id.t
146146+val mailbox_ids : t -> (Id.t * bool) list
147147val keywords : t -> (string * bool) list
148148-val size : t -> Jmap_primitives.UnsignedInt.t
149149-val received_at : t -> Jmap_primitives.UTCDate.t
148148+val size : t -> Primitives.UnsignedInt.t
149149+val received_at : t -> Primitives.UTCDate.t
150150val message_id : t -> string list option
151151val in_reply_to : t -> string list option
152152val references : t -> string list option
···157157val bcc : t -> EmailAddress.t list option
158158val reply_to : t -> EmailAddress.t list option
159159val subject : t -> string option
160160-val sent_at : t -> Jmap_primitives.Date.t option
160160+val sent_at : t -> Primitives.Date.t option
161161val body_structure : t -> BodyPart.t option
162162val body_values : t -> (string * BodyValue.t) list option
163163val text_body : t -> BodyPart.t list option
···168168169169(** Constructor *)
170170val v :
171171- id:Jmap_id.t ->
172172- blob_id:Jmap_id.t ->
173173- thread_id:Jmap_id.t ->
174174- mailbox_ids:(Jmap_id.t * bool) list ->
171171+ id:Id.t ->
172172+ blob_id:Id.t ->
173173+ thread_id:Id.t ->
174174+ mailbox_ids:(Id.t * bool) list ->
175175 keywords:(string * bool) list ->
176176- size:Jmap_primitives.UnsignedInt.t ->
177177- received_at:Jmap_primitives.UTCDate.t ->
176176+ size:Primitives.UnsignedInt.t ->
177177+ received_at:Primitives.UTCDate.t ->
178178 ?message_id:string list ->
179179 ?in_reply_to:string list ->
180180 ?references:string list ->
···185185 ?bcc:EmailAddress.t list ->
186186 ?reply_to:EmailAddress.t list ->
187187 ?subject:string ->
188188- ?sent_at:Jmap_primitives.Date.t ->
188188+ ?sent_at:Primitives.Date.t ->
189189 ?body_structure:BodyPart.t ->
190190 ?body_values:(string * BodyValue.t) list ->
191191 ?text_body:BodyPart.t list ->
···199199(** Email-specific filter for /query *)
200200module Filter : sig
201201 type t = {
202202- in_mailbox : Jmap_id.t option;
203203- in_mailbox_other_than : Jmap_id.t list option;
204204- before : Jmap_primitives.UTCDate.t option;
205205- after : Jmap_primitives.UTCDate.t option;
206206- min_size : Jmap_primitives.UnsignedInt.t option;
207207- max_size : Jmap_primitives.UnsignedInt.t option;
202202+ in_mailbox : Id.t option;
203203+ in_mailbox_other_than : Id.t list option;
204204+ before : Primitives.UTCDate.t option;
205205+ after : Primitives.UTCDate.t option;
206206+ min_size : Primitives.UnsignedInt.t option;
207207+ max_size : Primitives.UnsignedInt.t option;
208208 all_in_thread_have_keyword : string option;
209209 some_in_thread_have_keyword : string option;
210210 none_in_thread_have_keyword : string option;
···222222 }
223223224224 (** Accessors *)
225225- val in_mailbox : t -> Jmap_id.t option
226226- val in_mailbox_other_than : t -> Jmap_id.t list option
227227- val before : t -> Jmap_primitives.UTCDate.t option
228228- val after : t -> Jmap_primitives.UTCDate.t option
229229- val min_size : t -> Jmap_primitives.UnsignedInt.t option
230230- val max_size : t -> Jmap_primitives.UnsignedInt.t option
225225+ val in_mailbox : t -> Id.t option
226226+ val in_mailbox_other_than : t -> Id.t list option
227227+ val before : t -> Primitives.UTCDate.t option
228228+ val after : t -> Primitives.UTCDate.t option
229229+ val min_size : t -> Primitives.UnsignedInt.t option
230230+ val max_size : t -> Primitives.UnsignedInt.t option
231231 val all_in_thread_have_keyword : t -> string option
232232 val some_in_thread_have_keyword : t -> string option
233233 val none_in_thread_have_keyword : t -> string option
···245245246246 (** Constructor *)
247247 val v :
248248- ?in_mailbox:Jmap_id.t ->
249249- ?in_mailbox_other_than:Jmap_id.t list ->
250250- ?before:Jmap_primitives.UTCDate.t ->
251251- ?after:Jmap_primitives.UTCDate.t ->
252252- ?min_size:Jmap_primitives.UnsignedInt.t ->
253253- ?max_size:Jmap_primitives.UnsignedInt.t ->
248248+ ?in_mailbox:Id.t ->
249249+ ?in_mailbox_other_than:Id.t list ->
250250+ ?before:Primitives.UTCDate.t ->
251251+ ?after:Primitives.UTCDate.t ->
252252+ ?min_size:Primitives.UnsignedInt.t ->
253253+ ?max_size:Primitives.UnsignedInt.t ->
254254 ?all_in_thread_have_keyword:string ->
255255 ?some_in_thread_have_keyword:string ->
256256 ?none_in_thread_have_keyword:string ->
···275275(** Standard /get method *)
276276module Get : sig
277277 type request = {
278278- account_id : Jmap_id.t;
279279- ids : Jmap_id.t list option;
278278+ account_id : Id.t;
279279+ ids : Id.t list option;
280280 properties : string list option;
281281 body_properties : string list option;
282282 fetch_text_body_values : bool option;
283283 fetch_html_body_values : bool option;
284284 fetch_all_body_values : bool option;
285285- max_body_value_bytes : Jmap_primitives.UnsignedInt.t option;
285285+ max_body_value_bytes : Primitives.UnsignedInt.t option;
286286 }
287287288288- type response = t Jmap_standard_methods.Get.response
288288+ type response = t Standard_methods.Get.response
289289290290 (** Accessors for request *)
291291- val account_id : request -> Jmap_id.t
292292- val ids : request -> Jmap_id.t list option
291291+ val account_id : request -> Id.t
292292+ val ids : request -> Id.t list option
293293 val properties : request -> string list option
294294 val body_properties : request -> string list option
295295 val fetch_text_body_values : request -> bool option
296296 val fetch_html_body_values : request -> bool option
297297 val fetch_all_body_values : request -> bool option
298298- val max_body_value_bytes : request -> Jmap_primitives.UnsignedInt.t option
298298+ val max_body_value_bytes : request -> Primitives.UnsignedInt.t option
299299300300 (** Constructor for request *)
301301 val request_v :
302302- account_id:Jmap_id.t ->
303303- ?ids:Jmap_id.t list ->
302302+ account_id:Id.t ->
303303+ ?ids:Id.t list ->
304304 ?properties:string list ->
305305 ?body_properties:string list ->
306306 ?fetch_text_body_values:bool ->
307307 ?fetch_html_body_values:bool ->
308308 ?fetch_all_body_values:bool ->
309309- ?max_body_value_bytes:Jmap_primitives.UnsignedInt.t ->
309309+ ?max_body_value_bytes:Primitives.UnsignedInt.t ->
310310 unit ->
311311 request
312312···317317318318(** Standard /changes method *)
319319module Changes : sig
320320- type request = Jmap_standard_methods.Changes.request
321321- type response = Jmap_standard_methods.Changes.response
320320+ type request = Standard_methods.Changes.request
321321+ type response = Standard_methods.Changes.response
322322323323 val request_of_json : Ezjsonm.value -> request
324324 val response_of_json : Ezjsonm.value -> response
···327327(** Standard /query method *)
328328module Query : sig
329329 type request = {
330330- account_id : Jmap_id.t;
331331- filter : Filter.t Jmap_filter.t option;
332332- sort : Jmap_comparator.t list option;
333333- position : Jmap_primitives.Int53.t option;
334334- anchor : Jmap_id.t option;
335335- anchor_offset : Jmap_primitives.Int53.t option;
336336- limit : Jmap_primitives.UnsignedInt.t option;
330330+ account_id : Id.t;
331331+ filter : Filter.t Jmap_core.Filter.t option;
332332+ sort : Comparator.t list option;
333333+ position : Primitives.Int53.t option;
334334+ anchor : Id.t option;
335335+ anchor_offset : Primitives.Int53.t option;
336336+ limit : Primitives.UnsignedInt.t option;
337337 calculate_total : bool option;
338338 collapse_threads : bool option;
339339 }
340340341341- type response = Jmap_standard_methods.Query.response
341341+ type response = Standard_methods.Query.response
342342343343 (** Accessors for request *)
344344- val account_id : request -> Jmap_id.t
345345- val filter : request -> Filter.t Jmap_filter.t option
346346- val sort : request -> Jmap_comparator.t list option
347347- val position : request -> Jmap_primitives.Int53.t option
348348- val anchor : request -> Jmap_id.t option
349349- val anchor_offset : request -> Jmap_primitives.Int53.t option
350350- val limit : request -> Jmap_primitives.UnsignedInt.t option
344344+ val account_id : request -> Id.t
345345+ val filter : request -> Filter.t Jmap_core.Filter.t option
346346+ val sort : request -> Comparator.t list option
347347+ val position : request -> Primitives.Int53.t option
348348+ val anchor : request -> Id.t option
349349+ val anchor_offset : request -> Primitives.Int53.t option
350350+ val limit : request -> Primitives.UnsignedInt.t option
351351 val calculate_total : request -> bool option
352352 val collapse_threads : request -> bool option
353353354354 (** Constructor for request *)
355355 val request_v :
356356- account_id:Jmap_id.t ->
357357- ?filter:Filter.t Jmap_filter.t ->
358358- ?sort:Jmap_comparator.t list ->
359359- ?position:Jmap_primitives.Int53.t ->
360360- ?anchor:Jmap_id.t ->
361361- ?anchor_offset:Jmap_primitives.Int53.t ->
362362- ?limit:Jmap_primitives.UnsignedInt.t ->
356356+ account_id:Id.t ->
357357+ ?filter:Filter.t Jmap_core.Filter.t ->
358358+ ?sort:Comparator.t list ->
359359+ ?position:Primitives.Int53.t ->
360360+ ?anchor:Id.t ->
361361+ ?anchor_offset:Primitives.Int53.t ->
362362+ ?limit:Primitives.UnsignedInt.t ->
363363 ?calculate_total:bool ->
364364 ?collapse_threads:bool ->
365365 unit ->
···373373(** Standard /queryChanges method *)
374374module QueryChanges : sig
375375 type request = {
376376- account_id : Jmap_id.t;
377377- filter : Filter.t Jmap_filter.t option;
378378- sort : Jmap_comparator.t list option;
376376+ account_id : Id.t;
377377+ filter : Filter.t Jmap_core.Filter.t option;
378378+ sort : Comparator.t list option;
379379 since_query_state : string;
380380- max_changes : Jmap_primitives.UnsignedInt.t option;
381381- up_to_id : Jmap_id.t option;
380380+ max_changes : Primitives.UnsignedInt.t option;
381381+ up_to_id : Id.t option;
382382 calculate_total : bool option;
383383 collapse_threads : bool option;
384384 }
385385386386- type response = Jmap_standard_methods.QueryChanges.response
386386+ type response = Standard_methods.QueryChanges.response
387387388388 (** Accessors for request *)
389389- val account_id : request -> Jmap_id.t
390390- val filter : request -> Filter.t Jmap_filter.t option
391391- val sort : request -> Jmap_comparator.t list option
389389+ val account_id : request -> Id.t
390390+ val filter : request -> Filter.t Jmap_core.Filter.t option
391391+ val sort : request -> Comparator.t list option
392392 val since_query_state : request -> string
393393- val max_changes : request -> Jmap_primitives.UnsignedInt.t option
394394- val up_to_id : request -> Jmap_id.t option
393393+ val max_changes : request -> Primitives.UnsignedInt.t option
394394+ val up_to_id : request -> Id.t option
395395 val calculate_total : request -> bool option
396396 val collapse_threads : request -> bool option
397397398398 (** Constructor for request *)
399399 val request_v :
400400- account_id:Jmap_id.t ->
401401- ?filter:Filter.t Jmap_filter.t ->
402402- ?sort:Jmap_comparator.t list ->
400400+ account_id:Id.t ->
401401+ ?filter:Filter.t Jmap_core.Filter.t ->
402402+ ?sort:Comparator.t list ->
403403 since_query_state:string ->
404404- ?max_changes:Jmap_primitives.UnsignedInt.t ->
405405- ?up_to_id:Jmap_id.t ->
404404+ ?max_changes:Primitives.UnsignedInt.t ->
405405+ ?up_to_id:Id.t ->
406406 ?calculate_total:bool ->
407407 ?collapse_threads:bool ->
408408 unit ->
···414414415415(** Standard /set method *)
416416module Set : sig
417417- type request = t Jmap_standard_methods.Set.request
418418- type response = t Jmap_standard_methods.Set.response
417417+ type request = t Standard_methods.Set.request
418418+ type response = t Standard_methods.Set.response
419419420420 val request_of_json : Ezjsonm.value -> request
421421 val response_of_json : Ezjsonm.value -> response
···423423424424(** Standard /copy method *)
425425module Copy : sig
426426- type request = t Jmap_standard_methods.Copy.request
427427- type response = t Jmap_standard_methods.Copy.response
426426+ type request = t Standard_methods.Copy.request
427427+ type response = t Standard_methods.Copy.response
428428429429 val request_of_json : Ezjsonm.value -> request
430430 val response_of_json : Ezjsonm.value -> response
···434434module Import : sig
435435 (** Email import request object *)
436436 type import_email = {
437437- blob_id : Jmap_id.t;
438438- mailbox_ids : (Jmap_id.t * bool) list;
437437+ blob_id : Id.t;
438438+ mailbox_ids : (Id.t * bool) list;
439439 keywords : (string * bool) list;
440440- received_at : Jmap_primitives.UTCDate.t option;
440440+ received_at : Primitives.UTCDate.t option;
441441 }
442442443443 type request = {
444444- account_id : Jmap_id.t;
444444+ account_id : Id.t;
445445 if_in_state : string option;
446446- emails : (Jmap_id.t * import_email) list;
446446+ emails : (Id.t * import_email) list;
447447 }
448448449449 type response = {
450450- account_id : Jmap_id.t;
450450+ account_id : Id.t;
451451 old_state : string option;
452452 new_state : string;
453453- created : (Jmap_id.t * t) list option;
454454- not_created : (Jmap_id.t * Jmap_error.set_error_detail) list option;
453453+ created : (Id.t * t) list option;
454454+ not_created : (Id.t * Error.set_error_detail) list option;
455455 }
456456457457 (** Accessors for import_email *)
458458- val import_blob_id : import_email -> Jmap_id.t
459459- val import_mailbox_ids : import_email -> (Jmap_id.t * bool) list
458458+ val import_blob_id : import_email -> Id.t
459459+ val import_mailbox_ids : import_email -> (Id.t * bool) list
460460 val import_keywords : import_email -> (string * bool) list
461461- val import_received_at : import_email -> Jmap_primitives.UTCDate.t option
461461+ val import_received_at : import_email -> Primitives.UTCDate.t option
462462463463 (** Constructor for import_email *)
464464 val import_email_v :
465465- blob_id:Jmap_id.t ->
466466- mailbox_ids:(Jmap_id.t * bool) list ->
465465+ blob_id:Id.t ->
466466+ mailbox_ids:(Id.t * bool) list ->
467467 keywords:(string * bool) list ->
468468- ?received_at:Jmap_primitives.UTCDate.t ->
468468+ ?received_at:Primitives.UTCDate.t ->
469469 unit ->
470470 import_email
471471472472 (** Accessors for request *)
473473- val account_id : request -> Jmap_id.t
473473+ val account_id : request -> Id.t
474474 val if_in_state : request -> string option
475475- val emails : request -> (Jmap_id.t * import_email) list
475475+ val emails : request -> (Id.t * import_email) list
476476477477 (** Constructor for request *)
478478 val request_v :
479479- account_id:Jmap_id.t ->
479479+ account_id:Id.t ->
480480 ?if_in_state:string ->
481481- emails:(Jmap_id.t * import_email) list ->
481481+ emails:(Id.t * import_email) list ->
482482 unit ->
483483 request
484484485485 (** Accessors for response *)
486486- val response_account_id : response -> Jmap_id.t
486486+ val response_account_id : response -> Id.t
487487 val old_state : response -> string option
488488 val new_state : response -> string
489489- val created : response -> (Jmap_id.t * t) list option
490490- val not_created : response -> (Jmap_id.t * Jmap_error.set_error_detail) list option
489489+ val created : response -> (Id.t * t) list option
490490+ val not_created : response -> (Id.t * Error.set_error_detail) list option
491491492492 (** Constructor for response *)
493493 val response_v :
494494- account_id:Jmap_id.t ->
494494+ account_id:Id.t ->
495495 ?old_state:string ->
496496 new_state:string ->
497497- ?created:(Jmap_id.t * t) list ->
498498- ?not_created:(Jmap_id.t * Jmap_error.set_error_detail) list ->
497497+ ?created:(Id.t * t) list ->
498498+ ?not_created:(Id.t * Error.set_error_detail) list ->
499499 unit ->
500500 response
501501···506506(** Email/parse method *)
507507module Parse : sig
508508 type request = {
509509- account_id : Jmap_id.t;
510510- blob_ids : Jmap_id.t list;
509509+ account_id : Id.t;
510510+ blob_ids : Id.t list;
511511 properties : string list option;
512512 body_properties : string list option;
513513 fetch_text_body_values : bool option;
514514 fetch_html_body_values : bool option;
515515 fetch_all_body_values : bool option;
516516- max_body_value_bytes : Jmap_primitives.UnsignedInt.t option;
516516+ max_body_value_bytes : Primitives.UnsignedInt.t option;
517517 }
518518519519 type response = {
520520- account_id : Jmap_id.t;
521521- parsed : (Jmap_id.t * t) list option;
522522- not_parsable : Jmap_id.t list option;
523523- not_found : Jmap_id.t list option;
520520+ account_id : Id.t;
521521+ parsed : (Id.t * t) list option;
522522+ not_parsable : Id.t list option;
523523+ not_found : Id.t list option;
524524 }
525525526526 (** Accessors for request *)
527527- val account_id : request -> Jmap_id.t
528528- val blob_ids : request -> Jmap_id.t list
527527+ val account_id : request -> Id.t
528528+ val blob_ids : request -> Id.t list
529529 val properties : request -> string list option
530530 val body_properties : request -> string list option
531531 val fetch_text_body_values : request -> bool option
532532 val fetch_html_body_values : request -> bool option
533533 val fetch_all_body_values : request -> bool option
534534- val max_body_value_bytes : request -> Jmap_primitives.UnsignedInt.t option
534534+ val max_body_value_bytes : request -> Primitives.UnsignedInt.t option
535535536536 (** Constructor for request *)
537537 val request_v :
538538- account_id:Jmap_id.t ->
539539- blob_ids:Jmap_id.t list ->
538538+ account_id:Id.t ->
539539+ blob_ids:Id.t list ->
540540 ?properties:string list ->
541541 ?body_properties:string list ->
542542 ?fetch_text_body_values:bool ->
543543 ?fetch_html_body_values:bool ->
544544 ?fetch_all_body_values:bool ->
545545- ?max_body_value_bytes:Jmap_primitives.UnsignedInt.t ->
545545+ ?max_body_value_bytes:Primitives.UnsignedInt.t ->
546546 unit ->
547547 request
548548549549 (** Accessors for response *)
550550- val response_account_id : response -> Jmap_id.t
551551- val parsed : response -> (Jmap_id.t * t) list option
552552- val not_parsable : response -> Jmap_id.t list option
553553- val not_found : response -> Jmap_id.t list option
550550+ val response_account_id : response -> Id.t
551551+ val parsed : response -> (Id.t * t) list option
552552+ val not_parsable : response -> Id.t list option
553553+ val not_found : response -> Id.t list option
554554555555 (** Constructor for response *)
556556 val response_v :
557557- account_id:Jmap_id.t ->
558558- ?parsed:(Jmap_id.t * t) list ->
559559- ?not_parsable:Jmap_id.t list ->
560560- ?not_found:Jmap_id.t list ->
557557+ account_id:Id.t ->
558558+ ?parsed:(Id.t * t) list ->
559559+ ?not_parsable:Id.t list ->
560560+ ?not_found:Id.t list ->
561561 unit ->
562562 response
563563
+47-47
stack/jmap/jmap-mail/jmap_email_submission.ml
···3636 }
3737 *)
3838 let of_json _json =
3939- raise (Jmap_core.Jmap_error.Parse_error "Address.of_json not yet implemented")
3939+ raise (Jmap_core.Error.Parse_error "Address.of_json not yet implemented")
40404141 let to_json _t =
4242- raise (Jmap_core.Jmap_error.Parse_error "Address.to_json not yet implemented")
4242+ raise (Jmap_core.Error.Parse_error "Address.to_json not yet implemented")
4343end
44444545(** SMTP Envelope (RFC 8621 Section 7.1.1) *)
···7474 }
7575 *)
7676 let of_json _json =
7777- raise (Jmap_core.Jmap_error.Parse_error "Envelope.of_json not yet implemented")
7777+ raise (Jmap_core.Error.Parse_error "Envelope.of_json not yet implemented")
78787979 let to_json _t =
8080- raise (Jmap_core.Jmap_error.Parse_error "Envelope.to_json not yet implemented")
8080+ raise (Jmap_core.Error.Parse_error "Envelope.to_json not yet implemented")
8181end
82828383(** Delivery status for a single recipient (RFC 8621 Section 7.1.4) *)
···119119 }
120120 *)
121121 let of_json _json =
122122- raise (Jmap_core.Jmap_error.Parse_error "DeliveryStatus.of_json not yet implemented")
122122+ raise (Jmap_core.Error.Parse_error "DeliveryStatus.of_json not yet implemented")
123123124124 let to_json _t =
125125- raise (Jmap_core.Jmap_error.Parse_error "DeliveryStatus.to_json not yet implemented")
125125+ raise (Jmap_core.Error.Parse_error "DeliveryStatus.to_json not yet implemented")
126126127127 let delivered_of_string = function
128128 | "queued" -> Queued
···155155156156(** EmailSubmission object type (RFC 8621 Section 7.1) *)
157157type t = {
158158- id : Jmap_core.Jmap_id.t; (** Immutable server-assigned id *)
159159- identity_id : Jmap_core.Jmap_id.t; (** Identity to send from *)
160160- email_id : Jmap_core.Jmap_id.t; (** Email to send *)
161161- thread_id : Jmap_core.Jmap_id.t; (** Thread ID of email *)
158158+ id : Jmap_core.Id.t; (** Immutable server-assigned id *)
159159+ identity_id : Jmap_core.Id.t; (** Identity to send from *)
160160+ email_id : Jmap_core.Id.t; (** Email to send *)
161161+ thread_id : Jmap_core.Id.t; (** Thread ID of email *)
162162 envelope : Envelope.t option; (** SMTP envelope (null = derive from headers) *)
163163- send_at : Jmap_core.Jmap_primitives.UTCDate.t; (** When to send (may be in future) *)
163163+ send_at : Jmap_core.Primitives.UTCDate.t; (** When to send (may be in future) *)
164164 undo_status : undo_status; (** Whether message can be cancelled *)
165165 delivery_status : (string * DeliveryStatus.t) list option; (** Map of email to delivery status *)
166166- dsn_blob_ids : Jmap_core.Jmap_id.t list; (** Blob IDs of received DSN messages *)
167167- mdn_blob_ids : Jmap_core.Jmap_id.t list; (** Blob IDs of received MDN messages *)
166166+ dsn_blob_ids : Jmap_core.Id.t list; (** Blob IDs of received DSN messages *)
167167+ mdn_blob_ids : Jmap_core.Id.t list; (** Blob IDs of received MDN messages *)
168168}
169169170170(** Accessors *)
···185185186186(** Standard /get method (RFC 8621 Section 7.2) *)
187187module Get = struct
188188- type request = t Jmap_core.Jmap_standard_methods.Get.request
189189- type response = t Jmap_core.Jmap_standard_methods.Get.response
188188+ type request = t Jmap_core.Standard_methods.Get.request
189189+ type response = t Jmap_core.Standard_methods.Get.response
190190191191 (** Parse get request from JSON.
192192 Test files: test/data/mail/email_submission_get_request.json
···198198 }
199199 *)
200200 let request_of_json _json =
201201- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Get.request_of_json not yet implemented")
201201+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Get.request_of_json not yet implemented")
202202203203 (** Parse get response from JSON.
204204 Test files: test/data/mail/email_submission_get_response.json
···225225 }
226226 *)
227227 let response_of_json _json =
228228- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Get.response_of_json not yet implemented")
228228+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Get.response_of_json not yet implemented")
229229end
230230231231(** Standard /changes method (RFC 8621 Section 7.3) *)
232232module Changes = struct
233233- type request = Jmap_core.Jmap_standard_methods.Changes.request
234234- type response = Jmap_core.Jmap_standard_methods.Changes.response
233233+ type request = Jmap_core.Standard_methods.Changes.request
234234+ type response = Jmap_core.Standard_methods.Changes.response
235235236236 let request_of_json _json =
237237- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Changes.request_of_json not yet implemented")
237237+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Changes.request_of_json not yet implemented")
238238239239 let response_of_json _json =
240240- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Changes.response_of_json not yet implemented")
240240+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Changes.response_of_json not yet implemented")
241241end
242242243243(** EmailSubmission-specific filter for /query (RFC 8621 Section 7.5) *)
244244module Filter = struct
245245 type t = {
246246- identity_ids : Jmap_core.Jmap_id.t list option; (** Submission uses one of these identities *)
247247- email_ids : Jmap_core.Jmap_id.t list option; (** Submission is for one of these emails *)
248248- thread_ids : Jmap_core.Jmap_id.t list option; (** Submission is for email in one of these threads *)
246246+ identity_ids : Jmap_core.Id.t list option; (** Submission uses one of these identities *)
247247+ email_ids : Jmap_core.Id.t list option; (** Submission is for one of these emails *)
248248+ thread_ids : Jmap_core.Id.t list option; (** Submission is for email in one of these threads *)
249249 undo_status : undo_status option; (** undoStatus equals this *)
250250- before : Jmap_core.Jmap_primitives.UTCDate.t option; (** sendAt < this *)
251251- after : Jmap_core.Jmap_primitives.UTCDate.t option; (** sendAt >= this *)
250250+ before : Jmap_core.Primitives.UTCDate.t option; (** sendAt < this *)
251251+ after : Jmap_core.Primitives.UTCDate.t option; (** sendAt >= this *)
252252 }
253253254254 (** Accessors *)
···264264 { identity_ids; email_ids; thread_ids; undo_status; before; after }
265265266266 let of_json _json =
267267- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Filter.of_json not yet implemented")
267267+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Filter.of_json not yet implemented")
268268end
269269270270(** Standard /query method (RFC 8621 Section 7.5) *)
271271module Query = struct
272272- type request = Filter.t Jmap_core.Jmap_standard_methods.Query.request
273273- type response = Jmap_core.Jmap_standard_methods.Query.response
272272+ type request = Filter.t Jmap_core.Standard_methods.Query.request
273273+ type response = Jmap_core.Standard_methods.Query.response
274274275275 let request_of_json _json =
276276- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Query.request_of_json not yet implemented")
276276+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Query.request_of_json not yet implemented")
277277278278 let response_of_json _json =
279279- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Query.response_of_json not yet implemented")
279279+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Query.response_of_json not yet implemented")
280280end
281281282282(** Standard /queryChanges method (RFC 8621 Section 7.6) *)
283283module QueryChanges = struct
284284- type request = Filter.t Jmap_core.Jmap_standard_methods.QueryChanges.request
285285- type response = Jmap_core.Jmap_standard_methods.QueryChanges.response
284284+ type request = Filter.t Jmap_core.Standard_methods.QueryChanges.request
285285+ type response = Jmap_core.Standard_methods.QueryChanges.response
286286287287 let request_of_json _json =
288288- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.QueryChanges.request_of_json not yet implemented")
288288+ raise (Jmap_core.Error.Parse_error "EmailSubmission.QueryChanges.request_of_json not yet implemented")
289289290290 let response_of_json _json =
291291- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.QueryChanges.response_of_json not yet implemented")
291291+ raise (Jmap_core.Error.Parse_error "EmailSubmission.QueryChanges.response_of_json not yet implemented")
292292end
293293294294(** Standard /set method (RFC 8621 Section 7.4)
···301301module Set = struct
302302 (** On success action for EmailSubmission/set create *)
303303 type on_success = {
304304- set_email_keywords : (Jmap_core.Jmap_id.t * (string * bool) list) option; (** Set keywords on sent email *)
304304+ set_email_keywords : (Jmap_core.Id.t * (string * bool) list) option; (** Set keywords on sent email *)
305305 }
306306307307 type request = {
308308- account_id : Jmap_core.Jmap_id.t;
308308+ account_id : Jmap_core.Id.t;
309309 if_in_state : string option;
310310- create : (Jmap_core.Jmap_id.t * t) list option;
311311- update : (Jmap_core.Jmap_id.t * Jmap_core.Jmap_standard_methods.Set.patch_object) list option;
312312- destroy : Jmap_core.Jmap_id.t list option;
310310+ create : (Jmap_core.Id.t * t) list option;
311311+ update : (Jmap_core.Id.t * Jmap_core.Standard_methods.Set.patch_object) list option;
312312+ destroy : Jmap_core.Id.t list option;
313313 (* EmailSubmission-specific *)
314314- on_success_update_email : (Jmap_core.Jmap_id.t * on_success) list option; (** Actions to perform on success *)
315315- on_success_destroy_email : Jmap_core.Jmap_id.t list option; (** Email IDs to destroy on success *)
314314+ on_success_update_email : (Jmap_core.Id.t * on_success) list option; (** Actions to perform on success *)
315315+ on_success_destroy_email : Jmap_core.Id.t list option; (** Email IDs to destroy on success *)
316316 }
317317318318- type response = t Jmap_core.Jmap_standard_methods.Set.response
318318+ type response = t Jmap_core.Standard_methods.Set.response
319319320320 (** Accessors for on_success *)
321321 let on_success_set_email_keywords os = os.set_email_keywords
···340340 on_success_update_email; on_success_destroy_email }
341341342342 let request_of_json _json =
343343- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Set.request_of_json not yet implemented")
343343+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Set.request_of_json not yet implemented")
344344345345 let response_of_json _json =
346346- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Set.response_of_json not yet implemented")
346346+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Set.response_of_json not yet implemented")
347347end
348348349349(** Parser submodule *)
···376376 *)
377377 let of_json _json =
378378 (* TODO: Implement JSON parsing *)
379379- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Parser.of_json not yet implemented")
379379+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Parser.of_json not yet implemented")
380380381381 let to_json _t =
382382 (* TODO: Implement JSON serialization *)
383383- raise (Jmap_core.Jmap_error.Parse_error "EmailSubmission.Parser.to_json not yet implemented")
383383+ raise (Jmap_core.Error.Parse_error "EmailSubmission.Parser.to_json not yet implemented")
384384end
385385386386(** Helper functions for undo_status *)
+66-66
stack/jmap/jmap-mail/jmap_email_submission.mli
···83838484(** EmailSubmission object type (RFC 8621 Section 7.1) *)
8585type t = {
8686- id : Jmap_id.t;
8787- identity_id : Jmap_id.t;
8888- email_id : Jmap_id.t;
8989- thread_id : Jmap_id.t;
8686+ id : Id.t;
8787+ identity_id : Id.t;
8888+ email_id : Id.t;
8989+ thread_id : Id.t;
9090 envelope : Envelope.t option;
9191- send_at : Jmap_primitives.UTCDate.t;
9191+ send_at : Primitives.UTCDate.t;
9292 undo_status : undo_status;
9393 delivery_status : (string * DeliveryStatus.t) list option;
9494- dsn_blob_ids : Jmap_id.t list;
9595- mdn_blob_ids : Jmap_id.t list;
9494+ dsn_blob_ids : Id.t list;
9595+ mdn_blob_ids : Id.t list;
9696}
97979898(** Accessors *)
9999-val id : t -> Jmap_id.t
100100-val identity_id : t -> Jmap_id.t
101101-val email_id : t -> Jmap_id.t
102102-val thread_id : t -> Jmap_id.t
9999+val id : t -> Id.t
100100+val identity_id : t -> Id.t
101101+val email_id : t -> Id.t
102102+val thread_id : t -> Id.t
103103val envelope : t -> Envelope.t option
104104-val send_at : t -> Jmap_primitives.UTCDate.t
104104+val send_at : t -> Primitives.UTCDate.t
105105val undo_status : t -> undo_status
106106val delivery_status : t -> (string * DeliveryStatus.t) list option
107107-val dsn_blob_ids : t -> Jmap_id.t list
108108-val mdn_blob_ids : t -> Jmap_id.t list
107107+val dsn_blob_ids : t -> Id.t list
108108+val mdn_blob_ids : t -> Id.t list
109109110110(** Constructor *)
111111val v :
112112- id:Jmap_id.t ->
113113- identity_id:Jmap_id.t ->
114114- email_id:Jmap_id.t ->
115115- thread_id:Jmap_id.t ->
112112+ id:Id.t ->
113113+ identity_id:Id.t ->
114114+ email_id:Id.t ->
115115+ thread_id:Id.t ->
116116 ?envelope:Envelope.t ->
117117- send_at:Jmap_primitives.UTCDate.t ->
117117+ send_at:Primitives.UTCDate.t ->
118118 undo_status:undo_status ->
119119 ?delivery_status:(string * DeliveryStatus.t) list ->
120120- dsn_blob_ids:Jmap_id.t list ->
121121- mdn_blob_ids:Jmap_id.t list ->
120120+ dsn_blob_ids:Id.t list ->
121121+ mdn_blob_ids:Id.t list ->
122122 unit ->
123123 t
124124125125(** Standard /get method *)
126126module Get : sig
127127- type request = t Jmap_standard_methods.Get.request
128128- type response = t Jmap_standard_methods.Get.response
127127+ type request = t Standard_methods.Get.request
128128+ type response = t Standard_methods.Get.response
129129130130 val request_of_json : Ezjsonm.value -> request
131131 val response_of_json : Ezjsonm.value -> response
···133133134134(** Standard /changes method *)
135135module Changes : sig
136136- type request = Jmap_standard_methods.Changes.request
137137- type response = Jmap_standard_methods.Changes.response
136136+ type request = Standard_methods.Changes.request
137137+ type response = Standard_methods.Changes.response
138138139139 val request_of_json : Ezjsonm.value -> request
140140 val response_of_json : Ezjsonm.value -> response
···143143(** EmailSubmission-specific filter for /query *)
144144module Filter : sig
145145 type t = {
146146- identity_ids : Jmap_id.t list option;
147147- email_ids : Jmap_id.t list option;
148148- thread_ids : Jmap_id.t list option;
146146+ identity_ids : Id.t list option;
147147+ email_ids : Id.t list option;
148148+ thread_ids : Id.t list option;
149149 undo_status : undo_status option;
150150- before : Jmap_primitives.UTCDate.t option;
151151- after : Jmap_primitives.UTCDate.t option;
150150+ before : Primitives.UTCDate.t option;
151151+ after : Primitives.UTCDate.t option;
152152 }
153153154154 (** Accessors *)
155155- val identity_ids : t -> Jmap_id.t list option
156156- val email_ids : t -> Jmap_id.t list option
157157- val thread_ids : t -> Jmap_id.t list option
155155+ val identity_ids : t -> Id.t list option
156156+ val email_ids : t -> Id.t list option
157157+ val thread_ids : t -> Id.t list option
158158 val undo_status : t -> undo_status option
159159- val before : t -> Jmap_primitives.UTCDate.t option
160160- val after : t -> Jmap_primitives.UTCDate.t option
159159+ val before : t -> Primitives.UTCDate.t option
160160+ val after : t -> Primitives.UTCDate.t option
161161162162 (** Constructor *)
163163 val v :
164164- ?identity_ids:Jmap_id.t list ->
165165- ?email_ids:Jmap_id.t list ->
166166- ?thread_ids:Jmap_id.t list ->
164164+ ?identity_ids:Id.t list ->
165165+ ?email_ids:Id.t list ->
166166+ ?thread_ids:Id.t list ->
167167 ?undo_status:undo_status ->
168168- ?before:Jmap_primitives.UTCDate.t ->
169169- ?after:Jmap_primitives.UTCDate.t ->
168168+ ?before:Primitives.UTCDate.t ->
169169+ ?after:Primitives.UTCDate.t ->
170170 unit ->
171171 t
172172···175175176176(** Standard /query method *)
177177module Query : sig
178178- type request = Filter.t Jmap_standard_methods.Query.request
179179- type response = Jmap_standard_methods.Query.response
178178+ type request = Filter.t Standard_methods.Query.request
179179+ type response = Standard_methods.Query.response
180180181181 val request_of_json : Ezjsonm.value -> request
182182 val response_of_json : Ezjsonm.value -> response
···184184185185(** Standard /queryChanges method *)
186186module QueryChanges : sig
187187- type request = Filter.t Jmap_standard_methods.QueryChanges.request
188188- type response = Jmap_standard_methods.QueryChanges.response
187187+ type request = Filter.t Standard_methods.QueryChanges.request
188188+ type response = Standard_methods.QueryChanges.response
189189190190 val request_of_json : Ezjsonm.value -> request
191191 val response_of_json : Ezjsonm.value -> response
···195195module Set : sig
196196 (** On success action for EmailSubmission/set create *)
197197 type on_success = {
198198- set_email_keywords : (Jmap_id.t * (string * bool) list) option;
198198+ set_email_keywords : (Id.t * (string * bool) list) option;
199199 }
200200201201 type request = {
202202- account_id : Jmap_id.t;
202202+ account_id : Id.t;
203203 if_in_state : string option;
204204- create : (Jmap_id.t * t) list option;
205205- update : (Jmap_id.t * Jmap_standard_methods.Set.patch_object) list option;
206206- destroy : Jmap_id.t list option;
207207- on_success_update_email : (Jmap_id.t * on_success) list option;
208208- on_success_destroy_email : Jmap_id.t list option;
204204+ create : (Id.t * t) list option;
205205+ update : (Id.t * Standard_methods.Set.patch_object) list option;
206206+ destroy : Id.t list option;
207207+ on_success_update_email : (Id.t * on_success) list option;
208208+ on_success_destroy_email : Id.t list option;
209209 }
210210211211- type response = t Jmap_standard_methods.Set.response
211211+ type response = t Standard_methods.Set.response
212212213213 (** Accessors for on_success *)
214214- val on_success_set_email_keywords : on_success -> (Jmap_id.t * (string * bool) list) option
214214+ val on_success_set_email_keywords : on_success -> (Id.t * (string * bool) list) option
215215216216 (** Constructor for on_success *)
217217 val on_success_v :
218218- ?set_email_keywords:(Jmap_id.t * (string * bool) list) ->
218218+ ?set_email_keywords:(Id.t * (string * bool) list) ->
219219 unit ->
220220 on_success
221221222222 (** Accessors for request *)
223223- val account_id : request -> Jmap_id.t
223223+ val account_id : request -> Id.t
224224 val if_in_state : request -> string option
225225- val create : request -> (Jmap_id.t * t) list option
226226- val update : request -> (Jmap_id.t * Jmap_standard_methods.Set.patch_object) list option
227227- val destroy : request -> Jmap_id.t list option
228228- val on_success_update_email : request -> (Jmap_id.t * on_success) list option
229229- val on_success_destroy_email : request -> Jmap_id.t list option
225225+ val create : request -> (Id.t * t) list option
226226+ val update : request -> (Id.t * Standard_methods.Set.patch_object) list option
227227+ val destroy : request -> Id.t list option
228228+ val on_success_update_email : request -> (Id.t * on_success) list option
229229+ val on_success_destroy_email : request -> Id.t list option
230230231231 (** Constructor for request *)
232232 val request_v :
233233- account_id:Jmap_id.t ->
233233+ account_id:Id.t ->
234234 ?if_in_state:string ->
235235- ?create:(Jmap_id.t * t) list ->
236236- ?update:(Jmap_id.t * Jmap_standard_methods.Set.patch_object) list ->
237237- ?destroy:Jmap_id.t list ->
238238- ?on_success_update_email:(Jmap_id.t * on_success) list ->
239239- ?on_success_destroy_email:Jmap_id.t list ->
235235+ ?create:(Id.t * t) list ->
236236+ ?update:(Id.t * Standard_methods.Set.patch_object) list ->
237237+ ?destroy:Id.t list ->
238238+ ?on_success_update_email:(Id.t * on_success) list ->
239239+ ?on_success_destroy_email:Id.t list ->
240240 unit ->
241241 request
242242
+15-15
stack/jmap/jmap-mail/jmap_identity.ml
···14141515(** Identity object type (RFC 8621 Section 6.1) *)
1616type t = {
1717- id : Jmap_core.Jmap_id.t; (** Immutable server-assigned id *)
1717+ id : Jmap_core.Id.t; (** Immutable server-assigned id *)
1818 name : string; (** Display name for this identity (e.g., "Alice Jones") *)
1919 email : string; (** Email address (e.g., "alice@example.com") *)
2020 reply_to : Jmap_email.EmailAddress.t list option; (** Reply-To addresses to use *)
···4545 controls which identities exist based on account configuration.
4646*)
4747module Get = struct
4848- type request = t Jmap_core.Jmap_standard_methods.Get.request
4949- type response = t Jmap_core.Jmap_standard_methods.Get.response
4848+ type request = t Jmap_core.Standard_methods.Get.request
4949+ type response = t Jmap_core.Standard_methods.Get.response
50505151 (** Parse get request from JSON.
5252 Test files: test/data/mail/identity_get_request.json
···5858 }
5959 *)
6060 let request_of_json _json =
6161- raise (Jmap_core.Jmap_error.Parse_error "Identity.Get.request_of_json not yet implemented")
6161+ raise (Jmap_core.Error.Parse_error "Identity.Get.request_of_json not yet implemented")
62626363 (** Parse get response from JSON.
6464 Test files: test/data/mail/identity_get_response.json
···8383 }
8484 *)
8585 let response_of_json _json =
8686- raise (Jmap_core.Jmap_error.Parse_error "Identity.Get.response_of_json not yet implemented")
8686+ raise (Jmap_core.Error.Parse_error "Identity.Get.response_of_json not yet implemented")
8787end
88888989(** Standard /changes method (RFC 8621 Section 6.3) *)
9090module Changes = struct
9191- type request = Jmap_core.Jmap_standard_methods.Changes.request
9292- type response = Jmap_core.Jmap_standard_methods.Changes.response
9191+ type request = Jmap_core.Standard_methods.Changes.request
9292+ type response = Jmap_core.Standard_methods.Changes.response
93939494 let request_of_json _json =
9595- raise (Jmap_core.Jmap_error.Parse_error "Identity.Changes.request_of_json not yet implemented")
9595+ raise (Jmap_core.Error.Parse_error "Identity.Changes.request_of_json not yet implemented")
96969797 let response_of_json _json =
9898- raise (Jmap_core.Jmap_error.Parse_error "Identity.Changes.response_of_json not yet implemented")
9898+ raise (Jmap_core.Error.Parse_error "Identity.Changes.response_of_json not yet implemented")
9999end
100100101101(** Standard /set method (RFC 8621 Section 6.4)
···105105 are derived from server/account configuration.
106106*)
107107module Set = struct
108108- type request = t Jmap_core.Jmap_standard_methods.Set.request
109109- type response = t Jmap_core.Jmap_standard_methods.Set.response
108108+ type request = t Jmap_core.Standard_methods.Set.request
109109+ type response = t Jmap_core.Standard_methods.Set.response
110110111111 let request_of_json _json =
112112- raise (Jmap_core.Jmap_error.Parse_error "Identity.Set.request_of_json not yet implemented")
112112+ raise (Jmap_core.Error.Parse_error "Identity.Set.request_of_json not yet implemented")
113113114114 let response_of_json _json =
115115- raise (Jmap_core.Jmap_error.Parse_error "Identity.Set.response_of_json not yet implemented")
115115+ raise (Jmap_core.Error.Parse_error "Identity.Set.response_of_json not yet implemented")
116116end
117117118118(** Parser submodule *)
···134134 *)
135135 let of_json _json =
136136 (* TODO: Implement JSON parsing *)
137137- raise (Jmap_core.Jmap_error.Parse_error "Identity.Parser.of_json not yet implemented")
137137+ raise (Jmap_core.Error.Parse_error "Identity.Parser.of_json not yet implemented")
138138139139 let to_json _t =
140140 (* TODO: Implement JSON serialization *)
141141- raise (Jmap_core.Jmap_error.Parse_error "Identity.Parser.to_json not yet implemented")
141141+ raise (Jmap_core.Error.Parse_error "Identity.Parser.to_json not yet implemented")
142142end
+9-9
stack/jmap/jmap-mail/jmap_identity.mli
···4455(** Identity object type (RFC 8621 Section 6.1) *)
66type t = {
77- id : Jmap_id.t;
77+ id : Id.t;
88 name : string;
99 email : string;
1010 reply_to : Jmap_email.EmailAddress.t list option;
···1515}
16161717(** Accessors *)
1818-val id : t -> Jmap_id.t
1818+val id : t -> Id.t
1919val name : t -> string
2020val email : t -> string
2121val reply_to : t -> Jmap_email.EmailAddress.t list option
···26262727(** Constructor *)
2828val v :
2929- id:Jmap_id.t ->
2929+ id:Id.t ->
3030 name:string ->
3131 email:string ->
3232 ?reply_to:Jmap_email.EmailAddress.t list ->
···39394040(** Standard /get method *)
4141module Get : sig
4242- type request = t Jmap_standard_methods.Get.request
4343- type response = t Jmap_standard_methods.Get.response
4242+ type request = t Standard_methods.Get.request
4343+ type response = t Standard_methods.Get.response
44444545 val request_of_json : Ezjsonm.value -> request
4646 val response_of_json : Ezjsonm.value -> response
···48484949(** Standard /changes method *)
5050module Changes : sig
5151- type request = Jmap_standard_methods.Changes.request
5252- type response = Jmap_standard_methods.Changes.response
5151+ type request = Standard_methods.Changes.request
5252+ type response = Standard_methods.Changes.response
53535454 val request_of_json : Ezjsonm.value -> request
5555 val response_of_json : Ezjsonm.value -> response
···57575858(** Standard /set method *)
5959module Set : sig
6060- type request = t Jmap_standard_methods.Set.request
6161- type response = t Jmap_standard_methods.Set.response
6060+ type request = t Standard_methods.Set.request
6161+ type response = t Standard_methods.Set.response
62626363 val request_of_json : Ezjsonm.value -> request
6464 val response_of_json : Ezjsonm.value -> response
···4646 }
4747 *)
4848 let of_json json =
4949- let open Jmap_core.Jmap_parser.Helpers in
4949+ let open Jmap_core.Parser.Helpers in
5050 let fields = expect_object json in
5151 {
5252 may_read_items = get_bool "mayReadItems" fields;
···93939494(** Mailbox object type *)
9595type t = {
9696- id : Jmap_core.Jmap_id.t; (** Immutable server-assigned id *)
9696+ id : Jmap_core.Id.t; (** Immutable server-assigned id *)
9797 name : string; (** User-visible mailbox name *)
9898- parent_id : Jmap_core.Jmap_id.t option; (** Parent mailbox id (null for top-level) *)
9898+ parent_id : Jmap_core.Id.t option; (** Parent mailbox id (null for top-level) *)
9999 role : string option; (** Standard role (inbox, trash, sent, etc.) *)
100100- sort_order : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Sort order for display *)
101101- total_emails : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Total number of emails in mailbox *)
102102- unread_emails : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Number of emails without $seen keyword *)
103103- total_threads : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Total number of threads with emails in mailbox *)
104104- unread_threads : Jmap_core.Jmap_primitives.UnsignedInt.t; (** Number of threads with unread emails in mailbox *)
100100+ sort_order : Jmap_core.Primitives.UnsignedInt.t; (** Sort order for display *)
101101+ total_emails : Jmap_core.Primitives.UnsignedInt.t; (** Total number of emails in mailbox *)
102102+ unread_emails : Jmap_core.Primitives.UnsignedInt.t; (** Number of emails without $seen keyword *)
103103+ total_threads : Jmap_core.Primitives.UnsignedInt.t; (** Total number of threads with emails in mailbox *)
104104+ unread_threads : Jmap_core.Primitives.UnsignedInt.t; (** Number of threads with unread emails in mailbox *)
105105 my_rights : Rights.t; (** Current user's access rights *)
106106 is_subscribed : bool; (** Whether user is subscribed to this mailbox *)
107107}
···146146 }
147147 *)
148148 let of_json json =
149149- let open Jmap_core.Jmap_parser.Helpers in
149149+ let open Jmap_core.Parser.Helpers in
150150 let fields = expect_object json in
151151- let id = Jmap_core.Jmap_id.of_json (require_field "id" fields) in
151151+ let id = Jmap_core.Id.of_json (require_field "id" fields) in
152152 let name = get_string "name" fields in
153153 let parent_id = match find_field "parentId" fields with
154154 | Some `Null | None -> None
155155- | Some v -> Some (Jmap_core.Jmap_id.of_json v)
155155+ | Some v -> Some (Jmap_core.Id.of_json v)
156156 in
157157 let role = match find_field "role" fields with
158158 | Some `Null | None -> None
159159 | Some (`String s) -> Some s
160160- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "role must be a string or null")
160160+ | Some _ -> raise (Jmap_core.Error.Parse_error "role must be a string or null")
161161 in
162162- let sort_order = Jmap_core.Jmap_primitives.UnsignedInt.of_json (require_field "sortOrder" fields) in
163163- let total_emails = Jmap_core.Jmap_primitives.UnsignedInt.of_json (require_field "totalEmails" fields) in
164164- let unread_emails = Jmap_core.Jmap_primitives.UnsignedInt.of_json (require_field "unreadEmails" fields) in
165165- let total_threads = Jmap_core.Jmap_primitives.UnsignedInt.of_json (require_field "totalThreads" fields) in
166166- let unread_threads = Jmap_core.Jmap_primitives.UnsignedInt.of_json (require_field "unreadThreads" fields) in
162162+ let sort_order = Jmap_core.Primitives.UnsignedInt.of_json (require_field "sortOrder" fields) in
163163+ let total_emails = Jmap_core.Primitives.UnsignedInt.of_json (require_field "totalEmails" fields) in
164164+ let unread_emails = Jmap_core.Primitives.UnsignedInt.of_json (require_field "unreadEmails" fields) in
165165+ let total_threads = Jmap_core.Primitives.UnsignedInt.of_json (require_field "totalThreads" fields) in
166166+ let unread_threads = Jmap_core.Primitives.UnsignedInt.of_json (require_field "unreadThreads" fields) in
167167 let my_rights = Rights.of_json (require_field "myRights" fields) in
168168 let is_subscribed = get_bool "isSubscribed" fields in
169169 { id; name; parent_id; role; sort_order; total_emails; unread_emails;
···171171172172 let to_json t =
173173 let fields = [
174174- ("id", Jmap_core.Jmap_id.to_json t.id);
174174+ ("id", Jmap_core.Id.to_json t.id);
175175 ("name", `String t.name);
176176- ("sortOrder", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.sort_order);
177177- ("totalEmails", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.total_emails);
178178- ("unreadEmails", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.unread_emails);
179179- ("totalThreads", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.total_threads);
180180- ("unreadThreads", Jmap_core.Jmap_primitives.UnsignedInt.to_json t.unread_threads);
176176+ ("sortOrder", Jmap_core.Primitives.UnsignedInt.to_json t.sort_order);
177177+ ("totalEmails", Jmap_core.Primitives.UnsignedInt.to_json t.total_emails);
178178+ ("unreadEmails", Jmap_core.Primitives.UnsignedInt.to_json t.unread_emails);
179179+ ("totalThreads", Jmap_core.Primitives.UnsignedInt.to_json t.total_threads);
180180+ ("unreadThreads", Jmap_core.Primitives.UnsignedInt.to_json t.unread_threads);
181181 ("myRights", Rights.to_json t.my_rights);
182182 ("isSubscribed", `Bool t.is_subscribed);
183183 ] in
184184 let fields = match t.parent_id with
185185- | Some pid -> ("parentId", Jmap_core.Jmap_id.to_json pid) :: fields
185185+ | Some pid -> ("parentId", Jmap_core.Id.to_json pid) :: fields
186186 | None -> ("parentId", `Null) :: fields
187187 in
188188 let fields = match t.role with
···194194195195(** Standard /get method (RFC 8621 Section 2.2) *)
196196module Get = struct
197197- type request = t Jmap_core.Jmap_standard_methods.Get.request
198198- type response = t Jmap_core.Jmap_standard_methods.Get.response
197197+ type request = t Jmap_core.Standard_methods.Get.request
198198+ type response = t Jmap_core.Standard_methods.Get.response
199199200200 (** Parse get request from JSON *)
201201 let request_of_json json =
202202- Jmap_core.Jmap_standard_methods.Get.request_of_json Parser.of_json json
202202+ Jmap_core.Standard_methods.Get.request_of_json Parser.of_json json
203203204204 (** Parse get response from JSON *)
205205 let response_of_json json =
206206- Jmap_core.Jmap_standard_methods.Get.response_of_json Parser.of_json json
206206+ Jmap_core.Standard_methods.Get.response_of_json Parser.of_json json
207207end
208208209209(** Standard /changes method (RFC 8621 Section 2.3) *)
210210module Changes = struct
211211- type request = Jmap_core.Jmap_standard_methods.Changes.request
212212- type response = Jmap_core.Jmap_standard_methods.Changes.response
211211+ type request = Jmap_core.Standard_methods.Changes.request
212212+ type response = Jmap_core.Standard_methods.Changes.response
213213214214 let request_of_json json =
215215- Jmap_core.Jmap_standard_methods.Changes.request_of_json json
215215+ Jmap_core.Standard_methods.Changes.request_of_json json
216216217217 let response_of_json json =
218218- Jmap_core.Jmap_standard_methods.Changes.response_of_json json
218218+ Jmap_core.Standard_methods.Changes.response_of_json json
219219end
220220221221(** Mailbox-specific filter for /query (RFC 8621 Section 2.5) *)
222222module Filter = struct
223223 type t = {
224224- parent_id : Jmap_core.Jmap_id.t option; (** Mailbox parentId equals this value *)
224224+ parent_id : Jmap_core.Id.t option; (** Mailbox parentId equals this value *)
225225 name : string option; (** Name contains this string (case-insensitive) *)
226226 role : string option; (** Role equals this value *)
227227 has_any_role : bool option; (** Has any role assigned (true) or no role (false) *)
···229229 }
230230231231 let of_json json =
232232- let open Jmap_core.Jmap_parser.Helpers in
232232+ let open Jmap_core.Parser.Helpers in
233233 let fields = expect_object json in
234234 let parent_id = match find_field "parentId" fields with
235235 | Some `Null -> Some None (* Explicitly filter for null parent *)
236236- | Some v -> Some (Some (Jmap_core.Jmap_id.of_json v))
236236+ | Some v -> Some (Some (Jmap_core.Id.of_json v))
237237 | None -> None (* Don't filter on parentId *)
238238 in
239239 let name = get_string_opt "name" fields in
240240 let role = get_string_opt "role" fields in
241241 let has_any_role = match find_field "hasAnyRole" fields with
242242 | Some (`Bool b) -> Some b
243243- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "hasAnyRole must be a boolean")
243243+ | Some _ -> raise (Jmap_core.Error.Parse_error "hasAnyRole must be a boolean")
244244 | None -> None
245245 in
246246 let is_subscribed = match find_field "isSubscribed" fields with
247247 | Some (`Bool b) -> Some b
248248- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "isSubscribed must be a boolean")
248248+ | Some _ -> raise (Jmap_core.Error.Parse_error "isSubscribed must be a boolean")
249249 | None -> None
250250 in
251251 (* Note: parent_id has special handling - None means don't filter,
···271271(** Standard /query method with Mailbox-specific extensions (RFC 8621 Section 2.5) *)
272272module Query = struct
273273 type request = {
274274- account_id : Jmap_core.Jmap_id.t;
275275- filter : Filter.t Jmap_core.Jmap_filter.t option;
276276- sort : Jmap_core.Jmap_comparator.t list option;
277277- position : Jmap_core.Jmap_primitives.Int53.t option;
278278- anchor : Jmap_core.Jmap_id.t option;
279279- anchor_offset : Jmap_core.Jmap_primitives.Int53.t option;
280280- limit : Jmap_core.Jmap_primitives.UnsignedInt.t option;
274274+ account_id : Jmap_core.Id.t;
275275+ filter : Filter.t Jmap_core.Filter.t option;
276276+ sort : Jmap_core.Comparator.t list option;
277277+ position : Jmap_core.Primitives.Int53.t option;
278278+ anchor : Jmap_core.Id.t option;
279279+ anchor_offset : Jmap_core.Primitives.Int53.t option;
280280+ limit : Jmap_core.Primitives.UnsignedInt.t option;
281281 calculate_total : bool option;
282282 (* Mailbox-specific query arguments *)
283283 sort_as_tree : bool option; (** Return results in tree order *)
284284 filter_as_tree : bool option; (** If true, apply filter to tree roots and return descendants *)
285285 }
286286287287- type response = Jmap_core.Jmap_standard_methods.Query.response
287287+ type response = Jmap_core.Standard_methods.Query.response
288288289289 (* Accessors for request *)
290290 let account_id req = req.account_id
···307307 (** Parse query request from JSON.
308308 Test files: test/data/mail/mailbox_query_request.json *)
309309 let request_of_json json =
310310- let open Jmap_core.Jmap_parser.Helpers in
310310+ let open Jmap_core.Parser.Helpers in
311311 let fields = expect_object json in
312312- let account_id = Jmap_core.Jmap_id.of_json (require_field "accountId" fields) in
312312+ let account_id = Jmap_core.Id.of_json (require_field "accountId" fields) in
313313 let filter = match find_field "filter" fields with
314314- | Some v -> Some (Jmap_core.Jmap_filter.of_json Filter.of_json v)
314314+ | Some v -> Some (Jmap_core.Filter.of_json Filter.of_json v)
315315 | None -> None
316316 in
317317 let sort = match find_field "sort" fields with
318318- | Some v -> Some (parse_array Jmap_core.Jmap_comparator.of_json v)
318318+ | Some v -> Some (parse_array Jmap_core.Comparator.of_json v)
319319 | None -> None
320320 in
321321 let position = match find_field "position" fields with
322322- | Some v -> Some (Jmap_core.Jmap_primitives.Int53.of_json v)
322322+ | Some v -> Some (Jmap_core.Primitives.Int53.of_json v)
323323 | None -> None
324324 in
325325 let anchor = match find_field "anchor" fields with
326326- | Some v -> Some (Jmap_core.Jmap_id.of_json v)
326326+ | Some v -> Some (Jmap_core.Id.of_json v)
327327 | None -> None
328328 in
329329 let anchor_offset = match find_field "anchorOffset" fields with
330330- | Some v -> Some (Jmap_core.Jmap_primitives.Int53.of_json v)
330330+ | Some v -> Some (Jmap_core.Primitives.Int53.of_json v)
331331 | None -> None
332332 in
333333 let limit = match find_field "limit" fields with
334334- | Some v -> Some (Jmap_core.Jmap_primitives.UnsignedInt.of_json v)
334334+ | Some v -> Some (Jmap_core.Primitives.UnsignedInt.of_json v)
335335 | None -> None
336336 in
337337 let calculate_total = match find_field "calculateTotal" fields with
338338 | Some (`Bool b) -> Some b
339339- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "calculateTotal must be a boolean")
339339+ | Some _ -> raise (Jmap_core.Error.Parse_error "calculateTotal must be a boolean")
340340 | None -> None
341341 in
342342 let sort_as_tree = match find_field "sortAsTree" fields with
343343 | Some (`Bool b) -> Some b
344344- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "sortAsTree must be a boolean")
344344+ | Some _ -> raise (Jmap_core.Error.Parse_error "sortAsTree must be a boolean")
345345 | None -> None
346346 in
347347 let filter_as_tree = match find_field "filterAsTree" fields with
348348 | Some (`Bool b) -> Some b
349349- | Some _ -> raise (Jmap_core.Jmap_error.Parse_error "filterAsTree must be a boolean")
349349+ | Some _ -> raise (Jmap_core.Error.Parse_error "filterAsTree must be a boolean")
350350 | None -> None
351351 in
352352 { account_id; filter; sort; position; anchor; anchor_offset; limit;
···355355 (** Parse query response from JSON.
356356 Test files: test/data/mail/mailbox_query_response.json *)
357357 let response_of_json json =
358358- Jmap_core.Jmap_standard_methods.Query.response_of_json json
358358+ Jmap_core.Standard_methods.Query.response_of_json json
359359end
360360361361(** Standard /queryChanges method (RFC 8621 Section 2.6) *)
362362module QueryChanges = struct
363363- type request = Filter.t Jmap_core.Jmap_standard_methods.QueryChanges.request
364364- type response = Jmap_core.Jmap_standard_methods.QueryChanges.response
363363+ type request = Filter.t Jmap_core.Standard_methods.QueryChanges.request
364364+ type response = Jmap_core.Standard_methods.QueryChanges.response
365365366366 let request_of_json json =
367367- Jmap_core.Jmap_standard_methods.QueryChanges.request_of_json Filter.of_json json
367367+ Jmap_core.Standard_methods.QueryChanges.request_of_json Filter.of_json json
368368369369 let response_of_json json =
370370- Jmap_core.Jmap_standard_methods.QueryChanges.response_of_json json
370370+ Jmap_core.Standard_methods.QueryChanges.response_of_json json
371371end
372372373373(** Standard /set method (RFC 8621 Section 2.4) *)
374374module Set = struct
375375- type request = t Jmap_core.Jmap_standard_methods.Set.request
376376- type response = t Jmap_core.Jmap_standard_methods.Set.response
375375+ type request = t Jmap_core.Standard_methods.Set.request
376376+ type response = t Jmap_core.Standard_methods.Set.response
377377378378 (** Parse set request from JSON.
379379 Test files: test/data/mail/mailbox_set_request.json *)
380380 let request_of_json json =
381381- Jmap_core.Jmap_standard_methods.Set.request_of_json Parser.of_json json
381381+ Jmap_core.Standard_methods.Set.request_of_json Parser.of_json json
382382383383 (** Parse set response from JSON.
384384 Test files: test/data/mail/mailbox_set_response.json *)
385385 let response_of_json json =
386386- Jmap_core.Jmap_standard_methods.Set.response_of_json Parser.of_json json
386386+ Jmap_core.Standard_methods.Set.response_of_json Parser.of_json json
387387end
388388389389(** Standard mailbox role values (RFC 8621 Section 2.1) *)
+54-54
stack/jmap/jmap-mail/jmap_mailbox.mli
···46464747(** Mailbox object type *)
4848type t = {
4949- id : Jmap_id.t;
4949+ id : Id.t;
5050 name : string;
5151- parent_id : Jmap_id.t option;
5151+ parent_id : Id.t option;
5252 role : string option;
5353- sort_order : Jmap_primitives.UnsignedInt.t;
5454- total_emails : Jmap_primitives.UnsignedInt.t;
5555- unread_emails : Jmap_primitives.UnsignedInt.t;
5656- total_threads : Jmap_primitives.UnsignedInt.t;
5757- unread_threads : Jmap_primitives.UnsignedInt.t;
5353+ sort_order : Primitives.UnsignedInt.t;
5454+ total_emails : Primitives.UnsignedInt.t;
5555+ unread_emails : Primitives.UnsignedInt.t;
5656+ total_threads : Primitives.UnsignedInt.t;
5757+ unread_threads : Primitives.UnsignedInt.t;
5858 my_rights : Rights.t;
5959 is_subscribed : bool;
6060}
61616262(** Accessors *)
6363-val id : t -> Jmap_id.t
6363+val id : t -> Id.t
6464val name : t -> string
6565-val parent_id : t -> Jmap_id.t option
6565+val parent_id : t -> Id.t option
6666val role : t -> string option
6767-val sort_order : t -> Jmap_primitives.UnsignedInt.t
6868-val total_emails : t -> Jmap_primitives.UnsignedInt.t
6969-val unread_emails : t -> Jmap_primitives.UnsignedInt.t
7070-val total_threads : t -> Jmap_primitives.UnsignedInt.t
7171-val unread_threads : t -> Jmap_primitives.UnsignedInt.t
6767+val sort_order : t -> Primitives.UnsignedInt.t
6868+val total_emails : t -> Primitives.UnsignedInt.t
6969+val unread_emails : t -> Primitives.UnsignedInt.t
7070+val total_threads : t -> Primitives.UnsignedInt.t
7171+val unread_threads : t -> Primitives.UnsignedInt.t
7272val my_rights : t -> Rights.t
7373val is_subscribed : t -> bool
74747575(** Constructor *)
7676val v :
7777- id:Jmap_id.t ->
7777+ id:Id.t ->
7878 name:string ->
7979- ?parent_id:Jmap_id.t ->
7979+ ?parent_id:Id.t ->
8080 ?role:string ->
8181- sort_order:Jmap_primitives.UnsignedInt.t ->
8282- total_emails:Jmap_primitives.UnsignedInt.t ->
8383- unread_emails:Jmap_primitives.UnsignedInt.t ->
8484- total_threads:Jmap_primitives.UnsignedInt.t ->
8585- unread_threads:Jmap_primitives.UnsignedInt.t ->
8181+ sort_order:Primitives.UnsignedInt.t ->
8282+ total_emails:Primitives.UnsignedInt.t ->
8383+ unread_emails:Primitives.UnsignedInt.t ->
8484+ total_threads:Primitives.UnsignedInt.t ->
8585+ unread_threads:Primitives.UnsignedInt.t ->
8686 my_rights:Rights.t ->
8787 is_subscribed:bool ->
8888 unit ->
···90909191(** Standard /get method *)
9292module Get : sig
9393- type request = t Jmap_standard_methods.Get.request
9494- type response = t Jmap_standard_methods.Get.response
9393+ type request = t Standard_methods.Get.request
9494+ type response = t Standard_methods.Get.response
95959696 val request_of_json : Ezjsonm.value -> request
9797 val response_of_json : Ezjsonm.value -> response
···9999100100(** Standard /changes method *)
101101module Changes : sig
102102- type request = Jmap_standard_methods.Changes.request
103103- type response = Jmap_standard_methods.Changes.response
102102+ type request = Standard_methods.Changes.request
103103+ type response = Standard_methods.Changes.response
104104105105 val request_of_json : Ezjsonm.value -> request
106106 val response_of_json : Ezjsonm.value -> response
···109109(** Mailbox-specific filter for /query *)
110110module Filter : sig
111111 type t = {
112112- parent_id : Jmap_id.t option;
112112+ parent_id : Id.t option;
113113 name : string option;
114114 role : string option;
115115 has_any_role : bool option;
···117117 }
118118119119 (** Accessors *)
120120- val parent_id : t -> Jmap_id.t option
120120+ val parent_id : t -> Id.t option
121121 val name : t -> string option
122122 val role : t -> string option
123123 val has_any_role : t -> bool option
···125125126126 (** Constructor *)
127127 val v :
128128- ?parent_id:Jmap_id.t ->
128128+ ?parent_id:Id.t ->
129129 ?name:string ->
130130 ?role:string ->
131131 ?has_any_role:bool ->
···139139(** Standard /query method with Mailbox-specific extensions *)
140140module Query : sig
141141 type request = {
142142- account_id : Jmap_id.t;
143143- filter : Filter.t Jmap_filter.t option;
144144- sort : Jmap_comparator.t list option;
145145- position : Jmap_primitives.Int53.t option;
146146- anchor : Jmap_id.t option;
147147- anchor_offset : Jmap_primitives.Int53.t option;
148148- limit : Jmap_primitives.UnsignedInt.t option;
142142+ account_id : Id.t;
143143+ filter : Filter.t Jmap_core.Filter.t option;
144144+ sort : Comparator.t list option;
145145+ position : Primitives.Int53.t option;
146146+ anchor : Id.t option;
147147+ anchor_offset : Primitives.Int53.t option;
148148+ limit : Primitives.UnsignedInt.t option;
149149 calculate_total : bool option;
150150 sort_as_tree : bool option;
151151 filter_as_tree : bool option;
152152 }
153153154154- type response = Jmap_standard_methods.Query.response
154154+ type response = Standard_methods.Query.response
155155156156 (** Accessors for request *)
157157- val account_id : request -> Jmap_id.t
158158- val filter : request -> Filter.t Jmap_filter.t option
159159- val sort : request -> Jmap_comparator.t list option
160160- val position : request -> Jmap_primitives.Int53.t option
161161- val anchor : request -> Jmap_id.t option
162162- val anchor_offset : request -> Jmap_primitives.Int53.t option
163163- val limit : request -> Jmap_primitives.UnsignedInt.t option
157157+ val account_id : request -> Id.t
158158+ val filter : request -> Filter.t Jmap_core.Filter.t option
159159+ val sort : request -> Comparator.t list option
160160+ val position : request -> Primitives.Int53.t option
161161+ val anchor : request -> Id.t option
162162+ val anchor_offset : request -> Primitives.Int53.t option
163163+ val limit : request -> Primitives.UnsignedInt.t option
164164 val calculate_total : request -> bool option
165165 val sort_as_tree : request -> bool option
166166 val filter_as_tree : request -> bool option
167167168168 (** Constructor for request *)
169169 val request_v :
170170- account_id:Jmap_id.t ->
171171- ?filter:Filter.t Jmap_filter.t ->
172172- ?sort:Jmap_comparator.t list ->
173173- ?position:Jmap_primitives.Int53.t ->
174174- ?anchor:Jmap_id.t ->
175175- ?anchor_offset:Jmap_primitives.Int53.t ->
176176- ?limit:Jmap_primitives.UnsignedInt.t ->
170170+ account_id:Id.t ->
171171+ ?filter:Filter.t Jmap_core.Filter.t ->
172172+ ?sort:Comparator.t list ->
173173+ ?position:Primitives.Int53.t ->
174174+ ?anchor:Id.t ->
175175+ ?anchor_offset:Primitives.Int53.t ->
176176+ ?limit:Primitives.UnsignedInt.t ->
177177 ?calculate_total:bool ->
178178 ?sort_as_tree:bool ->
179179 ?filter_as_tree:bool ->
···186186187187(** Standard /queryChanges method *)
188188module QueryChanges : sig
189189- type request = Filter.t Jmap_standard_methods.QueryChanges.request
190190- type response = Jmap_standard_methods.QueryChanges.response
189189+ type request = Filter.t Standard_methods.QueryChanges.request
190190+ type response = Standard_methods.QueryChanges.response
191191192192 val request_of_json : Ezjsonm.value -> request
193193 val response_of_json : Ezjsonm.value -> response
···195195196196(** Standard /set method *)
197197module Set : sig
198198- type request = t Jmap_standard_methods.Set.request
199199- type response = t Jmap_standard_methods.Set.response
198198+ type request = t Standard_methods.Set.request
199199+ type response = t Standard_methods.Set.response
200200201201 val request_of_json : Ezjsonm.value -> request
202202 val response_of_json : Ezjsonm.value -> response
+10-10
stack/jmap/jmap-mail/jmap_search_snippet.ml
···2121 The <mark> tags indicate where the search terms matched.
2222*)
2323type t = {
2424- email_id : Jmap_core.Jmap_id.t; (** Email ID this snippet is for *)
2424+ email_id : Jmap_core.Id.t; (** Email ID this snippet is for *)
2525 subject : string option; (** Subject with search terms highlighted using <mark> tags *)
2626 preview : string option; (** Preview text with search terms highlighted using <mark> tags *)
2727}
···4545*)
4646module Get = struct
4747 type request = {
4848- account_id : Jmap_core.Jmap_id.t;
4949- filter : Jmap_email.Filter.t Jmap_core.Jmap_filter.t; (** Filter to apply for highlighting *)
5050- email_ids : Jmap_core.Jmap_id.t list; (** Email IDs to get snippets for *)
4848+ account_id : Jmap_core.Id.t;
4949+ filter : Jmap_email.Filter.t Jmap_core.Filter.t; (** Filter to apply for highlighting *)
5050+ email_ids : Jmap_core.Id.t list; (** Email IDs to get snippets for *)
5151 }
52525353 type response = {
5454- account_id : Jmap_core.Jmap_id.t;
5454+ account_id : Jmap_core.Id.t;
5555 list : t list; (** SearchSnippets for requested emails *)
5656- not_found : Jmap_core.Jmap_id.t list; (** Email IDs that don't exist *)
5656+ not_found : Jmap_core.Id.t list; (** Email IDs that don't exist *)
5757 }
58585959 (** Accessors for request *)
···8787 }
8888 *)
8989 let request_of_json _json =
9090- raise (Jmap_core.Jmap_error.Parse_error "SearchSnippet.Get.request_of_json not yet implemented")
9090+ raise (Jmap_core.Error.Parse_error "SearchSnippet.Get.request_of_json not yet implemented")
91919292 (** Parse get response from JSON.
9393 Test files: test/data/mail/search_snippet_response.json
···106106 }
107107 *)
108108 let response_of_json _json =
109109- raise (Jmap_core.Jmap_error.Parse_error "SearchSnippet.Get.response_of_json not yet implemented")
109109+ raise (Jmap_core.Error.Parse_error "SearchSnippet.Get.response_of_json not yet implemented")
110110end
111111112112(** Parser submodule *)
···123123 *)
124124 let of_json _json =
125125 (* TODO: Implement JSON parsing *)
126126- raise (Jmap_core.Jmap_error.Parse_error "SearchSnippet.Parser.of_json not yet implemented")
126126+ raise (Jmap_core.Error.Parse_error "SearchSnippet.Parser.of_json not yet implemented")
127127128128 let to_json _t =
129129 (* TODO: Implement JSON serialization *)
130130- raise (Jmap_core.Jmap_error.Parse_error "SearchSnippet.Parser.to_json not yet implemented")
130130+ raise (Jmap_core.Error.Parse_error "SearchSnippet.Parser.to_json not yet implemented")
131131end
+18-18
stack/jmap/jmap-mail/jmap_search_snippet.mli
···4455(** SearchSnippet object type (RFC 8621 Section 5.1) *)
66type t = {
77- email_id : Jmap_id.t;
77+ email_id : Id.t;
88 subject : string option;
99 preview : string option;
1010}
11111212(** Accessors *)
1313-val email_id : t -> Jmap_id.t
1313+val email_id : t -> Id.t
1414val subject : t -> string option
1515val preview : t -> string option
16161717(** Constructor *)
1818-val v : email_id:Jmap_id.t -> ?subject:string -> ?preview:string -> unit -> t
1818+val v : email_id:Id.t -> ?subject:string -> ?preview:string -> unit -> t
19192020(** SearchSnippet/get method *)
2121module Get : sig
2222 type request = {
2323- account_id : Jmap_id.t;
2424- filter : Jmap_email.Filter.t Jmap_filter.t;
2525- email_ids : Jmap_id.t list;
2323+ account_id : Id.t;
2424+ filter : Jmap_email.Filter.t Filter.t;
2525+ email_ids : Id.t list;
2626 }
27272828 type response = {
2929- account_id : Jmap_id.t;
2929+ account_id : Id.t;
3030 list : t list;
3131- not_found : Jmap_id.t list;
3131+ not_found : Id.t list;
3232 }
33333434 (** Accessors for request *)
3535- val account_id : request -> Jmap_id.t
3636- val filter : request -> Jmap_email.Filter.t Jmap_filter.t
3737- val email_ids : request -> Jmap_id.t list
3535+ val account_id : request -> Id.t
3636+ val filter : request -> Jmap_email.Filter.t Filter.t
3737+ val email_ids : request -> Id.t list
38383939 (** Constructor for request *)
4040 val request_v :
4141- account_id:Jmap_id.t ->
4242- filter:Jmap_email.Filter.t Jmap_filter.t ->
4343- email_ids:Jmap_id.t list ->
4141+ account_id:Id.t ->
4242+ filter:Jmap_email.Filter.t Filter.t ->
4343+ email_ids:Id.t list ->
4444 request
45454646 (** Accessors for response *)
4747- val response_account_id : response -> Jmap_id.t
4747+ val response_account_id : response -> Id.t
4848 val list : response -> t list
4949- val not_found : response -> Jmap_id.t list
4949+ val not_found : response -> Id.t list
50505151 (** Constructor for response *)
5252 val response_v :
5353- account_id:Jmap_id.t ->
5353+ account_id:Id.t ->
5454 list:t list ->
5555- not_found:Jmap_id.t list ->
5555+ not_found:Id.t list ->
5656 response
57575858 val request_of_json : Ezjsonm.value -> request
+8-8
stack/jmap/jmap-mail/jmap_thread.ml
···17171818(** Thread object type *)
1919type t = {
2020- id : Jmap_core.Jmap_id.t; (** Immutable server-assigned thread id *)
2121- email_ids : Jmap_core.Jmap_id.t list; (** List of email ids in this thread, sorted by date (oldest first) *)
2020+ id : Jmap_core.Id.t; (** Immutable server-assigned thread id *)
2121+ email_ids : Jmap_core.Id.t list; (** List of email ids in this thread, sorted by date (oldest first) *)
2222}
23232424(** Accessors *)
···3737 - /queryChanges
3838*)
3939module Get = struct
4040- type request = t Jmap_core.Jmap_standard_methods.Get.request
4141- type response = t Jmap_core.Jmap_standard_methods.Get.response
4040+ type request = t Jmap_core.Standard_methods.Get.request
4141+ type response = t Jmap_core.Standard_methods.Get.response
42424343 (** Parse get request from JSON.
4444 Test files: test/data/mail/thread_get_request.json
···5050 }
5151 *)
5252 let request_of_json _json =
5353- raise (Jmap_core.Jmap_error.Parse_error "Thread.Get.request_of_json not yet implemented")
5353+ raise (Jmap_core.Error.Parse_error "Thread.Get.request_of_json not yet implemented")
54545555 (** Parse get response from JSON.
5656 Test files: test/data/mail/thread_get_response.json
···6969 }
7070 *)
7171 let response_of_json _json =
7272- raise (Jmap_core.Jmap_error.Parse_error "Thread.Get.response_of_json not yet implemented")
7272+ raise (Jmap_core.Error.Parse_error "Thread.Get.response_of_json not yet implemented")
7373end
74747575(** Parser submodule *)
···8585 *)
8686 let of_json _json =
8787 (* TODO: Implement JSON parsing *)
8888- raise (Jmap_core.Jmap_error.Parse_error "Thread.Parser.of_json not yet implemented")
8888+ raise (Jmap_core.Error.Parse_error "Thread.Parser.of_json not yet implemented")
89899090 let to_json _t =
9191 (* TODO: Implement JSON serialization *)
9292- raise (Jmap_core.Jmap_error.Parse_error "Thread.Parser.to_json not yet implemented")
9292+ raise (Jmap_core.Error.Parse_error "Thread.Parser.to_json not yet implemented")
9393end
+7-7
stack/jmap/jmap-mail/jmap_thread.mli
···4455(** Thread object type *)
66type t = {
77- id : Jmap_id.t;
88- email_ids : Jmap_id.t list;
77+ id : Id.t;
88+ email_ids : Id.t list;
99}
10101111(** Accessors *)
1212-val id : t -> Jmap_id.t
1313-val email_ids : t -> Jmap_id.t list
1212+val id : t -> Id.t
1313+val email_ids : t -> Id.t list
14141515(** Constructor *)
1616-val v : id:Jmap_id.t -> email_ids:Jmap_id.t list -> t
1616+val v : id:Id.t -> email_ids:Id.t list -> t
17171818(** Standard /get method *)
1919module Get : sig
2020- type request = t Jmap_standard_methods.Get.request
2121- type response = t Jmap_standard_methods.Get.response
2020+ type request = t Standard_methods.Get.request
2121+ type response = t Standard_methods.Get.response
22222323 val request_of_json : Ezjsonm.value -> request
2424 val response_of_json : Ezjsonm.value -> response
+13-13
stack/jmap/jmap-mail/jmap_vacation_response.ml
···1717 with id "singleton". It cannot be created or destroyed, only updated.
1818*)
1919type t = {
2020- id : Jmap_core.Jmap_id.t; (** Always "singleton" *)
2020+ id : Jmap_core.Id.t; (** Always "singleton" *)
2121 is_enabled : bool; (** Is vacation response currently active? *)
2222- from_date : Jmap_core.Jmap_primitives.UTCDate.t option; (** Start date (null = active now) *)
2323- to_date : Jmap_core.Jmap_primitives.UTCDate.t option; (** End date (null = no end) *)
2222+ from_date : Jmap_core.Primitives.UTCDate.t option; (** Start date (null = active now) *)
2323+ to_date : Jmap_core.Primitives.UTCDate.t option; (** End date (null = no end) *)
2424 subject : string option; (** Subject for auto-reply message *)
2525 text_body : string option; (** Plain text auto-reply body *)
2626 html_body : string option; (** HTML auto-reply body *)
···4848 }
4949*)
5050module Get = struct
5151- type request = t Jmap_core.Jmap_standard_methods.Get.request
5252- type response = t Jmap_core.Jmap_standard_methods.Get.response
5151+ type request = t Jmap_core.Standard_methods.Get.request
5252+ type response = t Jmap_core.Standard_methods.Get.response
53535454 (** Parse get request from JSON.
5555 Test files: test/data/mail/vacation_response_get_request.json
···6161 }
6262 *)
6363 let request_of_json _json =
6464- raise (Jmap_core.Jmap_error.Parse_error "VacationResponse.Get.request_of_json not yet implemented")
6464+ raise (Jmap_core.Error.Parse_error "VacationResponse.Get.request_of_json not yet implemented")
65656666 (** Parse get response from JSON.
6767 Test files: test/data/mail/vacation_response_get_response.json
···8484 }
8585 *)
8686 let response_of_json _json =
8787- raise (Jmap_core.Jmap_error.Parse_error "VacationResponse.Get.response_of_json not yet implemented")
8787+ raise (Jmap_core.Error.Parse_error "VacationResponse.Get.response_of_json not yet implemented")
8888end
89899090(** Standard /set method (RFC 8621 Section 8.3)
···109109 }
110110*)
111111module Set = struct
112112- type request = t Jmap_core.Jmap_standard_methods.Set.request
113113- type response = t Jmap_core.Jmap_standard_methods.Set.response
112112+ type request = t Jmap_core.Standard_methods.Set.request
113113+ type response = t Jmap_core.Standard_methods.Set.response
114114115115 let request_of_json _json =
116116- raise (Jmap_core.Jmap_error.Parse_error "VacationResponse.Set.request_of_json not yet implemented")
116116+ raise (Jmap_core.Error.Parse_error "VacationResponse.Set.request_of_json not yet implemented")
117117118118 let response_of_json _json =
119119- raise (Jmap_core.Jmap_error.Parse_error "VacationResponse.Set.response_of_json not yet implemented")
119119+ raise (Jmap_core.Error.Parse_error "VacationResponse.Set.response_of_json not yet implemented")
120120end
121121122122(** Parser submodule *)
···137137 *)
138138 let of_json _json =
139139 (* TODO: Implement JSON parsing *)
140140- raise (Jmap_core.Jmap_error.Parse_error "VacationResponse.Parser.of_json not yet implemented")
140140+ raise (Jmap_core.Error.Parse_error "VacationResponse.Parser.of_json not yet implemented")
141141142142 let to_json _t =
143143 (* TODO: Implement JSON serialization *)
144144- raise (Jmap_core.Jmap_error.Parse_error "VacationResponse.Parser.to_json not yet implemented")
144144+ raise (Jmap_core.Error.Parse_error "VacationResponse.Parser.to_json not yet implemented")
145145end
146146147147(** Singleton ID constant *)
+13-13
stack/jmap/jmap-mail/jmap_vacation_response.mli
···4455(** VacationResponse object type (RFC 8621 Section 8.1) *)
66type t = {
77- id : Jmap_id.t;
77+ id : Id.t;
88 is_enabled : bool;
99- from_date : Jmap_primitives.UTCDate.t option;
1010- to_date : Jmap_primitives.UTCDate.t option;
99+ from_date : Primitives.UTCDate.t option;
1010+ to_date : Primitives.UTCDate.t option;
1111 subject : string option;
1212 text_body : string option;
1313 html_body : string option;
1414}
15151616(** Accessors *)
1717-val id : t -> Jmap_id.t
1717+val id : t -> Id.t
1818val is_enabled : t -> bool
1919-val from_date : t -> Jmap_primitives.UTCDate.t option
2020-val to_date : t -> Jmap_primitives.UTCDate.t option
1919+val from_date : t -> Primitives.UTCDate.t option
2020+val to_date : t -> Primitives.UTCDate.t option
2121val subject : t -> string option
2222val text_body : t -> string option
2323val html_body : t -> string option
24242525(** Constructor *)
2626val v :
2727- id:Jmap_id.t ->
2727+ id:Id.t ->
2828 is_enabled:bool ->
2929- ?from_date:Jmap_primitives.UTCDate.t ->
3030- ?to_date:Jmap_primitives.UTCDate.t ->
2929+ ?from_date:Primitives.UTCDate.t ->
3030+ ?to_date:Primitives.UTCDate.t ->
3131 ?subject:string ->
3232 ?text_body:string ->
3333 ?html_body:string ->
···36363737(** Standard /get method *)
3838module Get : sig
3939- type request = t Jmap_standard_methods.Get.request
4040- type response = t Jmap_standard_methods.Get.response
3939+ type request = t Standard_methods.Get.request
4040+ type response = t Standard_methods.Get.response
41414242 val request_of_json : Ezjsonm.value -> request
4343 val response_of_json : Ezjsonm.value -> response
···45454646(** Standard /set method *)
4747module Set : sig
4848- type request = t Jmap_standard_methods.Set.request
4949- type response = t Jmap_standard_methods.Set.response
4848+ type request = t Standard_methods.Set.request
4949+ type response = t Standard_methods.Set.response
50505151 val request_of_json : Ezjsonm.value -> request
5252 val response_of_json : Ezjsonm.value -> response
+34
stack/jmap/jmap.opam
···11+# This file is generated by dune, edit dune-project instead
22+opam-version: "2.0"
33+version: "0.1.0"
44+synopsis: "Unified JMAP library combining core, mail, and client"
55+description:
66+ "Ergonomic, unified interface to the complete JMAP library (RFC 8620, RFC 8621). This is the recommended entry point for most users."
77+maintainer: ["your.email@example.com"]
88+authors: ["Your Name"]
99+license: "MIT"
1010+homepage: "https://github.com/yourusername/jmap"
1111+bug-reports: "https://github.com/yourusername/jmap/issues"
1212+depends: [
1313+ "ocaml" {>= "4.14"}
1414+ "dune" {>= "3.0" & >= "3.0"}
1515+ "jmap-core" {= version}
1616+ "jmap-mail" {= version}
1717+ "jmap-client" {= version}
1818+ "odoc" {with-doc}
1919+]
2020+build: [
2121+ ["dune" "subst"] {dev}
2222+ [
2323+ "dune"
2424+ "build"
2525+ "-p"
2626+ name
2727+ "-j"
2828+ jobs
2929+ "@install"
3030+ "@runtest" {with-test}
3131+ "@doc" {with-doc}
3232+ ]
3333+]
3434+dev-repo: "git+https://github.com/yourusername/jmap.git"