cli

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const SessionFolderFlag = "session-directory"

Variables

View Source
var (
	// DefaultSessionFolder is the default directory for CLI sessions.
	DefaultSessionFolder string

	// ErrSessionNotFound is returned when no session file exists.
	ErrSessionNotFound = errors.New("session not found")
)

Functions

This section is empty.

Types

type Session

type Session struct {
	*oauth2.Config

	// URL is the base URL of the API server.
	URL string `json:"url"`

	Folder string `json:"-"`
	// contains filtered or unexported fields
}

Session represents an authenticated CLI session.

func LoadSession

func LoadSession(folder string) (session *Session, err error)

LoadSession loads a session from disk.

func NewSession

func NewSession(url string, config *oauth2.Config, token *oauth2.Token, folder string) (session *Session, err error)

NewSession creates a new session and initializes the authorizer.

func (*Session) Authorizer

func (s *Session) Authorizer() (authorizer api.Authorizer)

Authorizer returns the session authorizer.

func (*Session) HTTPClient

func (s *Session) HTTPClient(base *http.Client) (client *http.Client)

HTTPClient returns an HTTP client that injects OAuth2 tokens.

func (*Session) MarshalJSON

func (s *Session) MarshalJSON() (b []byte, err error)

MarshalJSON serializes a session with token and OAuth config.

func (*Session) Save

func (s *Session) Save() (err error)

Save writes the session to disk.

func (*Session) SetAuthorizer

func (s *Session) SetAuthorizer(authorizer api.Authorizer)

SetAuthorizer sets the session authorizer.

func (*Session) UnmarshalJSON

func (s *Session) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON deserializes a session and rebuilds the authorizer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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