client-api: Make sync_events request and response types non-exhaustive
This commit is contained in:
parent
83140b585c
commit
277800b980
@ -24,6 +24,7 @@ ruma_api! {
|
||||
requires_authentication: true,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
request: {
|
||||
/// A filter represented either as its full JSON definition or the ID of a saved filter.
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
@ -58,6 +59,7 @@ ruma_api! {
|
||||
pub timeout: Option<Duration>,
|
||||
}
|
||||
|
||||
#[non_exhaustive]
|
||||
response: {
|
||||
/// The batch token to supply in the `since` param of the next `/sync` request.
|
||||
pub next_batch: String,
|
||||
@ -93,6 +95,34 @@ ruma_api! {
|
||||
error: crate::Error
|
||||
}
|
||||
|
||||
impl<'a> Request<'a> {
|
||||
/// Creates an empty `Request`.
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
filter: None,
|
||||
since: None,
|
||||
full_state: false,
|
||||
set_presence: Default::default(),
|
||||
timeout: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Response {
|
||||
/// Creates a `Response` with the given batch token.
|
||||
pub fn new(next_batch: String) -> Self {
|
||||
Self {
|
||||
next_batch,
|
||||
rooms: Default::default(),
|
||||
presence: Default::default(),
|
||||
account_data: Default::default(),
|
||||
to_device: Default::default(),
|
||||
device_lists: Default::default(),
|
||||
device_one_time_keys_count: BTreeMap::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A filter represented either as its full JSON definition or the ID of a saved filter.
|
||||
#[derive(Clone, Copy, Debug, Outgoing, Serialize)]
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
|
@ -334,13 +334,12 @@ where
|
||||
|
||||
async move {
|
||||
let response = client
|
||||
.request(SyncRequest {
|
||||
.request(assign!(SyncRequest::new(), {
|
||||
filter,
|
||||
since: since.as_deref(),
|
||||
full_state: false,
|
||||
set_presence,
|
||||
timeout,
|
||||
})
|
||||
}))
|
||||
.await?;
|
||||
|
||||
let next_batch_clone = response.next_batch.clone();
|
||||
|
Loading…
x
Reference in New Issue
Block a user