plugins

package
v0.0.0-...-2bd5d0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package plugins provides a provider registry for email-backed integrations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthSpec

type AuthSpec struct {
	Type                      AuthType `json:"type"`
	RequiredScopes            []string `json:"required_scopes"`
	RequiresCredentialsUpload bool     `json:"requires_credentials_upload"`
}

AuthSpec describes how a provider authenticates.

type AuthType

type AuthType string

AuthType describes how a provider authenticates.

const (
	// AuthTypeOAuth indicates the provider uses an OAuth2 flow (e.g. Gmail, ProtonMail).
	AuthTypeOAuth AuthType = "oauth"
	// AuthTypeConfig indicates the provider only requires local configuration (e.g. Thunderbird).
	AuthTypeConfig AuthType = "config"
)

type ConfigField

type ConfigField struct {
	Key       string `json:"name"` // serialized as "name" for frontend compatibility
	Label     string `json:"label"`
	Type      string `json:"type"` // "text", "password", "path", "thunderbird-profile", "thunderbird-mailboxes"
	Required  bool   `json:"required"`
	Help      string `json:"help,omitempty"`
	DependsOn string `json:"depends_on,omitempty"`
}

ConfigField describes a single user-provided configuration field for a plugin.

type GuideLink struct {
	Label string `json:"label"`
	URL   string `json:"url"`
}

GuideLink is an optional external link attached to a guide section.

type GuideNote

type GuideNote struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

GuideNote is a color-coded callout displayed below the guide sections. Type: "info" (blue), "warning" (amber), "tip" (green), "docker" (purple).

type GuideSection

type GuideSection struct {
	Title string      `json:"title"`
	Steps []GuideStep `json:"steps"`
	Link  *GuideLink  `json:"link,omitempty"`
}

GuideSection is a titled group of steps in the setup guide.

type GuideStep

type GuideStep struct {
	Text     string   `json:"text"`
	SubSteps []string `json:"sub_steps,omitempty"`
}

GuideStep is a single step in a guide section, with optional nested sub-steps.

type Provider

type Provider struct {
	Metadata ProviderMetadata

	NewReader        func(ProviderInput) (api.Reader, error)
	NewEmailSearcher func(ProviderInput) (api.EmailSearcher, error)
}

Provider defines an email provider and the capabilities it can construct.

type ProviderGuide

type ProviderGuide struct {
	Sections []GuideSection `json:"sections"`
	Notes    []GuideNote    `json:"notes,omitempty"`
}

ProviderGuide is the structured setup guide for a provider.

type ProviderInput

type ProviderInput struct {
	HTTPClient     *http.Client
	AppConfig      *config.App
	ReaderConfig   json.RawMessage
	Rules          []api.Rule
	Resolver       api.CategoryResolver
	StateManager   *state.Manager
	DiagnosticSink api.DiagnosticSink
	Logger         *slog.Logger
}

ProviderInput contains dependencies required to create provider capabilities.

type ProviderMetadata

type ProviderMetadata struct {
	Name         string          `json:"name"`
	Description  string          `json:"description"`
	Auth         AuthSpec        `json:"auth"`
	ConfigSchema []ConfigField   `json:"config_schema"`
	SetupGuide   json.RawMessage `json:"setup_guide,omitempty"`
}

ProviderMetadata describes a provider for catalog display and selection.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages available providers.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new provider registry.

func (*Registry) GetAllScopes

func (r *Registry) GetAllScopes(providerName string) ([]string, error)

GetAllScopes returns all OAuth scopes required by the given provider.

func (*Registry) GetProvider

func (r *Registry) GetProvider(name string) (Provider, error)

GetProvider returns a provider by name.

func (*Registry) ListProviders

func (r *Registry) ListProviders() []Provider

ListProviders returns all registered providers.

func (*Registry) RegisterProvider

func (r *Registry) RegisterProvider(provider Provider) error

RegisterProvider registers a provider.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL