Add first endpoints

This commit is contained in:
Jonas Platte 2020-04-15 22:37:42 +02:00
parent 4845474294
commit 1d6bf1979b
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
6 changed files with 54 additions and 0 deletions

View File

@ -14,6 +14,7 @@ version = "0.0.1"
[dependencies]
js_int = "0.1.4"
ruma-api = "0.15.0"
ruma-events = "0.18.0"
ruma-identifiers = "0.14.1"
serde = { version = "1.0.106", features = ["derive"] }

View File

@ -10,6 +10,9 @@ use ruma_identifiers::{EventId, RoomId, UserId};
use serde::{Deserialize, Serialize};
use serde_json::Value as JsonValue;
mod unversioned;
mod v1;
/// A 'persistent data unit' (event) for room versions 3 and beyond.
#[derive(Deserialize, Serialize)]
pub struct RoomV3Pdu {

1
src/unversioned.rs Normal file
View File

@ -0,0 +1 @@
mod discover_homeserver;

View 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,
}
}

1
src/v1.rs Normal file
View File

@ -0,0 +1 @@
mod get_server_version;

View 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>,
}