pub struct Workspace {
pub id: EntityId,
pub name: String,
pub description: Option<String>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
pub tags: Vec<String>,
pub config: WorkspaceConfig,
pub folders: Vec<Folder>,
pub requests: Vec<MockRequest>,
pub order: i32,
}
Expand description
Workspace represents a top-level organizational unit
Fields§
§id: EntityId
Unique identifier
name: String
Human-readable name
description: Option<String>
Optional description
created_at: DateTime<Utc>
Creation timestamp
updated_at: DateTime<Utc>
Last modification timestamp
Associated tags for filtering and organization
config: WorkspaceConfig
Configuration specific to this workspace
folders: Vec<Folder>
Root folders in this workspace
requests: Vec<MockRequest>
Root requests (not in any folder)
order: i32
Display order for UI sorting (lower numbers appear first)
Implementations§
Source§impl Workspace
impl Workspace
Sourcepub fn add_folder(&mut self, name: String) -> Result<EntityId>
pub fn add_folder(&mut self, name: String) -> Result<EntityId>
Add a folder to this workspace
Sourcepub fn create_environment(
&mut self,
name: String,
description: Option<String>,
) -> Result<EntityId>
pub fn create_environment( &mut self, name: String, description: Option<String>, ) -> Result<EntityId>
Create a new environment
Sourcepub fn get_environments(&self) -> Vec<&Environment>
pub fn get_environments(&self) -> Vec<&Environment>
Get all environments (global + sub-environments)
Sourcepub fn get_environment(&self, id: &str) -> Option<&Environment>
pub fn get_environment(&self, id: &str) -> Option<&Environment>
Get environment by ID
Sourcepub fn get_environment_mut(&mut self, id: &str) -> Option<&mut Environment>
pub fn get_environment_mut(&mut self, id: &str) -> Option<&mut Environment>
Get environment by ID (mutable)
Sourcepub fn set_active_environment(
&mut self,
environment_id: Option<String>,
) -> Result<()>
pub fn set_active_environment( &mut self, environment_id: Option<String>, ) -> Result<()>
Set active environment
Sourcepub fn get_active_environment(&self) -> &Environment
pub fn get_active_environment(&self) -> &Environment
Get active environment (returns global if no sub-environment is active)
Sourcepub fn get_active_environment_id(&self) -> Option<&str>
pub fn get_active_environment_id(&self) -> Option<&str>
Get active environment ID
Sourcepub fn get_variable(&self, key: &str) -> Option<&String>
pub fn get_variable(&self, key: &str) -> Option<&String>
Get variable value from current active environment
Sourcepub fn get_all_variables(&self) -> HashMap<String, String>
pub fn get_all_variables(&self) -> HashMap<String, String>
Get all variables from current active environment context
Sourcepub fn delete_environment(&mut self, id: &str) -> Result<()>
pub fn delete_environment(&mut self, id: &str) -> Result<()>
Delete an environment
Sourcepub fn update_environments_order(
&mut self,
environment_ids: Vec<String>,
) -> Result<()>
pub fn update_environments_order( &mut self, environment_ids: Vec<String>, ) -> Result<()>
Update the order of environments
Sourcepub fn get_environments_ordered(&self) -> Vec<&Environment>
pub fn get_environments_ordered(&self) -> Vec<&Environment>
Get environments sorted by order
Sourcepub fn configure_sync(&mut self, config: SyncConfig) -> Result<()>
pub fn configure_sync(&mut self, config: SyncConfig) -> Result<()>
Configure directory sync for this workspace
Sourcepub fn enable_sync(&mut self, target_directory: String) -> Result<()>
pub fn enable_sync(&mut self, target_directory: String) -> Result<()>
Enable directory sync with default settings
Sourcepub fn disable_sync(&mut self) -> Result<()>
pub fn disable_sync(&mut self) -> Result<()>
Disable directory sync
Sourcepub fn get_sync_config(&self) -> &SyncConfig
pub fn get_sync_config(&self) -> &SyncConfig
Get sync configuration
Sourcepub fn is_sync_enabled(&self) -> bool
pub fn is_sync_enabled(&self) -> bool
Check if sync is enabled
Sourcepub fn get_sync_directory(&self) -> Option<&str>
pub fn get_sync_directory(&self) -> Option<&str>
Get the target sync directory
Sourcepub fn set_sync_directory(&mut self, directory: Option<String>) -> Result<()>
pub fn set_sync_directory(&mut self, directory: Option<String>) -> Result<()>
Set sync directory
Sourcepub fn set_sync_direction(&mut self, direction: SyncDirection) -> Result<()>
pub fn set_sync_direction(&mut self, direction: SyncDirection) -> Result<()>
Set sync direction
Sourcepub fn get_sync_direction(&self) -> &SyncDirection
pub fn get_sync_direction(&self) -> &SyncDirection
Get sync direction
Sourcepub fn set_realtime_monitoring(&mut self, enabled: bool) -> Result<()>
pub fn set_realtime_monitoring(&mut self, enabled: bool) -> Result<()>
Enable/disable real-time monitoring
Sourcepub fn is_realtime_monitoring_enabled(&self) -> bool
pub fn is_realtime_monitoring_enabled(&self) -> bool
Check if real-time monitoring is enabled
Sourcepub fn to_filtered_for_sync(&self) -> Workspace
pub fn to_filtered_for_sync(&self) -> Workspace
Create filtered copy for directory sync (removes sensitive environments and non-sharable environments)
Sourcepub fn should_sync(&self) -> bool
pub fn should_sync(&self) -> bool
Check if this workspace should be included in directory sync
Sourcepub fn get_sync_filename(&self) -> String
pub fn get_sync_filename(&self) -> String
Get the filename for this workspace in directory sync
Source§impl Workspace
impl Workspace
Sourcepub fn find_folder(&self, id: &str) -> Option<&Folder>
pub fn find_folder(&self, id: &str) -> Option<&Folder>
Find a folder by ID recursively
Sourcepub fn find_folder_mut(&mut self, id: &str) -> Option<&mut Folder>
pub fn find_folder_mut(&mut self, id: &str) -> Option<&mut Folder>
Find a folder by ID recursively (mutable)
Sourcepub fn add_request(&mut self, request: MockRequest) -> Result<EntityId>
pub fn add_request(&mut self, request: MockRequest) -> Result<EntityId>
Add a request to this workspace
Sourcepub fn get_routes(&self) -> Vec<Route>
pub fn get_routes(&self) -> Vec<Route>
Get all routes from this workspace
Sourcepub fn get_effective_auth<'a>(
&'a self,
folder_path: &[&'a Folder],
) -> Option<&'a AuthConfig>
pub fn get_effective_auth<'a>( &'a self, folder_path: &[&'a Folder], ) -> Option<&'a AuthConfig>
Get effective authentication for a request at the given path