RemoteProject

Struct RemoteProject 

Source
pub struct RemoteProject { /* private fields */ }

Implementations§

Source§

impl RemoteProject

Source

pub fn is_open(&self) -> bool

Determine if the project is open (it needs to be opened before you can access its files)

Source

pub fn open(&self) -> Result<(), ()>

Open the project, allowing various file and folder based apis to work, as well as connecting a core Project

Source

pub fn open_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>

Open the project, allowing various file and folder based apis to work, as well as connecting a core Project

Source

pub fn close(&self)

Close the project and stop all background operations (e.g. file uploads)

Source

pub fn get_for_local_database( database: &Database, ) -> Result<Option<Ref<Self>>, ()>

Get the Remote Project for a Database

Source

pub fn get_for_binaryview(bv: &BinaryView) -> Result<Option<Ref<Self>>, ()>

Get the Remote Project for a BinaryView

Source

pub fn core_project(&self) -> Result<Ref<Project>, ()>

Get the core Project for the remote project.

NOTE: If the project has not been opened, it will be opened upon calling this.

Source

pub fn remote(&self) -> Result<Ref<Remote>, ()>

Get the owning remote

Source

pub fn url(&self) -> String

Get the URL of the project

Source

pub fn id(&self) -> String

Get the unique ID of the project

Source

pub fn created(&self) -> SystemTime

Created date of the project

Source

pub fn last_modified(&self) -> SystemTime

Last modification of the project

Source

pub fn name(&self) -> String

Displayed name of file

Source

pub fn set_name(&self, name: &str) -> Result<(), ()>

Set the description of the file. You will need to push the file to update the remote version.

Source

pub fn description(&self) -> String

Desciprtion of the file

Source

pub fn set_description(&self, description: &str) -> Result<(), ()>

Set the description of the file. You will need to push the file to update the remote version.

Source

pub fn received_file_count(&self) -> u64

Get the number of files in a project (without needing to pull them first)

Source

pub fn received_folder_count(&self) -> u64

Get the number of folders in a project (without needing to pull them first)

Source

pub fn default_path(&self) -> Result<PathBuf, ()>

Get the default directory path for a remote Project. This is based off the Setting for collaboration.directory, the project’s id, and the project’s remote’s id.

Source

pub fn has_pulled_files(&self) -> bool

If the project has pulled the folders yet

Source

pub fn has_pulled_folders(&self) -> bool

If the project has pulled the folders yet

Source

pub fn has_pulled_group_permissions(&self) -> bool

If the project has pulled the group permissions yet

Source

pub fn has_pulled_user_permissions(&self) -> bool

If the project has pulled the user permissions yet

Source

pub fn is_admin(&self) -> bool

If the currently logged in user is an administrator of the project (and can edit permissions and such for the project).

Source

pub fn files(&self) -> Result<Array<RemoteFile>, ()>

Get the list of files in this project.

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If folders have not been pulled, they will be pulled upon calling this. NOTE: If files have not been pulled, they will be pulled upon calling this.

Source

pub fn get_file_by_id(&self, id: &str) -> Result<Option<Ref<RemoteFile>>, ()>

Get a specific File in the Project by its id

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If files have not been pulled, they will be pulled upon calling this.

Source

pub fn get_file_by_name( &self, name: &str, ) -> Result<Option<Ref<RemoteFile>>, ()>

Get a specific File in the Project by its name

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If files have not been pulled, they will be pulled upon calling this.

Source

pub fn pull_files(&self) -> Result<(), ()>

Pull the list of files from the Remote.

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If folders have not been pulled, they will be pulled upon calling this.

Source

pub fn pull_files_with_progress<P: ProgressCallback>( &self, progress: P, ) -> Result<(), ()>

Pull the list of files from the Remote.

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If folders have not been pulled, they will be pulled upon calling this.

Source

pub fn create_file( &self, filename: &str, contents: &[u8], name: &str, description: &str, parent_folder: Option<&RemoteFolder>, file_type: RemoteFileType, ) -> Result<Ref<RemoteFile>, ()>

Create a new file on the remote and return a reference to the created file

NOTE: If the project has not been opened, it will be opened upon calling this.

  • filename - File name
  • contents - File contents
  • name - Displayed file name
  • description - File description
  • parent_folder - Folder that will contain the file
  • file_type - Type of File to create
Source

pub fn create_file_with_progress<P>( &self, filename: &str, contents: &[u8], name: &str, description: &str, parent_folder: Option<&RemoteFolder>, file_type: RemoteFileType, progress: P, ) -> Result<Ref<RemoteFile>, ()>

Create a new file on the remote and return a reference to the created file

NOTE: If the project has not been opened, it will be opened upon calling this.

  • filename - File name
  • contents - File contents
  • name - Displayed file name
  • description - File description
  • parent_folder - Folder that will contain the file
  • file_type - Type of File to create
  • progress - Function to call on upload progress updates
Source

pub fn push_file<I>(&self, file: &RemoteFile, extra_fields: I) -> Result<(), ()>
where I: IntoIterator<Item = (String, String)>,

Push an updated File object to the Remote

NOTE: If the project has not been opened, it will be opened upon calling this.

Source

pub fn delete_file(&self, file: &RemoteFile) -> Result<(), ()>

Source

pub fn folders(&self) -> Result<Array<RemoteFolder>, ()>

Get the list of folders in this project.

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If folders have not been pulled, they will be pulled upon calling this.

Source

pub fn get_folder_by_id( &self, id: &str, ) -> Result<Option<Ref<RemoteFolder>>, ()>

Get a specific Folder in the Project by its id

NOTE: If the project has not been opened, it will be opened upon calling this. NOTE: If folders have not been pulled, they will be pulled upon calling this.

Source

pub fn pull_folders(&self) -> Result<(), ()>

Pull the list of folders from the Remote.

NOTE: If the project has not been opened, it will be opened upon calling this.

Source

pub fn pull_folders_with_progress<P: ProgressCallback>( &self, progress: P, ) -> Result<(), ()>

Pull the list of folders from the Remote.

NOTE: If the project has not been opened, it will be opened upon calling this.

Source

pub fn create_folder( &self, name: &str, description: &str, parent_folder: Option<&RemoteFolder>, ) -> Result<Ref<RemoteFolder>, ()>

Create a new folder on the remote (and pull it)

NOTE: If the project has not been opened, it will be opened upon calling this.

  • name - Displayed folder name
  • description - Folder description
  • parent - Parent folder (optional)
Source

pub fn create_folder_with_progress<P>( &self, name: &str, description: &str, parent_folder: Option<&RemoteFolder>, progress: P, ) -> Result<Ref<RemoteFolder>, ()>

Create a new folder on the remote (and pull it)

NOTE: If the project has not been opened, it will be opened upon calling this.

  • name - Displayed folder name
  • description - Folder description
  • parent - Parent folder (optional)
  • progress - Function to call on upload progress updates
Source

pub fn push_folder<I>( &self, folder: &RemoteFolder, extra_fields: I, ) -> Result<(), ()>
where I: IntoIterator<Item = (String, String)>,

Push an updated Folder object to the Remote

NOTE: If the project has not been opened, it will be opened upon calling this.

  • folder - Folder object which has been updated
  • extra_fields - Extra HTTP fields to send with the update
Source

pub fn delete_folder(&self, folder: &RemoteFolder) -> Result<(), ()>

Delete a folder from the remote

NOTE: If the project has not been opened, it will be opened upon calling this.

Source

pub fn group_permissions(&self) -> Result<Array<Permission>, ()>

Get the list of group permissions in this project.

NOTE: If group permissions have not been pulled, they will be pulled upon calling this.

Source

pub fn user_permissions(&self) -> Result<Array<Permission>, ()>

Get the list of user permissions in this project.

NOTE: If user permissions have not been pulled, they will be pulled upon calling this.

Source

pub fn get_permission_by_id( &self, id: &str, ) -> Result<Option<Ref<Permission>>, ()>

Get a specific permission in the Project by its id.

NOTE: If group or user permissions have not been pulled, they will be pulled upon calling this.

Source

pub fn pull_group_permissions(&self) -> Result<(), ()>

Pull the list of group permissions from the Remote.

Source

pub fn pull_group_permissions_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>

Pull the list of group permissions from the Remote.

Source

pub fn pull_user_permissions(&self) -> Result<(), ()>

Pull the list of user permissions from the Remote.

Source

pub fn pull_user_permissions_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>

Pull the list of user permissions from the Remote.

Source

pub fn create_group_permission( &self, group_id: i64, level: CollaborationPermissionLevel, ) -> Result<Ref<Permission>, ()>

Create a new group permission on the remote (and pull it).

§Arguments
  • group_id - Group id
  • level - Permission level
Source

pub fn create_group_permission_with_progress<F: ProgressCallback>( &self, group_id: i64, level: CollaborationPermissionLevel, progress: F, ) -> Result<Ref<Permission>, ()>

Create a new group permission on the remote (and pull it).

§Arguments
  • group_id - Group id
  • level - Permission level
  • progress - Function to call for upload progress updates
Source

pub fn create_user_permission( &self, user_id: &str, level: CollaborationPermissionLevel, ) -> Result<Ref<Permission>, ()>

Create a new user permission on the remote (and pull it).

§Arguments
  • user_id - User id
  • level - Permission level
Source

pub fn create_user_permission_with_progress<F: ProgressCallback>( &self, user_id: &str, level: CollaborationPermissionLevel, progress: F, ) -> Result<Ref<Permission>, ()>

Create a new user permission on the remote (and pull it).

§Arguments
  • user_id - User id
  • level - Permission level
  • progress - The progress callback to call
Source

pub fn push_permission<I>( &self, permission: &Permission, extra_fields: I, ) -> Result<(), ()>
where I: IntoIterator<Item = (String, String)>,

Push project permissions to the remote.

§Arguments
  • permission - Permission object which has been updated
  • extra_fields - Extra HTTP fields to send with the update
Source

pub fn delete_permission(&self, permission: &Permission) -> Result<(), ()>

Delete a permission from the remote.

Source

pub fn can_user_view(&self, username: &str) -> bool

Determine if a user is in any of the view/edit/admin groups.

§Arguments
  • username - Username of user to check
Source

pub fn can_user_edit(&self, username: &str) -> bool

Determine if a user is in any of the edit/admin groups.

§Arguments
  • username - Username of user to check
Source

pub fn can_user_admin(&self, username: &str) -> bool

Determine if a user is in the admin group.

§Arguments
  • username - Username of user to check
Source

pub fn default_project_path(&self) -> String

Get the default directory path for a remote Project. This is based off the Setting for collaboration.directory, the project’s id, and the project’s remote’s id.

Source

pub fn upload_database<C>( &self, metadata: &FileMetadata, parent_folder: Option<&RemoteFolder>, name_changeset: C, ) -> Result<Ref<RemoteFile>, ()>
where C: NameChangeset,

Upload a file, with database, to the remote under the given project

  • metadata - Local file with database
  • parent_folder - Optional parent folder in which to place this file
  • name_changeset - Function to call for naming a pushed changeset, if necessary
Source

pub fn upload_database_with_progress<C>( &self, metadata: &FileMetadata, parent_folder: Option<&RemoteFolder>, name_changeset: C, progress_function: impl ProgressCallback, ) -> Result<Ref<RemoteFile>, ()>
where C: NameChangeset,

Upload a file, with database, to the remote under the given project

  • metadata - Local file with database
  • parent_folder - Optional parent folder in which to place this file
  • progress -: Function to call for progress updates
  • name_changeset - Function to call for naming a pushed changeset, if necessary

Trait Implementations§

Source§

impl CoreArrayProvider for RemoteProject

Source§

impl Debug for RemoteProject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RemoteProject

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl ToOwned for RemoteProject

Source§

type Owned = Ref<RemoteProject>

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> Self::Owned

Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§

fn clone_into(&self, target: &mut Self::Owned)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl Eq for RemoteProject

Source§

impl Send for RemoteProject

Source§

impl Sync for RemoteProject

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more