client-api: Update more endpoints to new API conventions

This commit is contained in:
Jonas Platte 2020-08-14 00:23:27 +02:00
parent a674afe512
commit 157957ced6
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
7 changed files with 89 additions and 0 deletions

View File

@ -13,6 +13,7 @@ ruma_api! {
requires_authentication: true,
}
#[non_exhaustive]
request: {
/// The room alias to set.
#[ruma_api(path)]
@ -22,7 +23,22 @@ ruma_api! {
pub room_id: &'a RoomId,
}
#[non_exhaustive]
response: {}
error: crate::Error
}
impl<'a> Request<'a> {
/// Creates a new `Request` with the given room alias and room id.
pub fn new(room_alias: &'a RoomAliasId, room_id: &'a RoomId) -> Self {
Self { room_alias, room_id }
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Self
}
}

View File

@ -13,13 +13,29 @@ ruma_api! {
requires_authentication: true,
}
#[non_exhaustive]
request: {
/// The room alias to remove.
#[ruma_api(path)]
pub room_alias: &'a RoomAliasId,
}
#[non_exhaustive]
response: {}
error: crate::Error
}
impl<'a> Request<'a> {
/// Creates a new `Request` with the given room alias.
pub fn new(room_alias: &'a RoomAliasId) -> Self {
Self { room_alias }
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Self
}
}

View File

@ -13,12 +13,14 @@ ruma_api! {
requires_authentication: true,
}
#[non_exhaustive]
request: {
/// The room alias.
#[ruma_api(path)]
pub room_alias: &'a RoomAliasId,
}
#[non_exhaustive]
response: {
/// The room ID for this room alias.
pub room_id: RoomId,

View File

@ -114,6 +114,13 @@ impl Request {
}
}
impl Response {
/// Creates a `Response` with the given room id.
pub fn new(room_id: RoomId) -> Self {
Self { room_id }
}
}
/// Extra options to be added to the `m.room.create` event.
///
/// This is the same as the event content struct for `m.room.create`, but without some fields that

View File

@ -13,8 +13,10 @@ ruma_api! {
requires_authentication: false,
}
#[non_exhaustive]
request: {}
#[non_exhaustive]
response: {
/// The homeserver's supported login types.
pub flows: Vec<LoginType>
@ -23,6 +25,20 @@ ruma_api! {
error: crate::Error
}
impl Request {
/// Creates an empty `Request`.
pub fn new() -> Self {
Self
}
}
impl Response {
/// Creates a new `Response` with the given login types.
pub fn new(flows: Vec<LoginType>) -> Self {
Self { flows }
}
}
/// An authentication mechanism.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
#[serde(tag = "type")]

View File

@ -12,9 +12,25 @@ ruma_api! {
requires_authentication: true,
}
#[non_exhaustive]
request: {}
#[non_exhaustive]
response: {}
error: crate::Error
}
impl Request {
/// Creates an empty `Request`.
pub fn new() -> Self {
Self
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Self
}
}

View File

@ -12,9 +12,25 @@ ruma_api! {
requires_authentication: true,
}
#[non_exhaustive]
request: {}
#[non_exhaustive]
response: {}
error: crate::Error
}
impl Request {
/// Creates an empty `Request`.
pub fn new() -> Self {
Self
}
}
impl Response {
/// Creates an empty `Response`.
pub fn new() -> Self {
Self
}
}