Struct ffsend_api::file::remote_file::RemoteFile [−][src]
pub struct RemoteFile { /* fields omitted */ }A struct representing an uploaded file on a Send host.
The struct contains the file ID, the file URL, the key that is required in combination with the file, and the owner key.
Methods
impl RemoteFile[src]
impl RemoteFilepub fn new(
id: String,
upload_at: Option<DateTime<Utc>>,
expire_at: Option<DateTime<Utc>>,
host: Url,
url: Url,
secret: Vec<u8>,
owner_token: Option<String>
) -> Self[src]
pub fn new(
id: String,
upload_at: Option<DateTime<Utc>>,
expire_at: Option<DateTime<Utc>>,
host: Url,
url: Url,
secret: Vec<u8>,
owner_token: Option<String>
) -> SelfConstruct a new file.
pub fn new_now(
id: String,
host: Url,
url: Url,
secret: Vec<u8>,
owner_token: Option<String>
) -> Self[src]
pub fn new_now(
id: String,
host: Url,
url: Url,
secret: Vec<u8>,
owner_token: Option<String>
) -> SelfConstruct a new file, that was created at this exact time. This will set the file expiration time
pub fn parse_url(
url: Url,
owner_token: Option<String>
) -> Result<RemoteFile, FileParseError>[src]
pub fn parse_url(
url: Url,
owner_token: Option<String>
) -> Result<RemoteFile, FileParseError>Try to parse the given share URL.
The given URL is matched against a share URL pattern, this does not check whether the host is a valid and online host.
If the URL fragmet contains a file secret, it is also parsed. If it does not, the secret is left empty and must be specified manually.
An optional owner token may be given.
pub fn id(&self) -> &str[src]
pub fn id(&self) -> &strGet the file ID.
pub fn expire_at(&self) -> DateTime<Utc>[src]
pub fn expire_at(&self) -> DateTime<Utc>Get the time the file will expire after.
Note that this time may not be correct as it may have been guessed,
see expire_uncertain().
pub fn expire_duration(&self) -> Duration[src]
pub fn expire_duration(&self) -> DurationGet the duration the file will expire after.
Note that this time may not be correct as it may have been guessed,
see expire_uncertain().
pub fn set_expire_at(&mut self, expire_at: Option<DateTime<Utc>>)[src]
pub fn set_expire_at(&mut self, expire_at: Option<DateTime<Utc>>)Set the time this file will expire at. None may be given to assign the default expiry time with the uncertainty flag set.
pub fn set_expire_duration(&mut self, duration: Duration)[src]
pub fn set_expire_duration(&mut self, duration: Duration)Set the time this file will expire at, based on the given duration from now.
pub fn has_expired(&self) -> bool[src]
pub fn has_expired(&self) -> boolCheck whether this file has expired, based on it's expiry property.
pub fn expire_uncertain(&self) -> bool[src]
pub fn expire_uncertain(&self) -> boolCheck whehter the set expiry time is uncertain. If the expiry time of a file is unknown, the default time is assigned from the first time the file was used. Such time will be uncertain as it probably isn't correct. This time may be used however to check for expiry.
pub fn url(&self) -> &Url[src]
pub fn url(&self) -> &UrlGet the file URL, provided by the server.
pub fn secret_raw(&self) -> &Vec<u8>[src]
pub fn secret_raw(&self) -> &Vec<u8>Get the raw secret.
pub fn secret(&self) -> String[src]
pub fn secret(&self) -> StringGet the secret as base64 encoded string.
pub fn set_secret(&mut self, secret: Vec<u8>)[src]
pub fn set_secret(&mut self, secret: Vec<u8>)Set the secret for this file.
pub fn has_secret(&self) -> bool[src]
pub fn has_secret(&self) -> boolCheck whether a file secret is set. This secret must be set to decrypt a downloaded Send file.
pub fn owner_token(&self) -> Option<&String>[src]
pub fn owner_token(&self) -> Option<&String>Get the owner token if set.
pub fn owner_token_mut(&mut self) -> &mut Option<String>[src]
pub fn owner_token_mut(&mut self) -> &mut Option<String>Get the owner token if set.
pub fn set_owner_token(&mut self, token: Option<String>)[src]
pub fn set_owner_token(&mut self, token: Option<String>)Set the owner token, wrapped in an option.
If None is given, the owner token will be unset.
pub fn has_owner_token(&self) -> bool[src]
pub fn has_owner_token(&self) -> boolCheck whether an owner token is set in this remote file.
pub fn host(&self) -> Url[src]
pub fn host(&self) -> UrlGet the host URL for this remote file.
pub fn download_url(&self, secret: bool) -> Url[src]
pub fn download_url(&self, secret: bool) -> UrlBuild the download URL of the given file.
This URL is identical to the share URL, a term used in this API.
Set secret to true, to include it in the URL if known.
pub fn merge(&mut self, other: &RemoteFile, overwrite: bool) -> bool[src]
pub fn merge(&mut self, other: &RemoteFile, overwrite: bool) -> boolMerge properties non-existant into this file, from the given other file. This is ofcourse only done for properties that may be empty.
The file IDs are not asserted for equality.
Trait Implementations
impl Clone for RemoteFile[src]
impl Clone for RemoteFilefn clone(&self) -> RemoteFile[src]
fn clone(&self) -> RemoteFileReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for RemoteFile[src]
impl Debug for RemoteFileAuto Trait Implementations
impl Send for RemoteFile
impl Send for RemoteFileimpl Sync for RemoteFile
impl Sync for RemoteFile