Add first endpoints
This commit is contained in:
parent
4845474294
commit
1d6bf1979b
@ -14,6 +14,7 @@ version = "0.0.1"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
js_int = "0.1.4"
|
js_int = "0.1.4"
|
||||||
|
ruma-api = "0.15.0"
|
||||||
ruma-events = "0.18.0"
|
ruma-events = "0.18.0"
|
||||||
ruma-identifiers = "0.14.1"
|
ruma-identifiers = "0.14.1"
|
||||||
serde = { version = "1.0.106", features = ["derive"] }
|
serde = { version = "1.0.106", features = ["derive"] }
|
||||||
|
@ -10,6 +10,9 @@ use ruma_identifiers::{EventId, RoomId, UserId};
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use serde_json::Value as JsonValue;
|
use serde_json::Value as JsonValue;
|
||||||
|
|
||||||
|
mod unversioned;
|
||||||
|
mod v1;
|
||||||
|
|
||||||
/// A 'persistent data unit' (event) for room versions 3 and beyond.
|
/// A 'persistent data unit' (event) for room versions 3 and beyond.
|
||||||
#[derive(Deserialize, Serialize)]
|
#[derive(Deserialize, Serialize)]
|
||||||
pub struct RoomV3Pdu {
|
pub struct RoomV3Pdu {
|
||||||
|
1
src/unversioned.rs
Normal file
1
src/unversioned.rs
Normal file
@ -0,0 +1 @@
|
|||||||
|
mod discover_homeserver;
|
20
src/unversioned/discover_homeserver.rs
Normal file
20
src/unversioned/discover_homeserver.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
use ruma_api::ruma_api;
|
||||||
|
|
||||||
|
ruma_api! {
|
||||||
|
metadata {
|
||||||
|
description: "Get discovery information about the domain.",
|
||||||
|
method: GET,
|
||||||
|
name: "discover_homeserver",
|
||||||
|
path: "/.well-known/matrix/server",
|
||||||
|
rate_limited: false,
|
||||||
|
requires_authentication: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
request {}
|
||||||
|
|
||||||
|
response {
|
||||||
|
/// The server name to delegate server-server communciations to, with optional port.
|
||||||
|
#[serde(rename = "m.homeserver")]
|
||||||
|
pub homeserver: String,
|
||||||
|
}
|
||||||
|
}
|
28
src/v1/get_server_version.rs
Normal file
28
src/v1/get_server_version.rs
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
use ruma_api::ruma_api;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
ruma_api! {
|
||||||
|
metadata {
|
||||||
|
description: "Get the implementation name and version of this homeserver.",
|
||||||
|
method: GET,
|
||||||
|
name: "discover_homeserver",
|
||||||
|
path: "/.well-known/matrix/server",
|
||||||
|
rate_limited: false,
|
||||||
|
requires_authentication: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
request {}
|
||||||
|
|
||||||
|
response {
|
||||||
|
/// Information about the homeserver implementation
|
||||||
|
server: Server,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
pub struct Server {
|
||||||
|
/// Arbitrary name that identify this implementation.
|
||||||
|
name: Option<String>,
|
||||||
|
/// Version of this implementation. The version format depends on the implementation.
|
||||||
|
version: Option<String>,
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user