Make file expiry time configurable, update ffsend-api to v0.4.0-git

This commit is contained in:
timvisee 2019-10-24 16:42:50 +02:00
parent 9076744ead
commit e39add8ffd
No known key found for this signature in database
GPG key ID: B8DB720BC383E172
8 changed files with 209 additions and 19 deletions

View file

@ -5,7 +5,10 @@ use ffsend_api::url::Url;
use super::Matcher;
use crate::cmd::{
arg::{ArgDownloadLimit, ArgGenPassphrase, ArgHost, ArgPassword, CmdArgFlag, CmdArgOption},
arg::{
ArgDownloadLimit, ArgExpiryTime, ArgGenPassphrase, ArgHost, ArgPassword, CmdArgFlag,
CmdArgOption,
},
matcher::MainMatcher,
};
use crate::util::{bin_name, env_var_present, quit_error_msg, ErrorHintsBuilder};
@ -93,6 +96,18 @@ impl<'a: 'b, 'b> UploadMatcher<'a> {
)
}
/// Get the expiry time in seconds.
///
/// If the expiry time was not set, `None` is returned.
pub fn expiry_time(
&'a self,
main_matcher: &MainMatcher,
api_version: ApiVersion,
auth: bool,
) -> Option<usize> {
ArgExpiryTime::value_checked(self.matches, main_matcher, api_version, auth)
}
/// Check whether to archive the file to upload.
#[cfg(feature = "archive")]
pub fn archive(&self) -> bool {