Documentation ¶
Index ¶
- Variables
- type AccountAuth
- type AccountAuths
- type Auth
- type TokenStore
- func (t *TokenStore) Current() (AccountAuth, error)
- func (t *TokenStore) CurrentName() string
- func (t *TokenStore) Find(name string) (AccountAuth, error)
- func (t *TokenStore) List() AccountAuths
- func (t *TokenStore) Login(name, homeserver, username, password string) (AccountAuth, error)
- func (t *TokenStore) Remove(name string) error
- func (t *TokenStore) SetCurrent(name string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoAccounts = errors.New("no accounts configured") ErrAccountNotFound = errors.New("account not found") )
Functions ¶
This section is empty.
Types ¶
type AccountAuth ¶
type AccountAuth struct { Name string `json:"name"` Homeserver string `json:"homeserver"` UserID string `json:"userId"` Token string `json:"token"` }
func (AccountAuth) Domain ¶
func (a AccountAuth) Domain() (string, error)
type AccountAuths ¶
type AccountAuths []AccountAuth
func (AccountAuths) Find ¶
func (a AccountAuths) Find(name string) (AccountAuth, bool)
func (AccountAuths) Update ¶
func (a AccountAuths) Update(auth AccountAuth) AccountAuths
type Auth ¶
type Auth struct { Current string `json:"current_account"` Accounts AccountAuths `json:"accounts"` }
type TokenStore ¶
type TokenStore struct {
// contains filtered or unexported fields
}
func NewTokenStore ¶
func NewTokenStore(dir string, client *http.Client) (*TokenStore, error)
func (*TokenStore) Current ¶
func (t *TokenStore) Current() (AccountAuth, error)
func (*TokenStore) CurrentName ¶
func (t *TokenStore) CurrentName() string
func (*TokenStore) Find ¶
func (t *TokenStore) Find(name string) (AccountAuth, error)
func (*TokenStore) List ¶
func (t *TokenStore) List() AccountAuths
func (*TokenStore) Login ¶
func (t *TokenStore) Login(name, homeserver, username, password string) (AccountAuth, error)
func (*TokenStore) Remove ¶
func (t *TokenStore) Remove(name string) error
func (*TokenStore) SetCurrent ¶
func (t *TokenStore) SetCurrent(name string) error
Click to show internal directories.
Click to hide internal directories.