client-api: Update device endpoints to the new API standards
This commit is contained in:
parent
d1f409bcb6
commit
961d45a581
@ -15,6 +15,7 @@ ruma_api! {
|
|||||||
requires_authentication: true,
|
requires_authentication: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
request: {
|
request: {
|
||||||
/// The device to delete.
|
/// The device to delete.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
@ -25,7 +26,23 @@ ruma_api! {
|
|||||||
pub auth: Option<AuthData<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
response: {}
|
response: {}
|
||||||
|
|
||||||
error: UiaaResponse
|
error: UiaaResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Request<'a> {
|
||||||
|
/// Creates a new `Request` with the given device ID.
|
||||||
|
pub fn new(device_id: &'a DeviceId) -> Self {
|
||||||
|
Self { device_id, auth: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Response {
|
||||||
|
/// Creates an empty `Response`.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -15,6 +15,7 @@ ruma_api! {
|
|||||||
requires_authentication: true,
|
requires_authentication: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
request: {
|
request: {
|
||||||
/// List of devices to delete.
|
/// List of devices to delete.
|
||||||
pub devices: &'a [DeviceIdBox],
|
pub devices: &'a [DeviceIdBox],
|
||||||
@ -24,7 +25,23 @@ ruma_api! {
|
|||||||
pub auth: Option<AuthData<'a>>,
|
pub auth: Option<AuthData<'a>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
response: {}
|
response: {}
|
||||||
|
|
||||||
error: UiaaResponse
|
error: UiaaResponse
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Request<'a> {
|
||||||
|
/// Creates a new `Request` with the given device list.
|
||||||
|
pub fn new(devices: &'a [DeviceIdBox]) -> Self {
|
||||||
|
Self { devices, auth: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Response {
|
||||||
|
/// Creates an empty `Response`.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -14,12 +14,14 @@ ruma_api! {
|
|||||||
requires_authentication: true,
|
requires_authentication: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
request: {
|
request: {
|
||||||
/// The device to retrieve.
|
/// The device to retrieve.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
pub device_id: &'a DeviceId,
|
pub device_id: &'a DeviceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
response: {
|
response: {
|
||||||
/// Information about the device.
|
/// Information about the device.
|
||||||
#[ruma_api(body)]
|
#[ruma_api(body)]
|
||||||
@ -28,3 +30,17 @@ ruma_api! {
|
|||||||
|
|
||||||
error: crate::Error
|
error: crate::Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Request<'a> {
|
||||||
|
/// Creates a new `Request` with the given device ID.
|
||||||
|
pub fn new(device_id: &'a DeviceId) -> Self {
|
||||||
|
Self { device_id }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Response {
|
||||||
|
/// Creates a new `Response` with the given device.
|
||||||
|
pub fn new(device: Device) -> Self {
|
||||||
|
Self { device }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -13,8 +13,11 @@ ruma_api! {
|
|||||||
requires_authentication: true,
|
requires_authentication: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
request: {}
|
request: {}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
response: {
|
response: {
|
||||||
/// A list of all registered devices for this user
|
/// A list of all registered devices for this user
|
||||||
pub devices: Vec<Device>,
|
pub devices: Vec<Device>,
|
||||||
@ -22,3 +25,17 @@ ruma_api! {
|
|||||||
|
|
||||||
error: crate::Error
|
error: crate::Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl Request {
|
||||||
|
/// Creates an empty `Request`.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Response {
|
||||||
|
/// Creates a new `Response` with the given devices.
|
||||||
|
pub fn new(devices: Vec<Device>) -> Self {
|
||||||
|
Self { devices }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -13,6 +13,7 @@ ruma_api! {
|
|||||||
requires_authentication: true,
|
requires_authentication: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[non_exhaustive]
|
||||||
request: {
|
request: {
|
||||||
/// The device to update.
|
/// The device to update.
|
||||||
#[ruma_api(path)]
|
#[ruma_api(path)]
|
||||||
@ -24,7 +25,23 @@ ruma_api! {
|
|||||||
pub display_name: Option<String>,
|
pub display_name: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
#[non_exhaustive]
|
||||||
response: {}
|
response: {}
|
||||||
|
|
||||||
error: crate::Error
|
error: crate::Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<'a> Request<'a> {
|
||||||
|
/// Creates a new `Request` with the given device ID.
|
||||||
|
pub fn new(device_id: &'a DeviceId) -> Self {
|
||||||
|
Self { device_id, display_name: None }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Response {
|
||||||
|
/// Creates an empty `Response`.
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user