Fixes and improvements.
parent
8b20a25461
commit
f5e9922294
|
@ -27,7 +27,7 @@ impl Client {
|
|||
blob: Vec<u8>,
|
||||
content_type: Option<&str>,
|
||||
) -> crate::Result<UploadResponse> {
|
||||
let account_id = account_id.unwrap_or(self.default_account_id());
|
||||
let account_id = account_id.unwrap_or_else(|| self.default_account_id());
|
||||
let mut upload_url =
|
||||
String::with_capacity(self.session().upload_url().len() + account_id.len());
|
||||
|
||||
|
|
|
@ -92,14 +92,26 @@ impl<O: ChangesObject> ChangesResponse<O> {
|
|||
&self.created
|
||||
}
|
||||
|
||||
pub fn take_created(&mut self) -> Vec<String> {
|
||||
std::mem::take(&mut self.created)
|
||||
}
|
||||
|
||||
pub fn updated(&self) -> &[String] {
|
||||
&self.updated
|
||||
}
|
||||
|
||||
pub fn take_updated(&mut self) -> Vec<String> {
|
||||
std::mem::take(&mut self.updated)
|
||||
}
|
||||
|
||||
pub fn destroyed(&self) -> &[String] {
|
||||
&self.destroyed
|
||||
}
|
||||
|
||||
pub fn take_destroyed(&mut self) -> Vec<String> {
|
||||
std::mem::take(&mut self.destroyed)
|
||||
}
|
||||
|
||||
pub fn arguments(&self) -> &O::ChangesResponse {
|
||||
&self.arguments
|
||||
}
|
||||
|
|
|
@ -162,10 +162,13 @@ impl Client {
|
|||
pub async fn email_changes(
|
||||
&self,
|
||||
since_state: impl Into<String>,
|
||||
max_changes: usize,
|
||||
max_changes: Option<usize>,
|
||||
) -> crate::Result<ChangesResponse<Email<Get>>> {
|
||||
let mut request = self.build();
|
||||
request.changes_email(since_state).max_changes(max_changes);
|
||||
let changes_request = request.changes_email(since_state);
|
||||
if let Some(max_changes) = max_changes {
|
||||
changes_request.max_changes(max_changes);
|
||||
}
|
||||
request.send_single().await
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ pub enum Filter {
|
|||
value: Vec<String>,
|
||||
},
|
||||
|
||||
// Stalwart specific
|
||||
// Non-standard
|
||||
Id {
|
||||
#[serde(rename = "id")]
|
||||
value: Vec<String>,
|
||||
|
@ -121,8 +121,6 @@ pub enum Comparator {
|
|||
From,
|
||||
#[serde(rename = "to")]
|
||||
To,
|
||||
#[serde(rename = "cc")]
|
||||
Cc,
|
||||
#[serde(rename = "subject")]
|
||||
Subject,
|
||||
#[serde(rename = "sentAt")]
|
||||
|
@ -133,6 +131,10 @@ pub enum Comparator {
|
|||
AllInThreadHaveKeyword { keyword: String },
|
||||
#[serde(rename = "someInThreadHaveKeyword")]
|
||||
SomeInThreadHaveKeyword { keyword: String },
|
||||
|
||||
// Non-standard
|
||||
#[serde(rename = "cc")]
|
||||
Cc,
|
||||
}
|
||||
|
||||
impl Filter {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use std::{pin::Pin, time::Duration};
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::{client::Client, core::session::URLPart, event_source::parser::EventParser, TypeState};
|
||||
use futures_util::{Stream, StreamExt};
|
||||
|
@ -13,7 +13,7 @@ impl Client {
|
|||
close_after_state: bool,
|
||||
ping: Option<u32>,
|
||||
last_event_id: Option<&str>,
|
||||
) -> crate::Result<Pin<Box<impl Stream<Item = crate::Result<Changes>>>>> {
|
||||
) -> crate::Result<impl Stream<Item = crate::Result<Changes>> + Unpin> {
|
||||
let mut event_source_url = String::with_capacity(self.session().event_source_url().len());
|
||||
|
||||
for part in self.event_source_url() {
|
||||
|
|
Loading…
Reference in New Issue