client-api: Make two more request / response pairs non-exhaustive
This commit is contained in:
parent
4215feb815
commit
417b65def5
@ -13,13 +13,15 @@ ruma_api! {
|
||||
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// URL to which the homeserver should return the user after completing
|
||||
/// authentication with the SSO identity provider.
|
||||
#[ruma_api(query)]
|
||||
pub redirect_url: String,
|
||||
pub redirect_url: &'a str,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// Redirect URL to the SSO identity provider.
|
||||
#[ruma_api(header = LOCATION)]
|
||||
@ -28,3 +30,17 @@ ruma_api! {
|
||||
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given redirect URL.
|
||||
pub fn new(redirect_url: &'a str) -> Self {
|
||||
Self { redirect_url }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given SSO URL.
|
||||
pub fn new(location: String) -> Self {
|
||||
Self { location }
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// The term to search for.
|
||||
pub search_term: &'a str,
|
||||
@ -34,6 +35,7 @@ ruma_api! {
|
||||
pub language: Option<String>,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// Ordered by rank and then whether or not profile info is available.
|
||||
pub results: Vec<User>,
|
||||
@ -45,6 +47,20 @@ ruma_api! {
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates a new `Request` with the given search term.
|
||||
pub fn new(search_term: &'a str) -> Self {
|
||||
Self { search_term, limit: default_limit(), language: None }
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a new `Response` with the given results and limited flag
|
||||
pub fn new(results: Vec<User>, limited: bool) -> Self {
|
||||
Self { results, limited }
|
||||
}
|
||||
}
|
||||
|
||||
fn default_limit() -> UInt {
|
||||
uint!(10)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user