Use of take() instead of unwrap()
parent
5cc21ed1b5
commit
8b20a25461
|
@ -23,10 +23,11 @@ pub struct UploadResponse {
|
||||||
impl Client {
|
impl Client {
|
||||||
pub async fn upload(
|
pub async fn upload(
|
||||||
&self,
|
&self,
|
||||||
account_id: &str,
|
account_id: Option<&str>,
|
||||||
blob: Vec<u8>,
|
blob: Vec<u8>,
|
||||||
content_type: Option<&str>,
|
content_type: Option<&str>,
|
||||||
) -> crate::Result<UploadResponse> {
|
) -> crate::Result<UploadResponse> {
|
||||||
|
let account_id = account_id.unwrap_or(self.default_account_id());
|
||||||
let mut upload_url =
|
let mut upload_url =
|
||||||
String::with_capacity(self.session().upload_url().len() + account_id.len());
|
String::with_capacity(self.session().upload_url().len() + account_id.len());
|
||||||
|
|
||||||
|
@ -83,7 +84,7 @@ impl UploadResponse {
|
||||||
self.size
|
self.size
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_blob_id(self) -> String {
|
pub fn take_blob_id(&mut self) -> String {
|
||||||
self.blob_id
|
std::mem::take(&mut self.blob_id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,8 +68,8 @@ impl<O: ChangesObject> ChangesResponse<O> {
|
||||||
&self.account_id
|
&self.account_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_account_id(self) -> String {
|
pub fn take_account_id(&mut self) -> String {
|
||||||
self.account_id
|
std::mem::take(&mut self.account_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn old_state(&self) -> &str {
|
pub fn old_state(&self) -> &str {
|
||||||
|
@ -80,8 +80,8 @@ impl<O: ChangesObject> ChangesResponse<O> {
|
||||||
&self.new_state
|
&self.new_state
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_new_state(self) -> String {
|
pub fn take_new_state(&mut self) -> String {
|
||||||
self.new_state
|
std::mem::take(&mut self.new_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn has_more_changes(&self) -> bool {
|
pub fn has_more_changes(&self) -> bool {
|
||||||
|
|
|
@ -132,6 +132,12 @@ impl<O: SetObject> CopyResponse<O> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_created(&mut self) -> Option<Vec<O>> {
|
||||||
|
self.created
|
||||||
|
.take()
|
||||||
|
.map(|map| map.into_iter().map(|(_, v)| v).collect())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn created_ids(&self) -> Option<impl Iterator<Item = &String>> {
|
pub fn created_ids(&self) -> Option<impl Iterator<Item = &String>> {
|
||||||
self.created.as_ref().map(|map| map.keys())
|
self.created.as_ref().map(|map| map.keys())
|
||||||
}
|
}
|
||||||
|
|
|
@ -111,7 +111,7 @@ impl<O> GetResponse<O> {
|
||||||
&self.state
|
&self.state
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_state(&mut self) -> String {
|
pub fn take_state(&mut self) -> String {
|
||||||
std::mem::take(&mut self.state)
|
std::mem::take(&mut self.state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,14 +123,14 @@ impl<O> GetResponse<O> {
|
||||||
&self.not_found
|
&self.not_found
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_list(&mut self) -> Vec<O> {
|
pub fn take_list(&mut self) -> Vec<O> {
|
||||||
std::mem::take(&mut self.list)
|
std::mem::take(&mut self.list)
|
||||||
}
|
}
|
||||||
pub fn pop(&mut self) -> Option<O> {
|
pub fn pop(&mut self) -> Option<O> {
|
||||||
self.list.pop()
|
self.list.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_not_found(&mut self) -> Vec<String> {
|
pub fn take_not_found(&mut self) -> Vec<String> {
|
||||||
std::mem::take(&mut self.not_found)
|
std::mem::take(&mut self.not_found)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,8 +187,8 @@ impl QueryResponse {
|
||||||
self.ids[pos].as_str()
|
self.ids[pos].as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_ids(self) -> Vec<String> {
|
pub fn take_ids(&mut self) -> Vec<String> {
|
||||||
self.ids
|
std::mem::take(&mut self.ids)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn total(&self) -> Option<usize> {
|
pub fn total(&self) -> Option<usize> {
|
||||||
|
@ -203,7 +203,7 @@ impl QueryResponse {
|
||||||
self.position
|
self.position
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_query_state(&mut self) -> String {
|
pub fn take_query_state(&mut self) -> String {
|
||||||
std::mem::take(&mut self.query_state)
|
std::mem::take(&mut self.query_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,6 +235,11 @@ impl<A> Comparator<A> {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_ascending(mut self, is_ascending: bool) -> Self {
|
||||||
|
self.is_ascending = is_ascending;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn collation(mut self, collation: String) -> Self {
|
pub fn collation(mut self, collation: String) -> Self {
|
||||||
self.collation = Some(collation);
|
self.collation = Some(collation);
|
||||||
self
|
self
|
||||||
|
@ -254,6 +259,13 @@ impl<T> From<T> for Filter<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Filter<T> {
|
impl<T> Filter<T> {
|
||||||
|
pub fn operator(operator: Operator, conditions: Vec<Filter<T>>) -> Self {
|
||||||
|
Filter::FilterOperator(FilterOperator {
|
||||||
|
operator,
|
||||||
|
conditions,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn and<U, V>(conditions: U) -> Self
|
pub fn and<U, V>(conditions: U) -> Self
|
||||||
where
|
where
|
||||||
U: IntoIterator<Item = V>,
|
U: IntoIterator<Item = V>,
|
||||||
|
|
|
@ -262,6 +262,10 @@ impl TaggedMethodResponse {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn unwrap_method_response(self) -> MethodResponse {
|
||||||
|
self.response
|
||||||
|
}
|
||||||
|
|
||||||
pub fn unwrap_copy_blob(self) -> crate::Result<CopyBlobResponse> {
|
pub fn unwrap_copy_blob(self) -> crate::Result<CopyBlobResponse> {
|
||||||
match self.response {
|
match self.response {
|
||||||
MethodResponse::CopyBlob(response) => Ok(response),
|
MethodResponse::CopyBlob(response) => Ok(response),
|
||||||
|
|
|
@ -234,7 +234,7 @@ impl<O: SetObject> SetResponse<O> {
|
||||||
self.new_state.as_deref()
|
self.new_state.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_new_state(&mut self) -> Option<String> {
|
pub fn take_new_state(&mut self) -> Option<String> {
|
||||||
self.new_state.take()
|
self.new_state.take()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,11 +280,17 @@ impl<O: SetObject> SetResponse<O> {
|
||||||
self.updated.as_ref().map(|map| map.keys())
|
self.updated.as_ref().map(|map| map.keys())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_updated_ids(&mut self) -> Option<Vec<String>> {
|
||||||
|
self.updated
|
||||||
|
.take()
|
||||||
|
.map(|map| map.into_iter().map(|(k, _)| k).collect())
|
||||||
|
}
|
||||||
|
|
||||||
pub fn destroyed_ids(&self) -> Option<impl Iterator<Item = &String>> {
|
pub fn destroyed_ids(&self) -> Option<impl Iterator<Item = &String>> {
|
||||||
self.destroyed.as_ref().map(|list| list.iter())
|
self.destroyed.as_ref().map(|list| list.iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_destroyed_ids(&mut self) -> Option<Vec<String>> {
|
pub fn take_destroyed_ids(&mut self) -> Option<Vec<String>> {
|
||||||
self.destroyed.take()
|
self.destroyed.take()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,22 +10,26 @@ impl Email<Get> {
|
||||||
self.id.as_deref()
|
self.id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_id(self) -> String {
|
pub fn take_id(&mut self) -> String {
|
||||||
self.id.unwrap_or_default()
|
self.id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn blob_id(&self) -> Option<&str> {
|
pub fn blob_id(&self) -> Option<&str> {
|
||||||
self.blob_id.as_deref()
|
self.blob_id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_blob_id(self) -> String {
|
pub fn take_blob_id(&mut self) -> String {
|
||||||
self.blob_id.unwrap()
|
self.blob_id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn thread_id(&self) -> Option<&str> {
|
pub fn thread_id(&self) -> Option<&str> {
|
||||||
self.thread_id.as_deref()
|
self.thread_id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_thread_id(&mut self) -> Option<String> {
|
||||||
|
self.thread_id.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn mailbox_ids(&self) -> Vec<&str> {
|
pub fn mailbox_ids(&self) -> Vec<&str> {
|
||||||
self.mailbox_ids
|
self.mailbox_ids
|
||||||
.as_ref()
|
.as_ref()
|
||||||
|
@ -74,26 +78,58 @@ impl Email<Get> {
|
||||||
self.sender.as_deref()
|
self.sender.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_sender(&mut self) -> Option<Vec<EmailAddress>> {
|
||||||
|
self.sender.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn from(&self) -> Option<&[EmailAddress]> {
|
pub fn from(&self) -> Option<&[EmailAddress]> {
|
||||||
self.from.as_deref()
|
self.from.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_from(&mut self) -> Option<Vec<EmailAddress>> {
|
||||||
|
self.from.take()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reply_to(&self) -> Option<&[EmailAddress]> {
|
||||||
|
self.reply_to.as_deref()
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn take_reply_to(&mut self) -> Option<Vec<EmailAddress>> {
|
||||||
|
self.reply_to.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn to(&self) -> Option<&[EmailAddress]> {
|
pub fn to(&self) -> Option<&[EmailAddress]> {
|
||||||
self.to.as_deref()
|
self.to.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_to(&mut self) -> Option<Vec<EmailAddress>> {
|
||||||
|
self.to.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn cc(&self) -> Option<&[EmailAddress]> {
|
pub fn cc(&self) -> Option<&[EmailAddress]> {
|
||||||
self.cc.as_deref()
|
self.cc.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_cc(&mut self) -> Option<Vec<EmailAddress>> {
|
||||||
|
self.cc.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn bcc(&self) -> Option<&[EmailAddress]> {
|
pub fn bcc(&self) -> Option<&[EmailAddress]> {
|
||||||
self.bcc.as_deref()
|
self.bcc.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_bcc(&mut self) -> Option<Vec<EmailAddress>> {
|
||||||
|
self.bcc.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn subject(&self) -> Option<&str> {
|
pub fn subject(&self) -> Option<&str> {
|
||||||
self.subject.as_deref()
|
self.subject.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_subject(&mut self) -> Option<String> {
|
||||||
|
self.subject.take()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn sent_at(&self) -> Option<i64> {
|
pub fn sent_at(&self) -> Option<i64> {
|
||||||
self.sent_at.as_ref().map(|v| v.timestamp())
|
self.sent_at.as_ref().map(|v| v.timestamp())
|
||||||
}
|
}
|
||||||
|
@ -134,6 +170,10 @@ impl Email<Get> {
|
||||||
self.preview.as_deref()
|
self.preview.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn take_preview(&mut self) -> Option<String> {
|
||||||
|
self.preview.take()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(feature = "debug")]
|
#[cfg(feature = "debug")]
|
||||||
pub fn into_test(self) -> super::TestEmail {
|
pub fn into_test(self) -> super::TestEmail {
|
||||||
self.into()
|
self.into()
|
||||||
|
@ -216,6 +256,10 @@ impl EmailAddress<Get> {
|
||||||
pub fn email(&self) -> &str {
|
pub fn email(&self) -> &str {
|
||||||
self.email.as_str()
|
self.email.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn unwrap(self) -> (String, Option<String>) {
|
||||||
|
(self.email, self.name)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl EmailAddressGroup<Get> {
|
impl EmailAddressGroup<Get> {
|
||||||
|
|
|
@ -59,9 +59,9 @@ impl Client {
|
||||||
W: Into<String>,
|
W: Into<String>,
|
||||||
{
|
{
|
||||||
let blob_id = self
|
let blob_id = self
|
||||||
.upload(account_id, raw_message, None)
|
.upload(account_id.into(), raw_message, None)
|
||||||
.await?
|
.await?
|
||||||
.unwrap_blob_id();
|
.take_blob_id();
|
||||||
let mut request = self.build();
|
let mut request = self.build();
|
||||||
let import_request = request
|
let import_request = request
|
||||||
.import_email()
|
.import_email()
|
||||||
|
@ -156,7 +156,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<EmailGetResponse>()
|
.send_single::<EmailGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn email_changes(
|
pub async fn email_changes(
|
||||||
|
|
|
@ -613,7 +613,7 @@ impl Display for HeaderForm {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum BodyProperty {
|
pub enum BodyProperty {
|
||||||
PartId,
|
PartId,
|
||||||
BlobId,
|
BlobId,
|
||||||
|
|
|
@ -94,6 +94,20 @@ pub enum Filter {
|
||||||
#[serde(rename = "header")]
|
#[serde(rename = "header")]
|
||||||
value: Vec<String>,
|
value: Vec<String>,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// Stalwart specific
|
||||||
|
Id {
|
||||||
|
#[serde(rename = "id")]
|
||||||
|
value: Vec<String>,
|
||||||
|
},
|
||||||
|
SentBefore {
|
||||||
|
#[serde(rename = "sentBefore")]
|
||||||
|
value: DateTime<Utc>,
|
||||||
|
},
|
||||||
|
SentAfter {
|
||||||
|
#[serde(rename = "sentAfter")]
|
||||||
|
value: DateTime<Utc>,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Debug, Clone)]
|
#[derive(Serialize, Debug, Clone)]
|
||||||
|
@ -107,6 +121,8 @@ pub enum Comparator {
|
||||||
From,
|
From,
|
||||||
#[serde(rename = "to")]
|
#[serde(rename = "to")]
|
||||||
To,
|
To,
|
||||||
|
#[serde(rename = "cc")]
|
||||||
|
Cc,
|
||||||
#[serde(rename = "subject")]
|
#[serde(rename = "subject")]
|
||||||
Subject,
|
Subject,
|
||||||
#[serde(rename = "sentAt")]
|
#[serde(rename = "sentAt")]
|
||||||
|
@ -240,6 +256,29 @@ impl Filter {
|
||||||
}
|
}
|
||||||
Filter::Header { value }
|
Filter::Header { value }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stalwart JMAP specific
|
||||||
|
pub fn id<U, V>(value: U) -> Self
|
||||||
|
where
|
||||||
|
U: IntoIterator<Item = V>,
|
||||||
|
V: Into<String>,
|
||||||
|
{
|
||||||
|
Filter::Id {
|
||||||
|
value: value.into_iter().map(|v| v.into()).collect(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sent_before(value: i64) -> Self {
|
||||||
|
Filter::SentBefore {
|
||||||
|
value: from_timestamp(value),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sent_after(value: i64) -> Self {
|
||||||
|
Filter::SentAfter {
|
||||||
|
value: from_timestamp(value),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Comparator {
|
impl Comparator {
|
||||||
|
@ -259,6 +298,10 @@ impl Comparator {
|
||||||
query::Comparator::new(Comparator::To)
|
query::Comparator::new(Comparator::To)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn cc() -> query::Comparator<Comparator> {
|
||||||
|
query::Comparator::new(Comparator::Cc)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn subject() -> query::Comparator<Comparator> {
|
pub fn subject() -> query::Comparator<Comparator> {
|
||||||
query::Comparator::new(Comparator::Subject)
|
query::Comparator::new(Comparator::Subject)
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ impl EmailSubmission<Get> {
|
||||||
self.id.as_deref()
|
self.id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_id(self) -> String {
|
pub fn take_id(&mut self) -> String {
|
||||||
self.id.unwrap_or_default()
|
self.id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn identity_id(&self) -> Option<&str> {
|
pub fn identity_id(&self) -> Option<&str> {
|
||||||
|
|
|
@ -99,7 +99,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<EmailSubmissionGetResponse>()
|
.send_single::<EmailSubmissionGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn email_submission_query(
|
pub async fn email_submission_query(
|
||||||
|
|
|
@ -51,7 +51,17 @@ impl Changes {
|
||||||
self.changes.get(account_id).map(|changes| changes.iter())
|
self.changes.get(account_id).map(|changes| changes.iter())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn has_type(&self, type_: TypeState) -> bool {
|
||||||
|
self.changes
|
||||||
|
.values()
|
||||||
|
.any(|changes| changes.contains_key(&type_))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn into_inner(self) -> HashMap<String, HashMap<TypeState, String>> {
|
pub fn into_inner(self) -> HashMap<String, HashMap<TypeState, String>> {
|
||||||
self.changes
|
self.changes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(&self) -> bool {
|
||||||
|
!self.changes.values().any(|changes| !changes.is_empty())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,8 @@ impl Identity<Get> {
|
||||||
self.id.as_deref()
|
self.id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_id(self) -> String {
|
pub fn take_id(&mut self) -> String {
|
||||||
self.id.unwrap_or_default()
|
self.id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(&self) -> Option<&str> {
|
pub fn name(&self) -> Option<&str> {
|
||||||
|
|
|
@ -54,7 +54,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<IdentityGetResponse>()
|
.send_single::<IdentityGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn identity_changes(
|
pub async fn identity_changes(
|
||||||
|
|
|
@ -9,8 +9,8 @@ impl Mailbox<Get> {
|
||||||
self.id.as_deref()
|
self.id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_id(self) -> String {
|
pub fn take_id(&mut self) -> String {
|
||||||
self.id.unwrap_or_default()
|
self.id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name(&self) -> Option<&str> {
|
pub fn name(&self) -> Option<&str> {
|
||||||
|
|
|
@ -145,7 +145,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<MailboxGetResponse>()
|
.send_single::<MailboxGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn mailbox_query(
|
pub async fn mailbox_query(
|
||||||
|
|
|
@ -9,8 +9,8 @@ impl Principal<Get> {
|
||||||
self.id.as_deref()
|
self.id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_id(self) -> String {
|
pub fn take_id(&mut self) -> String {
|
||||||
self.id.unwrap_or_default()
|
self.id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn ptype(&self) -> Option<&Type> {
|
pub fn ptype(&self) -> Option<&Type> {
|
||||||
|
|
|
@ -212,7 +212,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<PrincipalGetResponse>()
|
.send_single::<PrincipalGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn principal_query(
|
pub async fn principal_query(
|
||||||
|
|
|
@ -7,8 +7,8 @@ impl PushSubscription<Get> {
|
||||||
self.id.as_deref()
|
self.id.as_deref()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn unwrap_id(self) -> String {
|
pub fn take_id(&mut self) -> String {
|
||||||
self.id.unwrap_or_default()
|
self.id.take().unwrap_or_default()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn device_client_id(&self) -> Option<&str> {
|
pub fn device_client_id(&self) -> Option<&str> {
|
||||||
|
|
|
@ -18,7 +18,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<ThreadGetResponse>()
|
.send_single::<ThreadGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ impl Client {
|
||||||
request
|
request
|
||||||
.send_single::<VacationResponseGetResponse>()
|
.send_single::<VacationResponseGetResponse>()
|
||||||
.await
|
.await
|
||||||
.map(|mut r| r.unwrap_list().pop())
|
.map(|mut r| r.take_list().pop())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn vacation_response_destroy(&self) -> crate::Result<()> {
|
pub async fn vacation_response_destroy(&self) -> crate::Result<()> {
|
||||||
|
|
Loading…
Reference in New Issue