pub struct RemoteProject { /* private fields */ }
Implementations§
source§impl RemoteProject
impl RemoteProject
sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Determine if the project is open (it needs to be opened before you can access its files)
sourcepub fn open(&self) -> Result<(), ()>
pub fn open(&self) -> Result<(), ()>
Open the project, allowing various file and folder based apis to work, as well as connecting a core Project
sourcepub fn open_with_progress<F: ProgressCallback>(
&self,
progress: F,
) -> Result<(), ()>
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
sourcepub fn get_for_local_database(
database: &Database,
) -> Result<Option<Ref<Self>>, ()>
pub fn get_for_local_database( database: &Database, ) -> Result<Option<Ref<Self>>, ()>
Get the Remote Project for a Database
sourcepub fn get_for_binaryview(bv: &BinaryView) -> Result<Option<Ref<Self>>, ()>
pub fn get_for_binaryview(bv: &BinaryView) -> Result<Option<Ref<Self>>, ()>
Get the Remote Project for a BinaryView
sourcepub fn core_project(&self) -> Result<Ref<Project>, ()>
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.
sourcepub fn created(&self) -> SystemTime
pub fn created(&self) -> SystemTime
Created date of the project
sourcepub fn last_modified(&self) -> SystemTime
pub fn last_modified(&self) -> SystemTime
Last modification of the project
sourcepub fn set_name<S: BnStrCompatible>(&self, name: S) -> Result<(), ()>
pub fn set_name<S: BnStrCompatible>(&self, name: S) -> Result<(), ()>
Set the description of the file. You will need to push the file to update the remote version.
sourcepub fn description(&self) -> BnString
pub fn description(&self) -> BnString
Desciprtion of the file
sourcepub fn set_description<S: BnStrCompatible>(
&self,
description: S,
) -> Result<(), ()>
pub fn set_description<S: BnStrCompatible>( &self, description: S, ) -> Result<(), ()>
Set the description of the file. You will need to push the file to update the remote version.
sourcepub fn received_file_count(&self) -> u64
pub fn received_file_count(&self) -> u64
Get the number of files in a project (without needing to pull them first)
sourcepub fn received_folder_count(&self) -> u64
pub fn received_folder_count(&self) -> u64
Get the number of folders in a project (without needing to pull them first)
sourcepub fn default_path(&self) -> Result<BnString, ()>
pub fn default_path(&self) -> Result<BnString, ()>
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.
sourcepub fn has_pulled_files(&self) -> bool
pub fn has_pulled_files(&self) -> bool
If the project has pulled the folders yet
sourcepub fn has_pulled_folders(&self) -> bool
pub fn has_pulled_folders(&self) -> bool
If the project has pulled the folders yet
sourcepub fn has_pulled_group_permissions(&self) -> bool
pub fn has_pulled_group_permissions(&self) -> bool
If the project has pulled the group permissions yet
sourcepub fn has_pulled_user_permissions(&self) -> bool
pub fn has_pulled_user_permissions(&self) -> bool
If the project has pulled the user permissions yet
sourcepub fn is_admin(&self) -> bool
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).
sourcepub fn files(&self) -> Result<Array<RemoteFile>, ()>
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.
sourcepub fn get_file_by_id<S: BnStrCompatible>(
&self,
id: S,
) -> Result<Option<Ref<RemoteFile>>, ()>
pub fn get_file_by_id<S: BnStrCompatible>( &self, id: S, ) -> 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.
sourcepub fn get_file_by_name<S: BnStrCompatible>(
&self,
name: S,
) -> Result<Option<Ref<RemoteFile>>, ()>
pub fn get_file_by_name<S: BnStrCompatible>( &self, name: S, ) -> 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.
sourcepub fn pull_files(&self) -> Result<(), ()>
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.
sourcepub fn pull_files_with_progress<P: ProgressCallback>(
&self,
progress: P,
) -> Result<(), ()>
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.
sourcepub fn create_file<F, N, D>(
&self,
filename: F,
contents: &[u8],
name: N,
description: D,
parent_folder: Option<&RemoteFolder>,
file_type: RemoteFileType,
) -> Result<Ref<RemoteFile>, ()>
pub fn create_file<F, N, D>( &self, filename: F, contents: &[u8], name: N, description: D, 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 namecontents
- File contentsname
- Displayed file namedescription
- File descriptionparent_folder
- Folder that will contain the filefile_type
- Type of File to create
sourcepub fn create_file_with_progress<F, N, D, P>(
&self,
filename: F,
contents: &[u8],
name: N,
description: D,
parent_folder: Option<&RemoteFolder>,
file_type: RemoteFileType,
progress: P,
) -> Result<Ref<RemoteFile>, ()>
pub fn create_file_with_progress<F, N, D, P>( &self, filename: F, contents: &[u8], name: N, description: D, 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 namecontents
- File contentsname
- Displayed file namedescription
- File descriptionparent_folder
- Folder that will contain the filefile_type
- Type of File to createprogress
- Function to call on upload progress updates
sourcepub fn push_file<I, K, V>(
&self,
file: &RemoteFile,
extra_fields: I,
) -> Result<(), ()>
pub fn push_file<I, K, V>( &self, file: &RemoteFile, extra_fields: I, ) -> Result<(), ()>
Push an updated File object to the Remote
NOTE: If the project has not been opened, it will be opened upon calling this.
pub fn delete_file(&self, file: &RemoteFile) -> Result<(), ()>
sourcepub fn folders(&self) -> Result<Array<RemoteFolder>, ()>
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.
sourcepub fn get_folder_by_id<S: BnStrCompatible>(
&self,
id: S,
) -> Result<Option<Ref<RemoteFolder>>, ()>
pub fn get_folder_by_id<S: BnStrCompatible>( &self, id: S, ) -> 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.
sourcepub fn pull_folders(&self) -> Result<(), ()>
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.
sourcepub fn pull_folders_with_progress<P: ProgressCallback>(
&self,
progress: P,
) -> Result<(), ()>
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.
sourcepub fn create_folder<N, D>(
&self,
name: N,
description: D,
parent_folder: Option<&RemoteFolder>,
) -> Result<Ref<RemoteFolder>, ()>where
N: BnStrCompatible,
D: BnStrCompatible,
pub fn create_folder<N, D>(
&self,
name: N,
description: D,
parent_folder: Option<&RemoteFolder>,
) -> Result<Ref<RemoteFolder>, ()>where
N: BnStrCompatible,
D: BnStrCompatible,
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 namedescription
- Folder descriptionparent
- Parent folder (optional)
sourcepub fn create_folder_with_progress<N, D, P>(
&self,
name: N,
description: D,
parent_folder: Option<&RemoteFolder>,
progress: P,
) -> Result<Ref<RemoteFolder>, ()>
pub fn create_folder_with_progress<N, D, P>( &self, name: N, description: D, 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 namedescription
- Folder descriptionparent
- Parent folder (optional)progress
- Function to call on upload progress updates
sourcepub fn push_folder<I, K, V>(
&self,
folder: &RemoteFolder,
extra_fields: I,
) -> Result<(), ()>
pub fn push_folder<I, K, V>( &self, folder: &RemoteFolder, extra_fields: I, ) -> Result<(), ()>
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 updatedextra_fields
- Extra HTTP fields to send with the update
sourcepub fn delete_folder(&self, folder: &RemoteFolder) -> Result<(), ()>
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.
sourcepub fn group_permissions(&self) -> Result<Array<Permission>, ()>
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.
sourcepub fn user_permissions(&self) -> Result<Array<Permission>, ()>
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.
sourcepub fn get_permission_by_id<S: BnStrCompatible>(
&self,
id: S,
) -> Result<Option<Ref<Permission>>, ()>
pub fn get_permission_by_id<S: BnStrCompatible>( &self, id: S, ) -> 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.
sourcepub fn pull_group_permissions(&self) -> Result<(), ()>
pub fn pull_group_permissions(&self) -> Result<(), ()>
Pull the list of group permissions from the Remote.
sourcepub fn pull_group_permissions_with_progress<F: ProgressCallback>(
&self,
progress: F,
) -> Result<(), ()>
pub fn pull_group_permissions_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>
Pull the list of group permissions from the Remote.
sourcepub fn pull_user_permissions(&self) -> Result<(), ()>
pub fn pull_user_permissions(&self) -> Result<(), ()>
Pull the list of user permissions from the Remote.
sourcepub fn pull_user_permissions_with_progress<F: ProgressCallback>(
&self,
progress: F,
) -> Result<(), ()>
pub fn pull_user_permissions_with_progress<F: ProgressCallback>( &self, progress: F, ) -> Result<(), ()>
Pull the list of user permissions from the Remote.
sourcepub fn create_group_permission(
&self,
group_id: i64,
level: CollaborationPermissionLevel,
) -> Result<Ref<Permission>, ()>
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 idlevel
- Permission level
sourcepub fn create_group_permission_with_progress<F: ProgressCallback>(
&self,
group_id: i64,
level: CollaborationPermissionLevel,
progress: F,
) -> Result<Ref<Permission>, ()>
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 idlevel
- Permission levelprogress
- Function to call for upload progress updates
sourcepub fn create_user_permission<S: BnStrCompatible>(
&self,
user_id: S,
level: CollaborationPermissionLevel,
) -> Result<Ref<Permission>, ()>
pub fn create_user_permission<S: BnStrCompatible>( &self, user_id: S, level: CollaborationPermissionLevel, ) -> Result<Ref<Permission>, ()>
Create a new user permission on the remote (and pull it).
§Arguments
user_id
- User idlevel
- Permission level
sourcepub fn create_user_permission_with_progress<S: BnStrCompatible, F: ProgressCallback>(
&self,
user_id: S,
level: CollaborationPermissionLevel,
progress: F,
) -> Result<Ref<Permission>, ()>
pub fn create_user_permission_with_progress<S: BnStrCompatible, F: ProgressCallback>( &self, user_id: S, level: CollaborationPermissionLevel, progress: F, ) -> Result<Ref<Permission>, ()>
Create a new user permission on the remote (and pull it).
§Arguments
user_id
- User idlevel
- Permission levelprogress
- The progress callback to call
sourcepub fn push_permission<I, K, V>(
&self,
permission: &Permission,
extra_fields: I,
) -> Result<(), ()>
pub fn push_permission<I, K, V>( &self, permission: &Permission, extra_fields: I, ) -> Result<(), ()>
Push project permissions to the remote.
§Arguments
permission
- Permission object which has been updatedextra_fields
- Extra HTTP fields to send with the update
sourcepub fn delete_permission(&self, permission: &Permission) -> Result<(), ()>
pub fn delete_permission(&self, permission: &Permission) -> Result<(), ()>
Delete a permission from the remote.
sourcepub fn can_user_view<S: BnStrCompatible>(&self, username: S) -> bool
pub fn can_user_view<S: BnStrCompatible>(&self, username: S) -> bool
Determine if a user is in any of the view/edit/admin groups.
§Arguments
username
- Username of user to check
sourcepub fn can_user_edit<S: BnStrCompatible>(&self, username: S) -> bool
pub fn can_user_edit<S: BnStrCompatible>(&self, username: S) -> bool
Determine if a user is in any of the edit/admin groups.
§Arguments
username
- Username of user to check
sourcepub fn can_user_admin<S: BnStrCompatible>(&self, username: S) -> bool
pub fn can_user_admin<S: BnStrCompatible>(&self, username: S) -> bool
sourcepub fn default_project_path(&self) -> BnString
pub fn default_project_path(&self) -> BnString
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.
sourcepub fn upload_database<C>(
&self,
metadata: &FileMetadata,
parent_folder: Option<&RemoteFolder>,
name_changeset: C,
) -> Result<Ref<RemoteFile>, ()>where
C: NameChangeset,
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 databaseparent_folder
- Optional parent folder in which to place this filename_changeset
- Function to call for naming a pushed changeset, if necessary
sourcepub 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,
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 databaseparent_folder
- Optional parent folder in which to place this fileprogress
-: Function to call for progress updatesname_changeset
- Function to call for naming a pushed changeset, if necessary