Documentation
¶
Overview ¶
Package session provides session persistence for LazyCurl. It manages saving and restoring application state to .lazycurl/session.yml.
Index ¶
Constants ¶
const ( // SessionVersion is the current session file format version SessionVersion = 1 // SessionFileName is the name of the session file SessionFileName = "session.yml" // SessionDir is the directory containing session files SessionDir = ".lazycurl" )
Variables ¶
This section is empty.
Functions ¶
func GetSessionPath ¶
GetSessionPath returns the full path to the session file.
Types ¶
type CollectionsPanelState ¶
type CollectionsPanelState struct {
ExpandedFolders []string `yaml:"expanded_folders,omitempty"`
ScrollPosition int `yaml:"scroll_position"`
SelectedIndex int `yaml:"selected_index"`
}
CollectionsPanelState represents collections panel state.
type CursorPosition ¶
CursorPosition represents cursor in multi-line editor.
type PanelsState ¶
type PanelsState struct {
Collections CollectionsPanelState `yaml:"collections"`
Request RequestPanelState `yaml:"request"`
Response ResponsePanelState `yaml:"response"`
}
PanelsState contains state for all panels.
type RequestPanelState ¶
type RequestPanelState struct {
ActiveTab string `yaml:"active_tab"`
URLCursor int `yaml:"url_cursor,omitempty"`
BodyCursor *CursorPosition `yaml:"body_cursor,omitempty"`
}
RequestPanelState represents request panel state.
type ResponsePanelState ¶
type ResponsePanelState struct {
ActiveTab string `yaml:"active_tab"`
ScrollPosition int `yaml:"scroll_position"`
}
ResponsePanelState represents response panel state.
type Session ¶
type Session struct {
Version int `yaml:"version"`
LastUpdated time.Time `yaml:"last_updated"`
ActivePanel string `yaml:"active_panel"`
ActiveCollection string `yaml:"active_collection,omitempty"`
ActiveRequest string `yaml:"active_request,omitempty"`
ActiveEnvironment string `yaml:"active_environment,omitempty"`
Panels PanelsState `yaml:"panels"`
}
Session represents the complete application state at a point in time.
func DefaultSession ¶
func DefaultSession() *Session
DefaultSession returns a new Session with sensible default values.
func LoadSession ¶
LoadSession loads session from .lazycurl/session.yml in the given workspace. Returns DefaultSession if file is missing, invalid, or has unsupported version.