pub struct Api { /* private fields */ }
Expand description
interface object to interact with NextCloud
client
Implementations§
Source§impl Api
impl Api
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
new
opens the socket to the NextCloud
client.
After the connect, the initial messages are received
and processed. Those contain the registered directories
in the NextCloud
client.
§Errors
Will return errors if the socket can’t be opened or there is a parsing issue with the initial messages.
Sourcepub fn version(&mut self) -> Result<String>
pub fn version(&mut self) -> Result<String>
version
fetches the current version of the installed nextcloud-client.
The returned value is as reported and not parsed in any format.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn get_strings(&mut self) -> Result<Vec<String>>
pub fn get_strings(&mut self) -> Result<Vec<String>>
get_strings
reads the translation strings for context menu
actions.
The result is a vector of strings.
The format is <ACTION>:<Menu String>
.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
get_menu_items
reads the available actions for the file or folder.
The result is a vector of menu items.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn retrieve_folder_status(&mut self, path: &Path) -> Result<FileStatus>
pub fn retrieve_folder_status(&mut self, path: &Path) -> Result<FileStatus>
retrieve_folder_status
checks the current state of a folder.
If the folder is not part of the register, an error is returned.
See the documentation of FileStatus
for details.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn retrieve_file_status(&mut self, path: &Path) -> Result<FileStatus>
pub fn retrieve_file_status(&mut self, path: &Path) -> Result<FileStatus>
retrieve_file_status
checks the current state of a folder.
If the folder is not part of the register, an error is returned.
See the documentation of FileStatus
for details.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn activity(&mut self, path: &Path) -> Result<()>
pub fn activity(&mut self, path: &Path) -> Result<()>
activity
displays the file-activity dialog.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
share
opens the sharing dialog of the Nextcloud client
if certain constraints are met.
E.g. you can’t share a file, which is not synced to the
backend yet.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn manage_public_links(&mut self, path: &Path) -> Result<()>
pub fn manage_public_links(&mut self, path: &Path) -> Result<()>
manage_public_links
opens the sharing dialog to manage
active share links.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn copy_securefiledrop_link(&mut self, path: &Path) -> Result<()>
pub fn copy_securefiledrop_link(&mut self, path: &Path) -> Result<()>
copy_securefiledrop_link
creates a link to provide a file drop
location, which can’t be read afterwards. In case of an internal
error, the sharing dialog is opened. The created link is placed
in the clipboard.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn copy_public_link(&mut self, path: &Path) -> Result<()>
pub fn copy_public_link(&mut self, path: &Path) -> Result<()>
copy_public_link
creates a link to share publicly.
In case of an internal error, the sharing dialog is opened.
The created link is placed in the clipboard.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn copy_private_link(&mut self, path: &Path) -> Result<()>
pub fn copy_private_link(&mut self, path: &Path) -> Result<()>
copy_private_link
creates a link to share internally.
In case of an internal error, the sharing dialog is opened.
The created link is placed in the clipboard.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn email_private_link(&mut self, path: &Path) -> Result<()>
pub fn email_private_link(&mut self, path: &Path) -> Result<()>
email_private_link
creates a link to share internally.
In case of an internal error, the sharing dialog is opened.
The default e-mail client is opened with a prepared message.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn open_private_link(&mut self, path: &Path) -> Result<()>
pub fn open_private_link(&mut self, path: &Path) -> Result<()>
open_private_link
creates a link to share internally.
In case of an internal error, the sharing dialog is opened.
The default browser is opened with generated link.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn make_available_locally(&mut self, path: &Path) -> Result<()>
pub fn make_available_locally(&mut self, path: &Path) -> Result<()>
make_available_locally
configures the file to be synced to
the local FS as soon as possible.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.
Sourcepub fn make_online_only(&mut self, path: &Path) -> Result<()>
pub fn make_online_only(&mut self, path: &Path) -> Result<()>
make_online_only
configures the file to be virtually available.
The file or folder will be downloaded on access. So permanent
space occupation is minimized but latency shall be considered.
§Errors
Returns error if the request can’t be transmitted to the client or if an unknown response is received.