ruma_client_api/keys/
get_keys.rs1pub mod v3 {
6 use std::{collections::BTreeMap, time::Duration};
11
12 use ruma_common::{
13 api::{request, response, Metadata},
14 encryption::{CrossSigningKey, DeviceKeys},
15 metadata,
16 serde::Raw,
17 OwnedDeviceId, OwnedUserId,
18 };
19 use serde_json::Value as JsonValue;
20
21 const METADATA: Metadata = metadata! {
22 method: POST,
23 rate_limited: false,
24 authentication: AccessToken,
25 history: {
26 1.0 => "/_matrix/client/r0/keys/query",
27 1.1 => "/_matrix/client/v3/keys/query",
28 }
29 };
30
31 #[request(error = crate::Error)]
33 #[derive(Default)]
34 pub struct Request {
35 #[serde(
39 with = "ruma_common::serde::duration::opt_ms",
40 default,
41 skip_serializing_if = "Option::is_none"
42 )]
43 pub timeout: Option<Duration>,
44
45 pub device_keys: BTreeMap<OwnedUserId, Vec<OwnedDeviceId>>,
49 }
50
51 #[response(error = crate::Error)]
53 #[derive(Default)]
54 pub struct Response {
55 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
59 pub failures: BTreeMap<String, JsonValue>,
60
61 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
63 pub device_keys: BTreeMap<OwnedUserId, BTreeMap<OwnedDeviceId, Raw<DeviceKeys>>>,
64
65 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
67 pub master_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
68
69 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
71 pub self_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
72
73 #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
75 pub user_signing_keys: BTreeMap<OwnedUserId, Raw<CrossSigningKey>>,
76 }
77
78 impl Request {
79 pub fn new() -> Self {
81 Default::default()
82 }
83 }
84
85 impl Response {
86 pub fn new() -> Self {
88 Default::default()
89 }
90 }
91}