Skip to content

Commit

Permalink
v0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mdecimus committed Apr 16, 2023
1 parent d340fab commit 3168352
Show file tree
Hide file tree
Showing 37 changed files with 160 additions and 2,026 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
jmap-client 0.2.1
================================
- Using maybe_async to reduce duplicate code.
- Added `accept_invalid_certs` option to builder.

jmap-client 0.2.0
================================
- JMAP for Sieve Scripts support.
Expand Down
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "jmap-client"
description = "JMAP client library for Rust"
version = "0.2.0"
version = "0.2.1"
edition = "2018"
authors = [ "Stalwart Labs Ltd. <hello@stalw.art>"]
license = "Apache-2.0 OR MIT"
Expand All @@ -12,8 +12,8 @@ categories = ["email"]
readme = "README.md"

[dependencies]
reqwest = { git = "https://github.com/stalwartlabs/reqwest.git", version = "0.11", default-features = false, features = ["rustls-tls"]}
tokio-tungstenite = { version = "0.17", features = ["rustls-tls-webpki-roots"], optional = true}
reqwest = { version = "0.11", default-features = false, features = ["rustls-tls"]}
tokio-tungstenite = { version = "0.18", features = ["rustls-tls-webpki-roots"], optional = true}
tokio = { version = "1.16", default-features = false, features = ["io-util"], optional = true }
futures-util = { version = "0.3", optional = true}
async-stream = { version = "0.3", optional = true}
Expand All @@ -23,13 +23,13 @@ chrono = { version = "0.4", features = ["serde"]}
ahash = {version = "0.8", features = ["serde"]}
parking_lot = "0.12"
base64 = "0.13"
maybe-async = "0.2"

[features]
default = ["async"]
async = ["futures-util", "async-stream", "reqwest/stream"]
websockets = ["tokio", "tokio-tungstenite"]
blocking = ["reqwest/blocking"]
follow-trusted = []
blocking = ["reqwest/blocking", "maybe-async/is_sync"]
debug = []

[lib]
Expand Down
4 changes: 4 additions & 0 deletions examples/eventsource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@
* except according to those terms.
*/

#[cfg(feature = "async")]
use futures_util::StreamExt;
#[cfg(feature = "async")]
use jmap_client::{client::Client, TypeState};

#[cfg(feature = "async")]
async fn event_source() {
// Connect to the JMAP server using Basic authentication
let client = Client::new()
Expand Down Expand Up @@ -58,5 +61,6 @@ async fn event_source() {
}

fn main() {
#[cfg(feature = "async")]
let _c = event_source();
}
3 changes: 3 additions & 0 deletions examples/mailboxes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
* except according to those terms.
*/

#[cfg(feature = "async")]
use jmap_client::{
client::Client,
mailbox::{query::Filter, Role},
};

#[cfg(feature = "async")]
async fn mailboxes() {
// Connect to the JMAP server using Basic authentication
let client = Client::new()
Expand Down Expand Up @@ -65,5 +67,6 @@ async fn mailboxes() {
}

fn main() {
#[cfg(feature = "async")]
let _c = mailboxes();
}
4 changes: 4 additions & 0 deletions examples/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,23 @@
* except according to those terms.
*/

#[cfg(feature = "async")]
use jmap_client::{
client::Client,
core::query::Filter,
email::{self, Property},
mailbox::{self, Role},
};

#[cfg(feature = "async")]
const TEST_MESSAGE: &[u8; 90] = br#"From: john@example.org
To: jane@example.org
Subject: Testing JMAP client
This is a test.
"#;

#[cfg(feature = "async")]
async fn messages() {
// Connect to the JMAP server using Basic authentication
let client = Client::new()
Expand Down Expand Up @@ -116,5 +119,6 @@ async fn messages() {
}

fn main() {
#[cfg(feature = "async")]
let _c = messages();
}
3 changes: 3 additions & 0 deletions examples/result_reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@
* except according to those terms.
*/

#[cfg(feature = "async")]
use jmap_client::{client::Client, core::query, email, mailbox};

#[cfg(feature = "async")]
async fn result_reference() {
// Connect to the JMAP server using Basic authentication
let client = Client::new()
Expand Down Expand Up @@ -97,5 +99,6 @@ async fn result_reference() {
}

fn main() {
#[cfg(feature = "async")]
let _c = result_reference();
}
3 changes: 3 additions & 0 deletions src/blob/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ use crate::{
use super::copy::{CopyBlobRequest, CopyBlobResponse};

impl Client {
#[maybe_async::maybe_async]
pub async fn blob_copy(
&self,
from_account_id: impl Into<String>,
Expand All @@ -34,6 +35,7 @@ impl Client {
}

impl Request<'_> {
#[maybe_async::maybe_async]
pub fn copy_blob(&mut self, from_account_id: impl Into<String>) -> &mut CopyBlobRequest {
self.add_method_call(
Method::CopyBlob,
Expand All @@ -42,6 +44,7 @@ impl Request<'_> {
.blob_copy_mut()
}

#[maybe_async::maybe_async]
pub async fn send_copy_blob(self) -> crate::Result<CopyBlobResponse> {
self.send_single().await
}
Expand Down
45 changes: 0 additions & 45 deletions src/blob/helpers_blocking.rs

This file was deleted.

3 changes: 0 additions & 3 deletions src/blob/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ use crate::core::session::URLParser;

pub mod copy;
pub mod download;
#[cfg(feature = "async")]
pub mod helpers;
#[cfg(feature = "blocking")]
pub mod helpers_blocking;
pub mod upload;

pub enum URLParameter {
Expand Down
Loading

0 comments on commit 3168352

Please sign in to comment.