client-api: Update thirdparty endpoints to the new API standards
This commit is contained in:
parent
5407a95a99
commit
76058b8170
@ -15,10 +15,11 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The protocol used to communicate to the third party network.
|
||||
#[ruma_api(path)]
|
||||
pub protocol: String,
|
||||
pub protocol: &'a str,
|
||||
|
||||
/// One or more custom fields to help identify the third party location.
|
||||
// The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352.
|
||||
@ -26,6 +27,7 @@ ruma_api! {
|
||||
pub fields: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// List of matched third party locations.
|
||||
#[ruma_api(body)]
|
||||
@ -34,3 +36,17 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given protocol.
|
||||
pub fn new(protocol: &'a str) -> Self {
|
||||
Self { protocol, fields: BTreeMap::new() }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given locations.
|
||||
pub fn new(locations: Vec<Location>) -> Self {
|
||||
Self { locations }
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,14 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The Matrix room alias to look up.
|
||||
#[ruma_api(query)]
|
||||
pub alias: RoomAliasId,
|
||||
pub alias: &'a RoomAliasId,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// List of matched third party locations.
|
||||
#[ruma_api(body)]
|
||||
@ -28,3 +30,17 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given room alias ID.
|
||||
pub fn new(alias: &'a RoomAliasId) -> Self {
|
||||
Self { alias }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Reponse` with the given locations.
|
||||
pub fn new(locations: Vec<Location>) -> Self {
|
||||
Self { locations }
|
||||
}
|
||||
}
|
||||
|
@ -13,12 +13,14 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The name of the protocol.
|
||||
#[ruma_api(path)]
|
||||
pub protocol: String,
|
||||
pub protocol: &'a str,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// Metadata about the protocol.
|
||||
#[ruma_api(body)]
|
||||
@ -27,3 +29,17 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given protocol name.
|
||||
pub fn new(protocol: &'a str) -> Self {
|
||||
Self { protocol }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given procotol.
|
||||
pub fn new(protocol: Protocol) -> Self {
|
||||
Self { protocol }
|
||||
}
|
||||
}
|
||||
|
@ -15,8 +15,11 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
#[non_exhaustive]
|
||||
request: {}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// Metadata about protocols supported by the homeserver.
|
||||
#[ruma_api(body)]
|
||||
@ -25,3 +28,17 @@ 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 procotols.
|
||||
pub fn new(protocols: BTreeMap<String, Protocol>) -> Self {
|
||||
Self { protocols }
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,11 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The protocol used to communicate to the third party network.
|
||||
#[ruma_api(path)]
|
||||
pub protocol: String,
|
||||
pub protocol: &'a str,
|
||||
|
||||
/// One or more custom fields that are passed to the AS to help identify the user.
|
||||
// The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352.
|
||||
@ -26,6 +27,7 @@ ruma_api! {
|
||||
pub fields: BTreeMap<String, String>,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// List of matched third party users.
|
||||
#[ruma_api(body)]
|
||||
@ -34,3 +36,17 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given protocol.
|
||||
pub fn new(protocol: &'a str) -> Self {
|
||||
Self { protocol, fields: BTreeMap::new() }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given users.
|
||||
pub fn new(users: Vec<User>) -> Self {
|
||||
Self { users }
|
||||
}
|
||||
}
|
||||
|
@ -14,12 +14,14 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The Matrix User ID to look up.
|
||||
#[ruma_api(query)]
|
||||
pub userid: UserId,
|
||||
pub userid: &'a UserId,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// List of matched third party users.
|
||||
#[ruma_api(body)]
|
||||
@ -28,3 +30,17 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given user ID.
|
||||
pub fn new(userid: &'a UserId) -> Self {
|
||||
Self { userid }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given users.
|
||||
pub fn new(users: Vec<User>) -> Self {
|
||||
Self { users }
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user