Documentation
¶
Index ¶
Constants ¶
const ServiceName = "notion-cli"
Variables ¶
This section is empty.
Functions ¶
func ResolveToken ¶
func ResolveToken(flagToken, flagProfile string, cfg *config.Config, store KeyringStore) (string, error)
ResolveToken returns a Notion API token using the following precedence:
- flagToken (--token flag)
- NOTION_TOKEN env var
- NOTION_PROFILE env → keyring lookup
- flagProfile (--profile flag) → keyring lookup
- config.DefaultProfile → keyring lookup
- Only one profile in keyring → use it
Types ¶
type KeyringStore ¶
type KeyringStore interface {
Get(profile string) (string, error)
Set(profile string, token string) error
Delete(profile string) error
List() ([]string, error)
}
KeyringStore abstracts credential storage for testability.
func NewKeyringStore ¶
func NewKeyringStore() (KeyringStore, error)
NewKeyringStore creates a platform-native credential store. Backend selection: NOTION_KEYRING_BACKEND env → platform default → file fallback.
type OAuthFlow ¶
type OAuthFlow struct {
// contains filtered or unexported fields
}
OAuthFlow handles OAuth2 PKCE for Notion public integrations.
func NewOAuthFlow ¶
NewOAuthFlow creates an OAuth flow for Notion.
func (*OAuthFlow) RefreshToken ¶
RefreshToken exchanges a refresh token for a new access token.
type ProfileManager ¶
type ProfileManager struct {
// contains filtered or unexported fields
}
ProfileManager handles profile CRUD via keyring + config.
func NewProfileManager ¶
func NewProfileManager(store KeyringStore, cfg *config.Config) *ProfileManager
NewProfileManager creates a profile manager.
func (*ProfileManager) Add ¶
func (p *ProfileManager) Add(name, token string) error
Add stores a token in the keyring and registers the profile in config.
func (*ProfileManager) Get ¶
func (p *ProfileManager) Get(name string) (string, error)
Get retrieves the token for a profile from the keyring.
func (*ProfileManager) List ¶
func (p *ProfileManager) List() ([]Profile, error)
List returns all known profiles from the keyring.
func (*ProfileManager) Remove ¶
func (p *ProfileManager) Remove(name string) error
Remove deletes a profile from keyring and config.
func (*ProfileManager) SetDefault ¶
func (p *ProfileManager) SetDefault(name string) error
SetDefault marks a profile as the default in config.