func (s *SessionClient) Get(ctx context.Context) (*apitypes.SessionStatus, error) {
	resp := &apitypes.SessionStatus{}
	err := s.client.DaemonRoundTrip(ctx, "GET", "/session", nil, nil, resp, nil)
	return resp, err
}
Get returns the status of the user's session.
package api
import (
	"context"
	"encoding/json"
	"errors"
	"github.com/manifoldco/go-base64"
	"github.com/manifoldco/torus-cli/apitypes"
	"github.com/manifoldco/torus-cli/envelope"
	"github.com/manifoldco/torus-cli/identity"
)
var errUnknownSessionType = errors.New("Unknown session type")
type Session struct {
	sessionType apitypes.SessionType
	identity    envelope.Envelope
	auth        envelope.Envelope
}
func (s *Session) Type() apitypes.SessionType {
	return s.sessionType
}
func (s *Session) ID() *identity.ID {
	return s.identity.GetID()
}
func (s *Session) AuthID() *identity.ID {
	return s.auth.GetID()
}
func (s *Session) Username() string {
	if s.sessionType == apitypes.MachineSession {
		return s.identity.(*envelope.Machine).Body.Name
	}
	return s.identity.(envelope.UserInf).Username()
}
func (s *Session) Name() string {
	if s.sessionType == apitypes.MachineSession {
		return s.identity.(*envelope.Machine).Body.Name
	}
	return s.identity.(envelope.UserInf).Name()
}
func (s *Session) Email() string {
	if s.sessionType == apitypes.MachineSession {
		return "none"
	}
	return s.identity.(envelope.UserInf).Email()
}
func (s *Session) State() string {
	if s.sessionType == apitypes.MachineSession {
		return s.identity.(*envelope.Machine).Body.State
	}
	return s.identity.(envelope.UserInf).State()
}
func NewSession(resp *apitypes.Self) (*Session, error) {
	switch resp.Type {
	case apitypes.UserSession:
		if _, ok := resp.Identity.(envelope.UserInf); !ok {
			return nil, errors.New("Identity must be a user object")
		}
		if _, ok := resp.Auth.(envelope.UserInf); !ok {
			return nil, errors.New("Auth must be a user object")
		}
	case apitypes.MachineSession:
		if _, ok := resp.Identity.(*envelope.Machine); !ok {
			return nil, errors.New("Identity must be a machine object")
		}
		if _, ok := resp.Auth.(*envelope.MachineToken); !ok {
			return nil, errors.New("Auth must be a machine token object")
		}
	default:
		return nil, errors.New("did not recognize session type")
	}
	return &Session{
		sessionType: resp.Type,
		identity:    resp.Identity,
		auth:        resp.Auth,
	}, nil
}
type SessionClient struct {
	client *apiRoundTripper
}
type rawSelf struct {
	*apitypes.Self
	Identity json.RawMessage `json:"identity"`
	Auth     json.RawMessage `json:"auth"`
}
func (s *SessionClient) Who(ctx context.Context) (*Session, error) {
	raw := &rawSelf{}
	err := s.client.DaemonRoundTrip(ctx, "GET", "/self", nil, nil, raw, nil)
	if err != nil {
		return nil, err
	}
	self := raw.Self
	switch raw.Type {
	case apitypes.UserSession:
		self.Identity = &envelope.User{}
		self.Auth = &envelope.User{}
	case apitypes.MachineSession:
		self.Identity = &envelope.Machine{}
		self.Auth = &envelope.MachineToken{}
	default:
		return nil, errUnknownSessionType
	}
	err = json.Unmarshal(raw.Identity, self.Identity)
	if err != nil {
		return nil, err
	}
	err = json.Unmarshal(raw.Auth, self.Auth)
	if err != nil {
		return nil, err
	}
	return NewSession(self)
}