Documentation
¶
Index ¶
- type AccountToken
- type AuthStore
- type Client
- func (c *Client) GetAccounts() map[string]AccountToken
- func (c *Client) GetDefaultAccount() string
- func (c *Client) GetToken(accountID string) (*AccountToken, error)
- func (c *Client) Login(ctx context.Context) (*AccountToken, error)
- func (c *Client) Logout(accountID string) error
- func (c *Client) SetDefaultAccount(accountID string) error
- type TokenData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountToken ¶
type AccountToken struct {
AccountID string `json:"account_id"`
AccountName string `json:"account_name"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
ExpiresIn int `json:"expires_in"`
ObtainedAt time.Time `json:"obtained_at"`
}
AccountToken represents token data for a specific account
type AuthStore ¶
type AuthStore struct {
DefaultAccount string `json:"default_account"`
Accounts map[string]AccountToken `json:"accounts"`
}
AuthStore manages authentication tokens
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles OAuth2 authentication
func (*Client) GetAccounts ¶
func (c *Client) GetAccounts() map[string]AccountToken
GetAccounts returns all authenticated accounts
func (*Client) GetDefaultAccount ¶
GetDefaultAccount returns the default account ID
func (*Client) GetToken ¶
func (c *Client) GetToken(accountID string) (*AccountToken, error)
GetToken returns a valid token for the specified account
func (*Client) Login ¶
func (c *Client) Login(ctx context.Context) (*AccountToken, error)
Login performs the OAuth2 authentication flow
func (*Client) SetDefaultAccount ¶
SetDefaultAccount sets the default account
Click to show internal directories.
Click to hide internal directories.