ruma_client_api/backup/delete_backup_keys.rs
1//! `DELETE /_matrix/client/*/room_keys/keys`
2//!
3//! Delete all keys from a backup.
4
5pub mod v3 {
6 //! `/v3/` ([spec])
7 //!
8 //! [spec]: https://spec.matrix.org/latest/client-server-api/#delete_matrixclientv3room_keyskeys
9 //!
10 //! This deletes keys from a backup version, but not the version itself.
11
12 use js_int::UInt;
13 use ruma_common::{
14 api::{request, response, Metadata},
15 metadata,
16 };
17
18 const METADATA: Metadata = metadata! {
19 method: DELETE,
20 rate_limited: true,
21 authentication: AccessToken,
22 history: {
23 unstable => "/_matrix/client/unstable/room_keys/keys",
24 1.0 => "/_matrix/client/r0/room_keys/keys",
25 1.1 => "/_matrix/client/v3/room_keys/keys",
26 }
27 };
28
29 /// Request type for the `delete_backup_keys` endpoint.
30 #[request(error = crate::Error)]
31 pub struct Request {
32 /// The backup version from which to delete keys.
33 #[ruma_api(query)]
34 pub version: String,
35 }
36
37 /// Response type for the `delete_backup_keys` endpoint.
38 #[response(error = crate::Error)]
39 pub struct Response {
40 /// An opaque string representing stored keys in the backup.
41 ///
42 /// Clients can compare it with the etag value they received in the request of their last
43 /// key storage request.
44 pub etag: String,
45
46 /// The number of keys stored in the backup.
47 pub count: UInt,
48 }
49
50 impl Request {
51 /// Creates a new `Request` with the given version.
52 pub fn new(version: String) -> Self {
53 Self { version }
54 }
55 }
56
57 impl Response {
58 /// Creates an new `Response` with the given etag and count.
59 pub fn new(etag: String, count: UInt) -> Self {
60 Self { etag, count }
61 }
62 }
63}