···38387. DONE Examine the implementation of fastmail-list as well as the JMAP specs,
3939 and add better typed handling of string responses such as "urn:ietf:params:jmap:mail".
4040 Add these to either `Jmap_mail` or Jmap modules as appropriate.
4141-8. Move some of the debug print messages into a debug logging mode, and ensure
4141+8. DONE Move some of the debug print messages into a debug logging mode, and ensure
4242 that sensitive API tokens are never printed but redacted instead.
4343 Modify the fastmail-list binary to optionally list only unread messages, and
4444 also list the JMAP labels associated with each message.
4545-9. Read the JMAP crash course at https://jmap.io/crash-course.html and especially
4646- the bit about result references. Modify the OCaml interfaces appropriately from
4747- what you learn here.
4545+9. Read the mailbox attribute spec in specs/ and add a typed interface to the
4646+ JMAP labels defined in there.
4747+10. Add an OCaml interface to compose result references together explicitly into a
4848+ single request, from reading the specs.
···47474848(** Module for managing JMAP capability URIs and other constants *)
4949module Capability = struct
5050- (** Core JMAP capability URI *)
5151- type core = Core
5252-5350 (** JMAP capability URI as specified in RFC8620 *)
5451 let core_uri = "urn:ietf:params:jmap:core"
55525656- (** Convert core capability to URI string *)
5757- let string_of_core = function
5858- | Core -> core_uri
5959-6060- (** Parse a string to a core capability, returns None if not a valid capability URI *)
6161- let core_of_string = function
6262- | s when s = core_uri -> Some Core
6363- | _ -> None
6464-6553 (** All JMAP capability types *)
6654 type t =
6767- | Core of core
6868- | Extension of string
5555+ | Core (** Core JMAP capability *)
5656+ | Extension of string (** Extension capabilities *)
69577058 (** Convert capability to URI string *)
7159 let to_string = function
7272- | Core c -> string_of_core c
6060+ | Core -> core_uri
7361 | Extension s -> s
74627563 (** Parse a string to a capability, returns Extension for non-core capabilities *)
7664 let of_string s =
7777- match core_of_string s with
7878- | Some c -> Core c
7979- | None -> Extension s
6565+ if s = core_uri then Core
6666+ else Extension s
80678168 (** Check if a capability matches a core capability *)
8269 let is_core = function
8383- | Core _ -> true
7070+ | Core -> true
8471 | Extension _ -> false
85728673 (** Check if a capability string is a core capability *)
8787- let is_core_string s =
8888- match of_string s with
8989- | Core _ -> true
9090- | Extension _ -> false
7474+ let is_core_string s = s = core_uri
91759276 (** Create a list of capability strings *)
9377 let strings_of_capabilities capabilities =
+2-11
lib/jmap.mli
···11111212(** Module for managing JMAP capability URIs and other constants *)
1313module Capability : sig
1414- (** Core JMAP capability URI *)
1515- type core = Core
1616-1714 (** JMAP capability URI as specified in RFC8620 *)
1815 val core_uri : string
19162020- (** Convert core capability to URI string *)
2121- val string_of_core : core -> string
2222-2323- (** Parse a string to a core capability, returns None if not a valid capability URI *)
2424- val core_of_string : string -> core option
2525-2617 (** All JMAP capability types *)
2718 type t =
2828- | Core of core
2929- | Extension of string
1919+ | Core (** Core JMAP capability *)
2020+ | Extension of string (** Extension capabilities *)
30213122 (** Convert capability to URI string *)
3223 val to_string : t -> string