Matrix protocol in OCaml, Eio specialised
at main 120 lines 2.9 kB view raw
1(** Account management operations. *) 2 3(** {1 Account Data} *) 4 5(** Get global account data of a specific type. *) 6val get_account_data : 7 Client.t -> 8 event_type:string -> 9 (Jsont.json, Error.t) result 10 11(** Set global account data. *) 12val set_account_data : 13 Client.t -> 14 event_type:string -> 15 content:Jsont.json -> 16 (unit, Error.t) result 17 18(** Get room-specific account data. *) 19val get_room_account_data : 20 Client.t -> 21 room_id:Matrix_proto.Id.Room_id.t -> 22 event_type:string -> 23 (Jsont.json, Error.t) result 24 25(** Set room-specific account data. *) 26val set_room_account_data : 27 Client.t -> 28 room_id:Matrix_proto.Id.Room_id.t -> 29 event_type:string -> 30 content:Jsont.json -> 31 (unit, Error.t) result 32 33(** {1 Third-Party Identifiers} *) 34 35(** Third-party identifier info. *) 36type threepid = { 37 medium : string; (** "email" or "msisdn" *) 38 address : string; (** The identifier (email or phone) *) 39 validated_at : int64; (** Timestamp when validated *) 40 added_at : int64; (** Timestamp when added *) 41} 42 43(** Get all third-party identifiers for the account. *) 44val get_3pids : Client.t -> (threepid list, Error.t) result 45 46(** Request a token for adding an email address. 47 Returns the session ID for the verification flow. *) 48val request_email_token : 49 Client.t -> 50 email:string -> 51 client_secret:string -> 52 send_attempt:int -> 53 (string, Error.t) result 54 55(** Request a token for adding a phone number. 56 Returns the session ID for the verification flow. *) 57val request_msisdn_token : 58 Client.t -> 59 country:string -> 60 phone_number:string -> 61 client_secret:string -> 62 send_attempt:int -> 63 (string, Error.t) result 64 65(** Add a third-party identifier after validation. 66 Requires the session_id and client_secret from the token request. *) 67val add_3pid : 68 Client.t -> 69 client_secret:string -> 70 sid:string -> 71 (unit, Error.t) result 72 73(** Delete a third-party identifier. *) 74val delete_3pid : 75 Client.t -> 76 medium:string -> 77 address:string -> 78 (unit, Error.t) result 79 80(** {1 Password Management} *) 81 82(** Change the account password. 83 84 @param logout_devices If true, invalidate all other sessions. *) 85val change_password : 86 Client.t -> 87 new_password:string -> 88 ?logout_devices:bool -> 89 unit -> 90 (unit, Error.t) result 91 92(** {1 Account Deactivation} *) 93 94(** Deactivate the account. 95 96 WARNING: This is irreversible! 97 98 @param erase If true, request erasure of personal data. *) 99val deactivate : 100 Client.t -> 101 ?erase:bool -> 102 unit -> 103 (unit, Error.t) result 104 105(** {1 Ignored Users} *) 106 107(** Get the list of ignored user IDs. *) 108val get_ignored_users : Client.t -> (Matrix_proto.Id.User_id.t list, Error.t) result 109 110(** Ignore a user. *) 111val ignore_user : 112 Client.t -> 113 user_id:Matrix_proto.Id.User_id.t -> 114 (unit, Error.t) result 115 116(** Unignore a user. *) 117val unignore_user : 118 Client.t -> 119 user_id:Matrix_proto.Id.User_id.t -> 120 (unit, Error.t) result