Make limit in user_directory/search a smart field
This commit is contained in:
parent
50a33c8089
commit
8650ae00da
@ -1,5 +1,10 @@
|
|||||||
# [unreleased]
|
# [unreleased]
|
||||||
|
|
||||||
|
Breaking changes:
|
||||||
|
|
||||||
|
* Update type of `limit` in `r0::user_directory::search_users` from
|
||||||
|
`Option<UInt>` to `UInt`
|
||||||
|
|
||||||
# 0.10.0
|
# 0.10.0
|
||||||
|
|
||||||
Bug fixes:
|
Bug fixes:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
//! [POST /_matrix/client/r0/user_directory/search](https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-user-directory-search)
|
//! [POST /_matrix/client/r0/user_directory/search](https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-user-directory-search)
|
||||||
|
|
||||||
use js_int::UInt;
|
use js_int::{uint, UInt};
|
||||||
use ruma_api::ruma_api;
|
use ruma_api::ruma_api;
|
||||||
use ruma_identifiers::UserId;
|
use ruma_identifiers::UserId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -22,8 +22,8 @@ ruma_api! {
|
|||||||
/// The maximum number of results to return.
|
/// The maximum number of results to return.
|
||||||
///
|
///
|
||||||
/// Defaults to 10.
|
/// Defaults to 10.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(default = "default_limit", skip_serializing_if = "is_default_limit")]
|
||||||
pub limit: Option<UInt>,
|
pub limit: UInt,
|
||||||
}
|
}
|
||||||
|
|
||||||
response: {
|
response: {
|
||||||
@ -37,6 +37,14 @@ ruma_api! {
|
|||||||
error: crate::Error
|
error: crate::Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn default_limit() -> UInt {
|
||||||
|
uint!(10)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_default_limit(limit: &UInt) -> bool {
|
||||||
|
limit == &default_limit()
|
||||||
|
}
|
||||||
|
|
||||||
/// User data as result of a search.
|
/// User data as result of a search.
|
||||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||||
pub struct User {
|
pub struct User {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user