Documentation
¶
Index ¶
- Constants
- Variables
- type Session
- func (s *Session) Authorizer() (authorizer api.Authorizer)
- func (s *Session) HTTPClient(base *http.Client) (client *http.Client)
- func (s *Session) MarshalJSON() (b []byte, err error)
- func (s *Session) Save() (err error)
- func (s *Session) SetAuthorizer(authorizer api.Authorizer)
- func (s *Session) UnmarshalJSON(data []byte) (err error)
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 ¶
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 ¶
HTTPClient returns an HTTP client that injects OAuth2 tokens.
func (*Session) MarshalJSON ¶
MarshalJSON serializes a session with token and OAuth config.
func (*Session) SetAuthorizer ¶
func (s *Session) SetAuthorizer(authorizer api.Authorizer)
SetAuthorizer sets the session authorizer.
func (*Session) UnmarshalJSON ¶
UnmarshalJSON deserializes a session and rebuilds the authorizer.
Click to show internal directories.
Click to hide internal directories.