Skip to content

Commit

Permalink
Add the DELETE endpoint for dehydrated devices
Browse files Browse the repository at this point in the history
  • Loading branch information
poljar committed Jul 28, 2023
1 parent 5edf705 commit a1f36c3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/ruma-client-api/src/dehydrated_device.rs
Expand Up @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};

use crate::PrivOwnedStr;

pub mod delete_dehydrated_device;
pub mod get_dehydrated_device;
pub mod get_events;
pub mod put_dehydrated_device;
Expand Down
@@ -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 }
}
}
}

0 comments on commit a1f36c3

Please sign in to comment.