My agentic slop goes here. Not intended for anyone else!
1(** JMAP Push Notification Types 2 3 Push notifications allow servers to notify clients of state changes. 4 5 Reference: RFC 8620 Section 7.1-7.2 6 Test files: 7 - test/data/core/push_state_change.json 8 - test/data/core/push_subscription.json 9*) 10 11(** StateChange notification object *) 12module StateChange = struct 13 (** Map of type name to state string *) 14 type type_state = (string * string) list 15 16 type t = { 17 at_type : string; (** Always "StateChange" *) 18 changed : (Jmap_id.t * type_state) list; (** accountId -> type -> state *) 19 } 20 21 (** Accessors *) 22 let at_type t = t.at_type 23 let changed t = t.changed 24 25 (** Constructor *) 26 let v ~at_type ~changed = { at_type; changed } 27 28 (** Parse from JSON. 29 Test files: test/data/core/push_state_change.json 30 31 Expected structure: 32 { 33 "@type": "StateChange", 34 "changed": { 35 "account-id-1": { 36 "Email": "d35ecb040aab", 37 "Mailbox": "0af7a512ce70" 38 }, 39 "account-id-2": { 40 "CalendarEvent": "7a4297cecd76" 41 } 42 } 43 } 44 *) 45 let of_json _json = 46 (* TODO: Implement JSON parsing *) 47 raise (Jmap_error.Parse_error "StateChange.of_json not yet implemented") 48end 49 50(** PushSubscription object *) 51module PushSubscription = struct 52 type t = { 53 id : Jmap_id.t; 54 device_client_id : string; 55 url : string; 56 keys : Ezjsonm.value option; 57 verification_code : string option; 58 expires : Jmap_primitives.UTCDate.t option; 59 types : string list option; 60 } 61 62 (** Accessors *) 63 let id t = t.id 64 let device_client_id t = t.device_client_id 65 let url t = t.url 66 let keys t = t.keys 67 let verification_code t = t.verification_code 68 let expires t = t.expires 69 let types t = t.types 70 71 (** Constructor *) 72 let v ~id ~device_client_id ~url ?keys ?verification_code ?expires ?types () = 73 { id; device_client_id; url; keys; verification_code; expires; types } 74 75 (** Parse from JSON. 76 Test files: test/data/core/push_subscription.json 77 78 Expected structure: 79 { 80 "id": "push-sub-id", 81 "deviceClientId": "device-hash", 82 "url": "https://push.example.com/push", 83 "keys": { 84 "p256dh": "base64-encoded-key", 85 "auth": "base64-encoded-secret" 86 }, 87 "verificationCode": "verification-code", 88 "expires": "2024-12-31T23:59:59Z", 89 "types": ["Email", "Mailbox"] 90 } 91 *) 92 let of_json _json = 93 (* TODO: Implement JSON parsing *) 94 raise (Jmap_error.Parse_error "PushSubscription.of_json not yet implemented") 95end 96 97(** PushVerification object (sent to push endpoint) *) 98module PushVerification = struct 99 type t = { 100 at_type : string; (** Always "PushVerification" *) 101 push_subscription_id : string; 102 verification_code : string; 103 } 104 105 (** Accessors *) 106 let at_type t = t.at_type 107 let push_subscription_id t = t.push_subscription_id 108 let verification_code t = t.verification_code 109 110 (** Constructor *) 111 let v ~at_type ~push_subscription_id ~verification_code = 112 { at_type; push_subscription_id; verification_code } 113 114 let of_json _json = 115 (* TODO: Implement JSON parsing *) 116 raise (Jmap_error.Parse_error "PushVerification.of_json not yet implemented") 117end