Skip to content

Commit

Permalink
feat!: site() and custom_command now return FtpResult<Response>
Browse files Browse the repository at this point in the history
  • Loading branch information
veeso committed May 20, 2024
1 parent d4a1cbe commit 1e4664d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
Released on 20/05/2024

- feat!: `Response.body` now contains the entire response
- feat!: `site()` and `custom_command` now return `FtpResult<Response>`

## 5.4.0

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["suppaftp", "suppaftp-cli"]
resolver = "2"

[workspace.package]
version = "5.4.0"
version = "5.5.0"
edition = "2021"
authors = [
"Christian Visintin <christian.visintin@veeso.dev>",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</p>

<p align="center">Developed by <a href="https://veeso.github.io/">veeso</a> and <a href="https://github.com/mattnenterprise">Matt McCoy</a></p>
<p align="center">Current version: 5.4.0 (18/05/2024)</p>
<p align="center">Current version: 5.5.0 (20/05/2024)</p>

<p align="center">
<a href="https://opensource.org/licenses/MIT"
Expand Down
8 changes: 4 additions & 4 deletions suppaftp/src/async_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -723,22 +723,22 @@ where
}

/// Execute a command on the server and return the response
pub async fn site(&mut self, command: impl ToString) -> FtpResult<()> {
pub async fn site(&mut self, command: impl ToString) -> FtpResult<Response> {
debug!("Sending SITE command: {}", command.to_string());
self.perform(Command::Site(command.to_string())).await?;
self.read_response(Status::CommandOk).await.map(|_| ())
self.read_response(Status::CommandOk).await
}

/// Perform custom command
pub async fn custom_command(
&mut self,
command: impl ToString,
expected_code: &[Status],
) -> FtpResult<()> {
) -> FtpResult<Response> {
let command = command.to_string();
debug!("Sending custom command: {}", command);
self.perform(Command::Custom(command)).await?;
self.read_response_in(expected_code).await.map(|_| ())
self.read_response_in(expected_code).await
}

// -- private
Expand Down
8 changes: 4 additions & 4 deletions suppaftp/src/sync_ftp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -721,22 +721,22 @@ where
}

/// Execute a command on the server and return the response
pub fn site(&mut self, command: impl ToString) -> FtpResult<()> {
pub fn site(&mut self, command: impl ToString) -> FtpResult<Response> {
debug!("Sending SITE command: {}", command.to_string());
self.perform(Command::Site(command.to_string()))?;
self.read_response(Status::CommandOk).map(|_| ())
self.read_response(Status::CommandOk)
}

/// Perform custom command
pub fn custom_command(
&mut self,
command: impl ToString,
expected_code: &[Status],
) -> FtpResult<()> {
) -> FtpResult<Response> {
let command = command.to_string();
debug!("Sending custom command: {}", command);
self.perform(Command::Custom(command))?;
self.read_response_in(expected_code).map(|_| ())
self.read_response_in(expected_code)
}

// -- private
Expand Down

0 comments on commit 1e4664d

Please sign in to comment.