session

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package session persists values captured from responses between apic invocations, so `apic run login` followed by `apic run get-user` works the way it does in a GUI client. State lives in .apic/session.json under the project root; the directory ignores itself via .apic/.gitignore.

Index

Constants

View Source
const (
	Dir        = ".apic"
	File       = "session.json"
	DefaultEnv = "default"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	Envs map[string]map[string]string `json:"envs"`
	// contains filtered or unexported fields
}

Store is the on-disk session.

func NewMemory

func NewMemory() *Store

NewMemory returns a session that is never written to disk. Captured values and cached tokens still work within the process.

func Open

func Open(root string) (*Store, error)

Open loads the session for a project root, or an empty one.

func (*Store) Clear

func (s *Store) Clear(env string)

Clear drops captured values for env, or for every env when env is "*".

func (*Store) EnvNames

func (s *Store) EnvNames() []string

EnvNames lists the environments that have captured values.

func (*Store) Get

func (s *Store) Get(env, name string) (string, bool)

Get returns one captured value.

func (*Store) Save

func (s *Store) Save() error

Save writes the session to disk, creating .apic/ and its .gitignore. A memory-only store is a no-op.

func (*Store) Set

func (s *Store) Set(env string, vars map[string]string)

Set merges vars into env's captured values (in memory; call Save).

func (*Store) Vars

func (s *Store) Vars(env string) map[string]string

Vars returns a copy of the captured values for env.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL