plugin

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes(h *Handler) chi.Router

Types

type Handler

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

func NewHandler

func NewHandler(svc *Service, logger *zerolog.Logger) *Handler

func (*Handler) DeletePlugin

func (h *Handler) DeletePlugin(w http.ResponseWriter, r *http.Request)

func (*Handler) GetPlugin

func (h *Handler) GetPlugin(w http.ResponseWriter, r *http.Request)

func (*Handler) ListPlugins

func (h *Handler) ListPlugins(w http.ResponseWriter, r *http.Request)

func (*Handler) UpsertPlugin

func (h *Handler) UpsertPlugin(w http.ResponseWriter, r *http.Request)

type ListPluginsResponse

type ListPluginsResponse struct {
	Plugins []PluginResponse `json:"plugins"`
}

type Plugin

type Plugin struct {
	ID        uuid.UUID
	TeamID    uuid.UUID
	Type      PluginType
	Enabled   bool
	CreatedAt time.Time
	UpdatedAt time.Time
}

type PluginResponse

type PluginResponse struct {
	ID        string            `json:"id"`
	Type      string            `json:"type"`
	Enabled   bool              `json:"enabled"`
	Config    map[string]string `json:"config,omitempty"`
	UpdatedAt string            `json:"updated_at"`
}

type PluginType

type PluginType string
const (
	PluginTypeResend  PluginType = "resend"
	PluginTypeZenduty PluginType = "zenduty"
)

type Repository

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

func NewRepository

func NewRepository(dbExecutor db.DBTX, enc *crypto.Encryptor, logger *zerolog.Logger) *Repository

func (*Repository) Delete

func (r *Repository) Delete(ctx context.Context, teamID uuid.UUID, pluginType PluginType) error

func (*Repository) Get

func (r *Repository) Get(ctx context.Context, teamID uuid.UUID, pluginType PluginType) (Plugin, map[string]string, error)

func (*Repository) GetResendConfig

func (r *Repository) GetResendConfig(ctx context.Context, teamID uuid.UUID) (alert.ResendEmailConfig, bool, error)

GetResendConfig is called by the alert service at send-time. It satisfies the alert.PluginConfigGetter interface.

func (*Repository) GetZendutyConfig

func (r *Repository) GetZendutyConfig(ctx context.Context, teamID uuid.UUID) (alert.ZendutyConfig, bool, error)

GetZendutyConfig satisfies the alert.PluginConfigGetter interface.

func (*Repository) List

func (r *Repository) List(ctx context.Context, teamID uuid.UUID) ([]Plugin, error)

func (*Repository) Upsert

func (r *Repository) Upsert(ctx context.Context, teamID uuid.UUID, pluginType PluginType, enabled bool, configMap map[string]string) (Plugin, error)

type ResendConfig

type ResendConfig struct {
	APIKey          string   `json:"api_key"`
	SenderEmail     string   `json:"sender_email"`
	RecipientEmails []string `json:"recipient_emails"`
}

ResendConfig holds decrypted Resend credentials.

type Service

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

func NewService

func NewService(repo *Repository) *Service

func (*Service) DeletePlugin

func (s *Service) DeletePlugin(ctx context.Context, teamID uuid.UUID, pluginType PluginType) error

func (*Service) GetPlugin

func (s *Service) GetPlugin(ctx context.Context, teamID uuid.UUID, pluginType PluginType) (Plugin, map[string]string, error)

func (*Service) ListPlugins

func (s *Service) ListPlugins(ctx context.Context, teamID uuid.UUID) ([]Plugin, error)

func (*Service) UpsertPlugin

func (s *Service) UpsertPlugin(ctx context.Context, teamID uuid.UUID, pluginType PluginType, enabled bool, config map[string]string) (Plugin, error)

type UpsertPluginRequest

type UpsertPluginRequest struct {
	Enabled bool              `json:"enabled"`
	Config  map[string]string `json:"config"`
}

Jump to

Keyboard shortcuts

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