this repo has no description
at if-only 6.1 kB view raw
1(** JMAP Push Notifications. 2 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7> RFC 8620, Section 7 *) 3 4open Jmap_types 5open Jmap_methods 6open Jmap_error 7 8(** TypeState object map (TypeName -> StateString). 9 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.1> RFC 8620, Section 7.1 *) 10type type_state = string string_map 11 12(** StateChange object. 13 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.1> RFC 8620, Section 7.1 *) 14module State_change : sig 15 type t 16 17 val changed : t -> type_state id_map 18 19 val v : 20 changed:type_state id_map -> 21 unit -> 22 t 23end 24 25(** PushSubscription encryption keys. 26 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 *) 27module Push_encryption_keys : sig 28 type t 29 30 (** P-256 ECDH public key (URL-safe base64) *) 31 val p256dh : t -> string 32 33 (** Authentication secret (URL-safe base64) *) 34 val auth : t -> string 35 36 val v : 37 p256dh:string -> 38 auth:string -> 39 unit -> 40 t 41end 42 43(** PushSubscription object. 44 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 *) 45module Push_subscription : sig 46 type t 47 48 (** Id of the subscription (server-set, immutable) *) 49 val id : t -> id 50 51 (** Device client id (immutable) *) 52 val device_client_id : t -> string 53 54 (** Notification URL (immutable) *) 55 val url : t -> Uri.t 56 57 (** Encryption keys (immutable) *) 58 val keys : t -> Push_encryption_keys.t option 59 val verification_code : t -> string option 60 val expires : t -> utc_date option 61 val types : t -> string list option 62 63 val v : 64 id:id -> 65 device_client_id:string -> 66 url:Uri.t -> 67 ?keys:Push_encryption_keys.t -> 68 ?verification_code:string -> 69 ?expires:utc_date -> 70 ?types:string list -> 71 unit -> 72 t 73end 74 75(** PushSubscription object for creation (omits server-set fields). 76 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 *) 77module Push_subscription_create : sig 78 type t 79 80 val device_client_id : t -> string 81 val url : t -> Uri.t 82 val keys : t -> Push_encryption_keys.t option 83 val expires : t -> utc_date option 84 val types : t -> string list option 85 86 val v : 87 device_client_id:string -> 88 url:Uri.t -> 89 ?keys:Push_encryption_keys.t -> 90 ?expires:utc_date -> 91 ?types:string list -> 92 unit -> 93 t 94end 95 96(** PushSubscription object for update patch. 97 Only verification_code and expires can be updated. 98 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2> RFC 8620, Section 7.2 99 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *) 100type push_subscription_update = patch_object 101 102(** Arguments for PushSubscription/get. 103 Extends standard /get args. 104 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.1> RFC 8620, Section 7.2.1 *) 105module Push_subscription_get_args : sig 106 type t 107 108 val ids : t -> id list option 109 val properties : t -> string list option 110 111 val v : 112 ?ids:id list -> 113 ?properties:string list -> 114 unit -> 115 t 116end 117 118(** Response for PushSubscription/get. 119 Extends standard /get response. 120 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.1> RFC 8620, Section 7.2.1 *) 121module Push_subscription_get_response : sig 122 type t 123 124 val list : t -> Push_subscription.t list 125 val not_found : t -> id list 126 127 val v : 128 list:Push_subscription.t list -> 129 not_found:id list -> 130 unit -> 131 t 132end 133 134(** Arguments for PushSubscription/set. 135 Extends standard /set args. 136 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *) 137module Push_subscription_set_args : sig 138 type t 139 140 val create : t -> Push_subscription_create.t id_map option 141 val update : t -> push_subscription_update id_map option 142 val destroy : t -> id list option 143 144 val v : 145 ?create:Push_subscription_create.t id_map -> 146 ?update:push_subscription_update id_map -> 147 ?destroy:id list -> 148 unit -> 149 t 150end 151 152(** Server-set information for created PushSubscription. 153 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *) 154module Push_subscription_created_info : sig 155 type t 156 157 val id : t -> id 158 val expires : t -> utc_date option 159 160 val v : 161 id:id -> 162 ?expires:utc_date -> 163 unit -> 164 t 165end 166 167(** Server-set information for updated PushSubscription. 168 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *) 169module Push_subscription_updated_info : sig 170 type t 171 172 val expires : t -> utc_date option 173 174 val v : 175 ?expires:utc_date -> 176 unit -> 177 t 178end 179 180(** Response for PushSubscription/set. 181 Extends standard /set response. 182 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *) 183module Push_subscription_set_response : sig 184 type t 185 186 val created : t -> Push_subscription_created_info.t id_map option 187 val updated : t -> Push_subscription_updated_info.t option id_map option 188 val destroyed : t -> id list option 189 val not_created : t -> Set_error.t id_map option 190 val not_updated : t -> Set_error.t id_map option 191 val not_destroyed : t -> Set_error.t id_map option 192 193 val v : 194 ?created:Push_subscription_created_info.t id_map -> 195 ?updated:Push_subscription_updated_info.t option id_map -> 196 ?destroyed:id list -> 197 ?not_created:Set_error.t id_map -> 198 ?not_updated:Set_error.t id_map -> 199 ?not_destroyed:Set_error.t id_map -> 200 unit -> 201 t 202end 203 204(** PushVerification object. 205 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.2.2> RFC 8620, Section 7.2.2 *) 206module Push_verification : sig 207 type t 208 209 val push_subscription_id : t -> id 210 val verification_code : t -> string 211 212 val v : 213 push_subscription_id:id -> 214 verification_code:string -> 215 unit -> 216 t 217end 218 219(** Data for EventSource ping event. 220 @see <https://www.rfc-editor.org/rfc/rfc8620.html#section-7.3> RFC 8620, Section 7.3 *) 221module Event_source_ping_data : sig 222 type t 223 224 val interval : t -> uint 225 226 val v : 227 interval:uint -> 228 unit -> 229 t 230end