Skip to content

Commit 62fdb8f

Browse files
committed
feat: support optional arguments for APPEND command
1 parent b47f207 commit 62fdb8f

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/client.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,15 +1114,21 @@ impl<T: Read + Write + Unpin + fmt::Debug + Send> Session<T> {
11141114
/// Specifically, the server will generally notify the client immediately via an untagged
11151115
/// `EXISTS` response. If the server does not do so, the client MAY issue a `NOOP` command (or
11161116
/// failing that, a `CHECK` command) after one or more `APPEND` commands.
1117-
pub async fn append<S: AsRef<str>, B: AsRef<[u8]>>(
1117+
pub async fn append(
11181118
&mut self,
1119-
mailbox: S,
1120-
content: B,
1119+
mailbox: impl AsRef<str>,
1120+
flags: Option<&str>,
1121+
internaldate: Option<&str>,
1122+
content: impl AsRef<[u8]>,
11211123
) -> Result<()> {
11221124
let content = content.as_ref();
11231125
self.run_command(&format!(
1124-
"APPEND \"{}\" {{{}}}",
1126+
"APPEND \"{}\"{}{}{}{} {{{}}}",
11251127
mailbox.as_ref(),
1128+
if flags.is_some() { " " } else { "" },
1129+
flags.unwrap_or(""),
1130+
if internaldate.is_some() { " " } else { "" },
1131+
internaldate.unwrap_or(""),
11261132
content.len()
11271133
))
11281134
.await?;

0 commit comments

Comments
 (0)