this repo has no description
at if-only 3.0 kB view raw
1(** JMAP Session Resource. 2 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *) 3 4open Jmap_types 5 6(** Account capability information. 7 The value is capability-specific. 8 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *) 9type account_capability_value = Yojson.Safe.t 10 11(** Server capability information. 12 The value is capability-specific. 13 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *) 14type server_capability_value = Yojson.Safe.t 15 16(** Core capability information. 17 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *) 18module Core_capability : sig 19 type t 20 21 val max_size_upload : t -> uint 22 val max_concurrent_upload : t -> uint 23 val max_size_request : t -> uint 24 val max_concurrent_requests : t -> uint 25 val max_calls_in_request : t -> uint 26 val max_objects_in_get : t -> uint 27 val max_objects_in_set : t -> uint 28 val collation_algorithms : t -> string list 29 30 val v : 31 max_size_upload:uint -> 32 max_concurrent_upload:uint -> 33 max_size_request:uint -> 34 max_concurrent_requests:uint -> 35 max_calls_in_request:uint -> 36 max_objects_in_get:uint -> 37 max_objects_in_set:uint -> 38 collation_algorithms:string list -> 39 unit -> 40 t 41end 42 43(** An Account object. 44 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *) 45module Account : sig 46 type t 47 48 val name : t -> string 49 val is_personal : t -> bool 50 val is_read_only : t -> bool 51 val account_capabilities : t -> account_capability_value string_map 52 53 val v : 54 name:string -> 55 ?is_personal:bool -> 56 ?is_read_only:bool -> 57 ?account_capabilities:account_capability_value string_map -> 58 unit -> 59 t 60end 61 62(** The Session object. 63 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2> RFC 8620, Section 2 *) 64module Session : sig 65 type t 66 67 val capabilities : t -> server_capability_value string_map 68 val accounts : t -> Account.t id_map 69 val primary_accounts : t -> id string_map 70 val username : t -> string 71 val api_url : t -> Uri.t 72 val download_url : t -> Uri.t 73 val upload_url : t -> Uri.t 74 val event_source_url : t -> Uri.t 75 val state : t -> string 76 77 val v : 78 capabilities:server_capability_value string_map -> 79 accounts:Account.t id_map -> 80 primary_accounts:id string_map -> 81 username:string -> 82 api_url:Uri.t -> 83 download_url:Uri.t -> 84 upload_url:Uri.t -> 85 event_source_url:Uri.t -> 86 state:string -> 87 unit -> 88 t 89end 90 91(** Function to perform service autodiscovery. 92 Returns the session URL if found. 93 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-2.2> RFC 8620, Section 2.2 *) 94val discover : domain:string -> Uri.t option 95 96(** Function to fetch the session object from a given URL. 97 Requires authentication handling (details TBD/outside this signature). *) 98val get_session : url:Uri.t -> Session.t