pub struct PlatformSession {
pub project_id: Option<String>,
pub project_name: Option<String>,
pub org_id: Option<String>,
pub org_name: Option<String>,
pub environment_id: Option<String>,
pub environment_name: Option<String>,
pub last_updated: Option<DateTime<Utc>>,
}Expand description
Platform session state - tracks selected project, organization, and environment
This is a separate system from conversation persistence - it tracks which platform project/org/environment the user has selected for platform operations.
Fields§
§project_id: Option<String>Selected platform project UUID
project_name: Option<String>Human-readable project name
org_id: Option<String>Organization UUID
org_name: Option<String>Organization name
environment_id: Option<String>Selected environment UUID
environment_name: Option<String>Human-readable environment name
last_updated: Option<DateTime<Utc>>When the session was last updated
Implementations§
Source§impl PlatformSession
impl PlatformSession
Sourcepub fn with_project(
project_id: String,
project_name: String,
org_id: String,
org_name: String,
) -> Self
pub fn with_project( project_id: String, project_name: String, org_id: String, org_name: String, ) -> Self
Creates a platform session with a selected project
Sourcepub fn with_environment(
project_id: String,
project_name: String,
org_id: String,
org_name: String,
environment_id: String,
environment_name: String,
) -> Self
pub fn with_environment( project_id: String, project_name: String, org_id: String, org_name: String, environment_id: String, environment_name: String, ) -> Self
Creates a platform session with a selected project and environment
Sourcepub fn clear_environment(&mut self)
pub fn clear_environment(&mut self)
Clears only the selected environment (keeps project)
Sourcepub fn is_project_selected(&self) -> bool
pub fn is_project_selected(&self) -> bool
Returns true if a project is currently selected
Sourcepub fn is_environment_selected(&self) -> bool
pub fn is_environment_selected(&self) -> bool
Returns true if an environment is currently selected
Sourcepub fn session_path() -> PathBuf
pub fn session_path() -> PathBuf
Returns the path to the platform session file
Location: ~/.syncable/platform-session.json
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load platform session from disk
Returns Default if the file doesn’t exist or can’t be parsed.
Sourcepub fn save(&self) -> Result<()>
pub fn save(&self) -> Result<()>
Save platform session to disk
Creates ~/.syncable/ directory if it doesn’t exist.
Sourcepub fn display_context(&self) -> String
pub fn display_context(&self) -> String
Returns a display string for the current context
Format: “[org/project/env]”, “[org/project]”, or “[no project selected]”
Trait Implementations§
Source§impl Clone for PlatformSession
impl Clone for PlatformSession
Source§fn clone(&self) -> PlatformSession
fn clone(&self) -> PlatformSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PlatformSession
impl Debug for PlatformSession
Source§impl Default for PlatformSession
impl Default for PlatformSession
Source§fn default() -> PlatformSession
fn default() -> PlatformSession
Source§impl<'de> Deserialize<'de> for PlatformSession
impl<'de> Deserialize<'de> for PlatformSession
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for PlatformSession
impl RefUnwindSafe for PlatformSession
impl Send for PlatformSession
impl Sync for PlatformSession
impl Unpin for PlatformSession
impl UnwindSafe for PlatformSession
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more