Documentation
¶
Index ¶
- func IsGoogleIntegration(integrationType string) bool
- func NeedsRefresh(creds *types.IntegrationCredentials) bool
- type GitHubProvider
- func (g *GitHubProvider) AuthorizeURL(state, integrationType string) (string, error)
- func (g *GitHubProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
- func (g *GitHubProvider) IsConfigured() bool
- func (g *GitHubProvider) Name() string
- func (g *GitHubProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
- func (g *GitHubProvider) SupportsIntegration(integrationType string) bool
- type GoogleProvider
- func (g *GoogleProvider) AuthorizeURL(state, integrationType string) (string, error)
- func (g *GoogleProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
- func (g *GoogleProvider) IsConfigured() bool
- func (g *GoogleProvider) Name() string
- func (g *GoogleProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
- func (g *GoogleProvider) SupportsIntegration(integrationType string) bool
- type LinearProvider
- func (l *LinearProvider) AuthorizeURL(state, integrationType string) (string, error)
- func (l *LinearProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
- func (l *LinearProvider) IsConfigured() bool
- func (l *LinearProvider) Name() string
- func (l *LinearProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
- func (l *LinearProvider) SupportsIntegration(integrationType string) bool
- type NotionProvider
- func (n *NotionProvider) AuthorizeURL(state, integrationType string) (string, error)
- func (n *NotionProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
- func (n *NotionProvider) IsConfigured() bool
- func (n *NotionProvider) Name() string
- func (n *NotionProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
- func (n *NotionProvider) SupportsIntegration(integrationType string) bool
- type Provider
- type Registry
- func (r *Registry) GetProvider(name string) (Provider, bool)
- func (r *Registry) GetProviderForIntegration(integrationType string) (Provider, error)
- func (r *Registry) IsOAuthIntegration(integrationType string) bool
- func (r *Registry) ListConfiguredProviders() []string
- func (r *Registry) ListIntegrations() []string
- func (r *Registry) Register(p Provider)
- func (r *Registry) RegisterIntegration(integrationType, providerName string)
- type Session
- type SessionStatus
- type SlackProvider
- func (s *SlackProvider) AuthorizeURL(state, integrationType string) (string, error)
- func (s *SlackProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
- func (s *SlackProvider) IsConfigured() bool
- func (s *SlackProvider) Name() string
- func (s *SlackProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
- func (s *SlackProvider) SupportsIntegration(integrationType string) bool
- type Store
- func (s *Store) Complete(id, connectionID string)
- func (s *Store) Create(workspaceID uint, workspaceExt, integrationType, returnTo string) *Session
- func (s *Store) Delete(id string)
- func (s *Store) Fail(id, errMsg string)
- func (s *Store) Get(id string) *Session
- func (s *Store) GetByState(state string) *Session
- func (s *Store) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsGoogleIntegration ¶
IsGoogleIntegration returns true if the integration uses Google OAuth Deprecated: Use Registry.IsOAuthIntegration instead
func NeedsRefresh ¶
func NeedsRefresh(creds *types.IntegrationCredentials) bool
NeedsRefresh returns true if credentials are expired or about to expire
Types ¶
type GitHubProvider ¶
type GitHubProvider struct {
// contains filtered or unexported fields
}
GitHubProvider handles GitHub OAuth operations for workspace integrations Implements the Provider interface
func NewGitHubProvider ¶
func NewGitHubProvider(cfg types.IntegrationGitHubOAuth) *GitHubProvider
NewGitHubProvider creates a new GitHub OAuth provider from config
func (*GitHubProvider) AuthorizeURL ¶
func (g *GitHubProvider) AuthorizeURL(state, integrationType string) (string, error)
AuthorizeURL generates the GitHub OAuth authorization URL for an integration
func (*GitHubProvider) Exchange ¶
func (g *GitHubProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
Exchange exchanges an authorization code for tokens
func (*GitHubProvider) IsConfigured ¶
func (g *GitHubProvider) IsConfigured() bool
IsConfigured returns true if GitHub OAuth is configured
func (*GitHubProvider) Refresh ¶
func (g *GitHubProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
Refresh refreshes an access token using a refresh token Note: GitHub personal access tokens don't expire, but GitHub Apps use refresh tokens
func (*GitHubProvider) SupportsIntegration ¶
func (g *GitHubProvider) SupportsIntegration(integrationType string) bool
SupportsIntegration returns true if this provider handles the given integration type
type GoogleProvider ¶
type GoogleProvider struct {
// contains filtered or unexported fields
}
GoogleProvider handles Google OAuth operations for workspace integrations Implements the Provider interface
func NewGoogleClient ¶
func NewGoogleClient(cfg types.IntegrationGoogleOAuth) *GoogleProvider
NewGoogleClient creates a new Google OAuth client from config Deprecated: Use NewGoogleProvider instead
func NewGoogleProvider ¶
func NewGoogleProvider(cfg types.IntegrationGoogleOAuth) *GoogleProvider
NewGoogleProvider creates a new Google OAuth provider from config
func (*GoogleProvider) AuthorizeURL ¶
func (g *GoogleProvider) AuthorizeURL(state, integrationType string) (string, error)
AuthorizeURL generates the Google OAuth authorization URL for an integration
func (*GoogleProvider) Exchange ¶
func (g *GoogleProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
Exchange exchanges an authorization code for tokens
func (*GoogleProvider) IsConfigured ¶
func (g *GoogleProvider) IsConfigured() bool
IsConfigured returns true if Google OAuth is configured
func (*GoogleProvider) Refresh ¶
func (g *GoogleProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
Refresh refreshes an access token using a refresh token
func (*GoogleProvider) SupportsIntegration ¶
func (g *GoogleProvider) SupportsIntegration(integrationType string) bool
SupportsIntegration returns true if this provider handles the given integration type
type LinearProvider ¶ added in v0.1.9
type LinearProvider struct {
// contains filtered or unexported fields
}
LinearProvider handles Linear OAuth operations for workspace integrations Implements the Provider interface
func NewLinearProvider ¶ added in v0.1.9
func NewLinearProvider(cfg types.IntegrationLinearOAuth) *LinearProvider
NewLinearProvider creates a new Linear OAuth provider from config
func (*LinearProvider) AuthorizeURL ¶ added in v0.1.9
func (l *LinearProvider) AuthorizeURL(state, integrationType string) (string, error)
AuthorizeURL generates the Linear OAuth authorization URL for an integration
func (*LinearProvider) Exchange ¶ added in v0.1.9
func (l *LinearProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
Exchange exchanges an authorization code for tokens
func (*LinearProvider) IsConfigured ¶ added in v0.1.9
func (l *LinearProvider) IsConfigured() bool
IsConfigured returns true if Linear OAuth is configured
func (*LinearProvider) Name ¶ added in v0.1.9
func (l *LinearProvider) Name() string
Name returns the provider name
func (*LinearProvider) Refresh ¶ added in v0.1.9
func (l *LinearProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
Refresh refreshes an access token using a refresh token Note: Linear access tokens are long-lived and don't use refresh tokens
func (*LinearProvider) SupportsIntegration ¶ added in v0.1.9
func (l *LinearProvider) SupportsIntegration(integrationType string) bool
SupportsIntegration returns true if this provider handles the given integration type
type NotionProvider ¶
type NotionProvider struct {
// contains filtered or unexported fields
}
NotionProvider handles Notion OAuth operations for workspace integrations Implements the Provider interface
func NewNotionProvider ¶
func NewNotionProvider(cfg types.IntegrationNotionOAuth) *NotionProvider
NewNotionProvider creates a new Notion OAuth provider from config
func (*NotionProvider) AuthorizeURL ¶
func (n *NotionProvider) AuthorizeURL(state, integrationType string) (string, error)
AuthorizeURL generates the Notion OAuth authorization URL for an integration
func (*NotionProvider) Exchange ¶
func (n *NotionProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
Exchange exchanges an authorization code for tokens
func (*NotionProvider) IsConfigured ¶
func (n *NotionProvider) IsConfigured() bool
IsConfigured returns true if Notion OAuth is configured
func (*NotionProvider) Refresh ¶
func (n *NotionProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
Refresh refreshes an access token using a refresh token Note: Notion tokens don't expire and don't have refresh tokens
func (*NotionProvider) SupportsIntegration ¶
func (n *NotionProvider) SupportsIntegration(integrationType string) bool
SupportsIntegration returns true if this provider handles the given integration type
type Provider ¶
type Provider interface {
// Name returns the provider name (e.g., "google", "github")
Name() string
// IsConfigured returns true if the provider has valid credentials
IsConfigured() bool
// SupportsIntegration returns true if this provider handles the given integration type
SupportsIntegration(integrationType string) bool
// AuthorizeURL generates the OAuth authorization URL for the given integration
AuthorizeURL(state, integrationType string) (string, error)
// Exchange exchanges an authorization code for tokens
Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
// Refresh refreshes an access token using a refresh token
Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
}
Provider defines the interface for OAuth providers
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages OAuth providers and maps integration types to providers
func (*Registry) GetProvider ¶
GetProvider returns a provider by name
func (*Registry) GetProviderForIntegration ¶
GetProviderForIntegration returns the provider that handles the given integration type
func (*Registry) IsOAuthIntegration ¶
IsOAuthIntegration returns true if the integration type uses OAuth
func (*Registry) ListConfiguredProviders ¶
ListConfiguredProviders returns names of all configured providers
func (*Registry) ListIntegrations ¶
ListIntegrations returns all registered integration types
func (*Registry) RegisterIntegration ¶
RegisterIntegration maps an integration type to a provider
type Session ¶
type Session struct {
ID string `json:"id"`
State string `json:"state"` // Used in OAuth state param, maps back to session
WorkspaceID uint `json:"-"` // Internal workspace ID
WorkspaceExt string `json:"workspace_id"`
IntegrationType string `json:"integration_type"` // gmail, gdrive
Status SessionStatus `json:"status"`
Error string `json:"error,omitempty"`
ConnectionID string `json:"connection_id,omitempty"` // Set on success
ReturnTo string `json:"-"` // Optional redirect after callback
CreatedAt time.Time `json:"created_at"`
ExpiresAt time.Time `json:"expires_at"`
}
Session represents an OAuth session in progress
type SessionStatus ¶
type SessionStatus string
SessionStatus represents the state of an OAuth session
const ( StatusPending SessionStatus = "pending" StatusComplete SessionStatus = "complete" StatusError SessionStatus = "error" // DefaultSessionTTL is how long sessions live before cleanup DefaultSessionTTL = 10 * time.Minute )
type SlackProvider ¶
type SlackProvider struct {
// contains filtered or unexported fields
}
SlackProvider handles Slack OAuth operations for workspace integrations Implements the Provider interface
func NewSlackProvider ¶
func NewSlackProvider(cfg types.IntegrationSlackOAuth) *SlackProvider
NewSlackProvider creates a new Slack OAuth provider from config
func (*SlackProvider) AuthorizeURL ¶
func (s *SlackProvider) AuthorizeURL(state, integrationType string) (string, error)
AuthorizeURL generates the Slack OAuth authorization URL for an integration
func (*SlackProvider) Exchange ¶
func (s *SlackProvider) Exchange(ctx context.Context, code, integrationType string) (*types.IntegrationCredentials, error)
Exchange exchanges an authorization code for tokens
func (*SlackProvider) IsConfigured ¶
func (s *SlackProvider) IsConfigured() bool
IsConfigured returns true if Slack OAuth is configured
func (*SlackProvider) Refresh ¶
func (s *SlackProvider) Refresh(ctx context.Context, refreshToken string) (*types.IntegrationCredentials, error)
Refresh refreshes an access token using a refresh token Note: Slack user tokens don't typically expire
func (*SlackProvider) SupportsIntegration ¶
func (s *SlackProvider) SupportsIntegration(integrationType string) bool
SupportsIntegration returns true if this provider handles the given integration type
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store manages OAuth sessions in memory with TTL cleanup
func (*Store) GetByState ¶
GetByState retrieves a session by OAuth state parameter