commit
4f6deebb0f
@ -1 +1,179 @@
|
||||
//! Endpoints for user presence.
|
||||
|
||||
/// PUT /_matrix/client/r0/presence/{userId}/status
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-presence-userid-status)
|
||||
pub mod set_presence {
|
||||
use ruma_identifiers::UserId;
|
||||
use ruma_events::presence::PresenceState;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId
|
||||
}
|
||||
|
||||
/// This API endpoint's body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
status_msg: Option<String>,
|
||||
presence: PresenceState
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = BodyParams;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = ();
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/presence/{}/status",
|
||||
params.user_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/:user_id/status".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// GET /_matrix/client/r0/presence/{userId}/status
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-presence-userid-status)
|
||||
pub mod get_presence {
|
||||
use ruma_identifiers::UserId;
|
||||
use ruma_events::presence::PresenceState;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId
|
||||
}
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub status_msg: Option<String>,
|
||||
pub currently_active: Option<bool>,
|
||||
pub last_active_ago: Option<u64>,
|
||||
pub presence: PresenceState
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ();
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Get
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/presence/{}/status",
|
||||
params.user_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/:user_id/status".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// POST /_matrix/client/r0/presence/list/{userId}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-presence-list-userid)
|
||||
pub mod update_presence_list {
|
||||
use ruma_identifiers::UserId;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId
|
||||
}
|
||||
|
||||
/// This API endpoint's body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
drop: Option<Vec<UserId>>,
|
||||
invite: Option<Vec<UserId>>
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = BodyParams;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = ();
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Post
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/presence/list/{}",
|
||||
params.user_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/list/:user_id".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// GET /_matrix/client/r0/presence/list/{userId}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-presence-list-userid)
|
||||
pub mod get_presence_list_status {
|
||||
use ruma_identifiers::UserId;
|
||||
use ruma_events::presence::PresenceEvent;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ();
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Vec<PresenceEvent>;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Get
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/presence/list/{}",
|
||||
params.user_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/presence/list/:user_id".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,56 @@
|
||||
//! Endpoints for event redaction.
|
||||
|
||||
/// PUT /_matrix/client/r0/rooms/{roomId}/redact/{eventId}/{txnId}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid)
|
||||
pub mod send_event {
|
||||
use ruma_identifiers::{RoomId, EventId};
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub room_id: RoomId,
|
||||
pub event_id: EventId,
|
||||
pub txn_id: String
|
||||
}
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
pub reason: Option<String>
|
||||
}
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub event_id: EventId,
|
||||
}
|
||||
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = BodyParams;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/rooms/{}/redact/{}/{}",
|
||||
params.room_id,
|
||||
params.event_id,
|
||||
params.txn_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/redact/:event_id/:txn_id".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
148
src/r0/send.rs
148
src/r0/send.rs
@ -1 +1,149 @@
|
||||
//! Endpoints for sending events.
|
||||
|
||||
/// PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype)
|
||||
pub mod send_state {
|
||||
use ruma_identifiers::{RoomId, EventId};
|
||||
use ruma_events::EventType;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub room_id: RoomId,
|
||||
pub event_type: EventType
|
||||
}
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub event_id: EventId,
|
||||
}
|
||||
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ::serde_json::Value;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/rooms/{}/state/{}",
|
||||
params.room_id,
|
||||
params.event_type
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// PUT /_matrix/client/r0/rooms/{roomId}/state/{eventType}/{stateKey}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-state-eventtype-statekey)
|
||||
pub mod send_state_key {
|
||||
use ruma_identifiers::{RoomId, EventId};
|
||||
use ruma_events::EventType;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub room_id: RoomId,
|
||||
pub event_type: EventType,
|
||||
pub state_key: String
|
||||
}
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub event_id: EventId,
|
||||
}
|
||||
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ::serde_json::Value;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/rooms/{}/state/{}/{}",
|
||||
params.room_id,
|
||||
params.event_type,
|
||||
params.state_key
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// PUT /_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid)
|
||||
pub mod send_event {
|
||||
use ruma_identifiers::{RoomId, EventId};
|
||||
use ruma_events::EventType;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub room_id: RoomId,
|
||||
pub event_type: EventType,
|
||||
pub txn_id: String
|
||||
}
|
||||
|
||||
/// This API endpoint's response.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub event_id: EventId,
|
||||
}
|
||||
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ::serde_json::Value;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/rooms/{}/send/{}/{}",
|
||||
params.room_id,
|
||||
params.event_type,
|
||||
params.txn_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
132
src/r0/sync.rs
132
src/r0/sync.rs
@ -1 +1,133 @@
|
||||
//! Endpoints for getting and synchronizing events.
|
||||
|
||||
/// GET /_matrix/client/r0/sync
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync)
|
||||
pub mod sync {
|
||||
use ruma_identifiers::RoomId;
|
||||
use ruma_events::collections::only;
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// Wether to set presence or not during sync
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub enum SetPresence {
|
||||
#[serde(rename="offline")]
|
||||
Offline
|
||||
}
|
||||
|
||||
/// This API endpoint's query parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct QueryParams {
|
||||
pub filter: Option<String>,
|
||||
pub since: Option<String>,
|
||||
pub full_state: Option<bool>,
|
||||
pub set_presence: Option<SetPresence>,
|
||||
pub timeout: Option<u64>
|
||||
}
|
||||
|
||||
/// Updates to rooms
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Rooms {
|
||||
pub leave: HashMap<RoomId, LeftRoom>,
|
||||
pub join: HashMap<RoomId, JoinedRoom>,
|
||||
pub invite: HashMap<RoomId, InvitedRoom>
|
||||
}
|
||||
|
||||
/// Historical updates to left rooms
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct LeftRoom {
|
||||
pub timeline: Timeline,
|
||||
pub state: State
|
||||
}
|
||||
|
||||
/// Updates to joined rooms
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct JoinedRoom {
|
||||
pub unread_notifications: UnreadNotificationsCount,
|
||||
pub timeline: Timeline,
|
||||
pub state: State,
|
||||
pub account_data: AccountData,
|
||||
pub ephemeral: Ephemeral
|
||||
}
|
||||
|
||||
/// unread notifications count
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct UnreadNotificationsCount {
|
||||
pub highlight_count: u64,
|
||||
pub notification_count: u64
|
||||
}
|
||||
|
||||
/// timeline
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Timeline {
|
||||
pub limited: bool,
|
||||
pub prev_batch: String,
|
||||
pub events: only::RoomEvent
|
||||
}
|
||||
|
||||
/// state
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct State {
|
||||
pub events: only::StateEvent
|
||||
}
|
||||
|
||||
/// account data
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct AccountData {
|
||||
pub events: only::Event
|
||||
}
|
||||
|
||||
/// ephemeral
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Ephemeral {
|
||||
pub events: only::Event
|
||||
}
|
||||
|
||||
/// invited room updates
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct InvitedRoom {
|
||||
pub invite_state: InviteState
|
||||
}
|
||||
|
||||
/// invite state
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct InviteState {
|
||||
pub events: only::StateEvent
|
||||
}
|
||||
|
||||
/// presence
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Presence {
|
||||
pub events: only::Event
|
||||
}
|
||||
|
||||
/// This API endpoint's reponse.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub next_batch: String,
|
||||
pub rooms: Rooms,
|
||||
pub presence: Presence
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ();
|
||||
type PathParams = ();
|
||||
type QueryParams = QueryParams;
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Get
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
"/_matrix/client/r0/sync".to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/sync".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
132
src/r0/tag.rs
132
src/r0/tag.rs
@ -1 +1,133 @@
|
||||
//! Endpoints for tagging rooms.
|
||||
|
||||
/// PUT /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-user-userid-rooms-roomid-tags-tag)
|
||||
pub mod add_tag {
|
||||
use ruma_identifiers::{UserId, RoomId};
|
||||
use ruma_events::tag::TagInfo;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId,
|
||||
pub room_id: RoomId,
|
||||
pub tag: String
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = TagInfo;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = ();
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/user/{}/rooms/{}/tags/{}",
|
||||
params.user_id,
|
||||
params.room_id,
|
||||
params.tag
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// GET /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-user-userid-rooms-roomid-tags)
|
||||
pub mod get_tags {
|
||||
use ruma_identifiers::{UserId, RoomId};
|
||||
use ruma_events::tag::TagEventContent;
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId,
|
||||
pub room_id: RoomId
|
||||
}
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub tags: TagEventContent,
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ();
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Get
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/user/{}/rooms/{}/tags",
|
||||
params.user_id,
|
||||
params.room_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// DELETE /_matrix/client/r0/user/{userId}/rooms/{roomId}/tags/{tag}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#delete-matrix-client-r0-user-userid-rooms-roomid-tags-tag)
|
||||
pub mod del_tag {
|
||||
use ruma_identifiers::{UserId, RoomId};
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub user_id: UserId,
|
||||
pub room_id: RoomId,
|
||||
pub tag: String
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ();
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = ();
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Delete
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/user/{}/rooms/{}/tags/{}",
|
||||
params.user_id,
|
||||
params.room_id,
|
||||
params.tag
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,48 @@
|
||||
//! Endpoints for typing notifications.
|
||||
|
||||
/// PUT /_matrix/client/r0/rooms/{roomId}/typing/{userId}
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid)
|
||||
pub mod set_typing {
|
||||
use ruma_identifiers::{UserId, RoomId};
|
||||
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct PathParams {
|
||||
pub room_id: RoomId,
|
||||
pub user_id: UserId
|
||||
}
|
||||
|
||||
/// This API endpoint's body parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct BodyParams {
|
||||
pub typing: bool,
|
||||
pub timeout: Option<u64>
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = BodyParams;
|
||||
type PathParams = PathParams;
|
||||
type QueryParams = ();
|
||||
type Response = ();
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Put
|
||||
}
|
||||
|
||||
fn request_path(params: Self::PathParams) -> String {
|
||||
format!(
|
||||
"/_matrix/client/r0/rooms/{}/typing/{}",
|
||||
params.room_id,
|
||||
params.user_id
|
||||
)
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"/_matrix/client/r0/rooms/:room_id/invite/:user_id".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1 +1,37 @@
|
||||
//! Endpoints for Voice over IP.
|
||||
|
||||
/// GET /_matrix/client/r0/voip/turnServer
|
||||
///
|
||||
/// [Matrix spec link](http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-voip-turnserver)
|
||||
pub mod turnserver {
|
||||
/// Details about this API endpoint.
|
||||
pub struct Endpoint;
|
||||
|
||||
/// This API endpoint's path parameters.
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Response {
|
||||
pub username: String,
|
||||
pub password: String,
|
||||
pub uris: Vec<String>,
|
||||
pub ttl: u64
|
||||
}
|
||||
|
||||
impl ::Endpoint for Endpoint {
|
||||
type BodyParams = ();
|
||||
type PathParams = ();
|
||||
type QueryParams = ();
|
||||
type Response = Response;
|
||||
|
||||
fn method() -> ::Method {
|
||||
::Method::Get
|
||||
}
|
||||
|
||||
fn request_path(_params: Self::PathParams) -> String {
|
||||
"/_matrix/client/r0/voip/turnServer".to_string()
|
||||
}
|
||||
|
||||
fn router_path() -> String {
|
||||
"_matrix/client/r0/voip/turnServer".to_string()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user