Struct Api

Source
pub struct Api { /* private fields */ }
Expand description

interface object to interact with NextCloud client

Implementations§

Source§

impl Api

Source

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.

Source

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.

Source

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.

Source

pub fn get_menu_items(&mut self, path: &Path) -> Result<Vec<MenuItem>>

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.

Source

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.

Source

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.

Source

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.

Source

pub fn share(&mut self, path: &Path) -> Result<()>

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.

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.

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.

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.

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.

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.

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl Freeze for Api

§

impl RefUnwindSafe for Api

§

impl Send for Api

§

impl Sync for Api

§

impl Unpin for Api

§

impl UnwindSafe for Api

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.