Matrix protocol in OCaml, Eio specialised
1(** Eio-idiomatic device management operations. *)
2
3(** Device information *)
4type device = Matrix_client.Devices.device = {
5 device_id : string;
6 display_name : string option;
7 last_seen_ip : string option;
8 last_seen_ts : int64 option;
9}
10
11(** Get all devices for the current user.
12 @raise Eio.Io on failure *)
13let get_devices client =
14 Error.unwrap (Matrix_client.Devices.get_devices (Client.base client))
15
16(** Get information about a specific device.
17 @raise Eio.Io on failure *)
18let get_device client ~device_id =
19 Error.unwrap (Matrix_client.Devices.get_device (Client.base client) ~device_id)
20
21(** Update a device's display name.
22 @raise Eio.Io on failure *)
23let update_device client ~device_id ~display_name =
24 Error.unwrap (Matrix_client.Devices.update_device (Client.base client)
25 ~device_id ~display_name)
26
27(** Delete a device.
28 Note: This may require UIAA (User-Interactive Authentication).
29 @raise Eio.Io on failure or if UIAA is required *)
30let delete_device client ~device_id =
31 Error.unwrap (Matrix_client.Devices.delete_device (Client.base client) ~device_id)
32
33(** Delete multiple devices.
34 Note: This may require UIAA (User-Interactive Authentication).
35 @raise Eio.Io on failure or if UIAA is required *)
36let delete_devices client ~device_ids =
37 Error.unwrap (Matrix_client.Devices.delete_devices (Client.base client) ~device_ids)