client-api: Move get_capabilities into discovery
This commit is contained in:
parent
fbe07e8636
commit
a0e05c0a31
@ -1,54 +0,0 @@
|
||||
//! `GET /_matrix/client/*/capabilities`
|
||||
|
||||
pub mod v3 {
|
||||
//! `/v3/` ([spec])
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3capabilities
|
||||
|
||||
use ruma_common::api::ruma_api;
|
||||
|
||||
use crate::capabilities::Capabilities;
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
description: "Gets information about the server's supported feature set and other relevant capabilities.",
|
||||
method: GET,
|
||||
name: "get_capabilities",
|
||||
r0_path: "/_matrix/client/r0/capabilities",
|
||||
stable_path: "/_matrix/client/v3/capabilities",
|
||||
rate_limited: true,
|
||||
authentication: AccessToken,
|
||||
added: 1.0,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
request: {}
|
||||
|
||||
response: {
|
||||
/// The capabilities the server supports
|
||||
pub capabilities: Capabilities,
|
||||
}
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl Request {
|
||||
/// Creates an empty `Request`.
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given capabilities.
|
||||
pub fn new(capabilities: Capabilities) -> Self {
|
||||
Self { capabilities }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Capabilities> for Response {
|
||||
fn from(capabilities: Capabilities) -> Self {
|
||||
Self::new(capabilities)
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
//! Endpoints that cannot change with new versions of the Matrix specification.
|
||||
//! Server discovery endpoints.
|
||||
|
||||
pub mod discover_homeserver;
|
||||
pub mod get_capabilities;
|
||||
pub mod get_supported_versions;
|
||||
|
@ -1,4 +1,8 @@
|
||||
//! Endpoints for querying the server's supported feature set
|
||||
//! `GET /_matrix/client/*/capabilities`
|
||||
//!
|
||||
//! Query the capabilities of a server ([spec])
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/unstable/client-server-api/#capabilities-negotiation
|
||||
|
||||
use std::{borrow::Cow, collections::BTreeMap};
|
||||
|
||||
@ -10,8 +14,8 @@ use serde_json::{from_value as from_json_value, to_value as to_json_value, Value
|
||||
use self::iter::{CapabilitiesIter, CapabilityRef};
|
||||
use crate::PrivOwnedStr;
|
||||
|
||||
pub mod get_capabilities;
|
||||
pub mod iter;
|
||||
pub mod v3;
|
||||
|
||||
/// Contains information about all the capabilities that the server supports.
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
50
crates/ruma-client-api/src/discovery/get_capabilities/v3.rs
Normal file
50
crates/ruma-client-api/src/discovery/get_capabilities/v3.rs
Normal file
@ -0,0 +1,50 @@
|
||||
//! `/v3/` ([spec])
|
||||
//!
|
||||
//! [spec]: https://spec.matrix.org/v1.2/client-server-api/#get_matrixclientv3capabilities
|
||||
|
||||
use ruma_common::api::ruma_api;
|
||||
|
||||
use super::Capabilities;
|
||||
|
||||
ruma_api! {
|
||||
metadata: {
|
||||
description: "Gets information about the server's supported feature set and other relevant capabilities.",
|
||||
method: GET,
|
||||
name: "get_capabilities",
|
||||
r0_path: "/_matrix/client/r0/capabilities",
|
||||
stable_path: "/_matrix/client/v3/capabilities",
|
||||
rate_limited: true,
|
||||
authentication: AccessToken,
|
||||
added: 1.0,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
request: {}
|
||||
|
||||
response: {
|
||||
/// The capabilities the server supports
|
||||
pub capabilities: Capabilities,
|
||||
}
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl Request {
|
||||
/// Creates an empty `Request`.
|
||||
pub fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given capabilities.
|
||||
pub fn new(capabilities: Capabilities) -> Self {
|
||||
Self { capabilities }
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Capabilities> for Response {
|
||||
fn from(capabilities: Capabilities) -> Self {
|
||||
Self::new(capabilities)
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@ pub mod account;
|
||||
pub mod alias;
|
||||
pub mod appservice;
|
||||
pub mod backup;
|
||||
pub mod capabilities;
|
||||
pub mod config;
|
||||
pub mod context;
|
||||
pub mod device;
|
||||
|
Loading…
x
Reference in New Issue
Block a user