this repo has no description

hand edits

+6 -84
+3 -1
AGENT.md
··· 55 55 a cross reference URL where relevant by linking to a URL of the form 56 56 "https://datatracker.ietf.org/doc/html/rfc8620#section-1.1" for the online 57 57 version of the RFCs stored in specs/ 58 - 14. Add an ocamldoc-format tutorial on how to use the library to index.mld along with cross references 58 + 14. DONE. Add an ocamldoc-format tutorial on how to use the library to index.mld along with cross references 59 59 into the various libraries. Put corresponding executable files into bin/ so that they can be 60 60 build tested and run as well. Assume the pattern of the JMAP_API_TOKEN environment variable being 61 61 set can be counted on to be present when they are run. 62 + 15. Add a README.md to this repository that describes what this is. Note explicitly in the 63 + README that this is largely an AI-generated interface and has not been audited carefully.
+3 -83
README.md
··· 1 1 # JMAP OCaml Client 2 2 3 - A type-safe OCaml interface to the JMAP protocol ([RFC8620](https://datatracker.ietf.org/doc/html/rfc8620)) and JMAP Mail extension ([RFC8621](https://datatracker.ietf.org/doc/html/rfc8621)). 3 + An OCaml interface to the JMAP protocol ([RFC8620](https://datatracker.ietf.org/doc/html/rfc8620)) and JMAP Mail extension ([RFC8621](https://datatracker.ietf.org/doc/html/rfc8621)). 4 4 5 5 **Note:** This library is largely AI-generated and has not been audited carefully. It's a proof-of-concept implementation of the JMAP specification. 6 6 ··· 19 19 Add to your project with opam: 20 20 21 21 ``` 22 - opam install jmap 23 - ``` 24 - 25 - Or pin the development version: 26 - 27 - ``` 28 - opam pin add jmap.dev git+https://github.com/example/jmap-ocaml.git 29 - ``` 30 - 31 - ## Quick Start 32 - 33 - ```ocaml 34 - open Lwt.Syntax 35 - open Jmap 36 - open Jmap_mail 37 - 38 - (* Authentication *) 39 - let token = Sys.getenv "JMAP_API_TOKEN" in 40 - let* result = Jmap_mail.login_with_token 41 - ~uri:"https://api.fastmail.com/jmap/session" 42 - ~api_token:token 43 - in 44 - 45 - match result with 46 - | Error err -> 47 - Printf.eprintf "Authentication failed\n"; 48 - exit 1 49 - 50 - | Ok conn -> 51 - (* Get primary account ID *) 52 - let mail_capability = Jmap_mail.Capability.to_string Jmap_mail.Capability.Mail in 53 - let account_id = List.assoc mail_capability conn.session.primary_accounts in 54 - 55 - (* Get mailboxes *) 56 - let* mailboxes_result = Jmap_mail.get_mailboxes conn ~account_id in 57 - 58 - match mailboxes_result with 59 - | Error err -> 60 - Printf.eprintf "Failed to get mailboxes\n"; 61 - exit 1 62 - 63 - | Ok mailboxes -> 64 - (* Find the inbox *) 65 - let inbox = List.find_opt (fun m -> 66 - m.Types.role = Some Types.Inbox 67 - ) mailboxes in 68 - 69 - match inbox with 70 - | None -> 71 - Printf.eprintf "No inbox found\n"; 72 - exit 1 73 - 74 - | Some inbox -> 75 - (* Get recent emails *) 76 - let* emails_result = Jmap_mail.get_messages_in_mailbox 77 - conn 78 - ~account_id 79 - ~mailbox_id:inbox.Types.id 80 - ~limit:10 81 - () 82 - in 83 - 84 - match emails_result with 85 - | Error err -> 86 - Printf.eprintf "Failed to get emails\n"; 87 - exit 1 88 - 89 - | Ok emails -> 90 - (* Display emails *) 91 - List.iter (fun email -> 92 - Printf.printf "%s - %s\n" 93 - (Option.value ~default:"<unknown>" 94 - (Option.map (fun addrs -> 95 - match addrs with 96 - | [] -> "<unknown>" 97 - | addr::_ -> addr.Types.email 98 - ) email.Types.from)) 99 - (Option.value ~default:"<no subject>" email.Types.subject) 100 - ) emails; 101 - 102 - Lwt.return_unit 22 + opam install . 103 23 ``` 104 24 105 25 ## Features ··· 148 68 - [RFC8620: The JSON Meta Application Protocol (JMAP)](https://datatracker.ietf.org/doc/html/rfc8620) 149 69 - [RFC8621: The JSON Meta Application Protocol (JMAP) for Mail](https://datatracker.ietf.org/doc/html/rfc8621) 150 70 - [Message Flag and Mailbox Attribute Extension](https://datatracker.ietf.org/doc/html/draft-ietf-mailmaint-messageflag-mailboxattribute-02) 151 - - [Fastmail Developer Documentation](https://www.fastmail.com/dev/) 71 + - [Fastmail Developer Documentation](https://www.fastmail.com/dev/)