Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the DELETE endpoint for dehydrated devices
- Loading branch information
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
crates/ruma-client-api/src/dehydrated_device/delete_dehydrated_device.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//! `DELETE /_matrix/client/*/dehydrated_device/` | ||
//! | ||
//! Delete a dehydrated device. | ||
|
||
pub mod unstable { | ||
//! `msc3814` ([MSC]) | ||
//! | ||
//! [MSC]: https://github.com/uhoreg/matrix-doc/blob/shrivelled_sessions/proposals/3814-dehydrated-devices-with-ssss.md | ||
|
||
use ruma_common::{ | ||
api::{request, response, Metadata}, | ||
metadata, OwnedDeviceId, | ||
}; | ||
|
||
const METADATA: Metadata = metadata! { | ||
method: DELETE, | ||
rate_limited: false, | ||
authentication: AccessToken, | ||
history: { | ||
unstable => "/_matrix/client/unstable/org.matrix.msc3814.v1/dehydrated_device", | ||
} | ||
}; | ||
|
||
/// Request type for the `DELETE` `dehydrated_device` endpoint. | ||
#[request(error = crate::Error)] | ||
pub struct Request {} | ||
|
||
/// Request type for the `DELETE` `dehydrated_device` endpoint. | ||
#[response(error = crate::Error)] | ||
pub struct Response { | ||
/// The unique ID of the device that was deleted. | ||
pub device_id: OwnedDeviceId, | ||
} | ||
|
||
impl Request { | ||
/// Creates a new empty `Request`. | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
impl Response { | ||
/// Creates a new `Response` with the given device ID. | ||
pub fn new(device_id: OwnedDeviceId) -> Self { | ||
Self { device_id } | ||
} | ||
} | ||
} |