integrations

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubWebhookProcessor

type GitHubWebhookProcessor struct{}

GitHubWebhookProcessor processes GitHub webhooks

func (*GitHubWebhookProcessor) ProcessWebhook

func (ghwp *GitHubWebhookProcessor) ProcessWebhook(ctx context.Context, payload []byte, headers map[string]string) (*WebhookResult, error)

ProcessWebhook processes a GitHub webhook

type Integration

type Integration struct {
	ID        string                 `json:"id"`
	Name      string                 `json:"name"`
	Type      string                 `json:"type"`     // webhook, api, sdk, etc.
	Provider  string                 `json:"provider"` // slack, teams, pagerduty, etc.
	Config    map[string]interface{} `json:"config"`
	Enabled   bool                   `json:"enabled"`
	Status    string                 `json:"status"` // active, inactive, error
	LastSync  time.Time              `json:"last_sync"`
	CreatedAt time.Time              `json:"created_at"`
	UpdatedAt time.Time              `json:"updated_at"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

Integration represents an external integration

type IntegrationConfig

type IntegrationConfig struct {
	MaxIntegrations     int           `json:"max_integrations"`
	SyncInterval        time.Duration `json:"sync_interval"`
	RetryAttempts       int           `json:"retry_attempts"`
	RetryDelay          time.Duration `json:"retry_delay"`
	Timeout             time.Duration `json:"timeout"`
	AutoSync            bool          `json:"auto_sync"`
	NotificationEnabled bool          `json:"notification_enabled"`
}

IntegrationConfig represents configuration for the integration manager

type IntegrationEvent

type IntegrationEvent struct {
	ID            string                 `json:"id"`
	IntegrationID string                 `json:"integration_id"`
	Type          string                 `json:"type"` // webhook, notification, sync, etc.
	Data          map[string]interface{} `json:"data"`
	Status        string                 `json:"status"` // pending, sent, failed, delivered
	Timestamp     time.Time              `json:"timestamp"`
	RetryCount    int                    `json:"retry_count"`
	Error         string                 `json:"error,omitempty"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
}

IntegrationEvent represents an integration event

type IntegrationManager

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

IntegrationManager manages external integrations

func NewIntegrationManager

func NewIntegrationManager() *IntegrationManager

NewIntegrationManager creates a new integration manager

func (*IntegrationManager) CreateIntegration

func (im *IntegrationManager) CreateIntegration(ctx context.Context, integration *Integration) error

CreateIntegration creates a new integration

func (*IntegrationManager) DeleteIntegration

func (im *IntegrationManager) DeleteIntegration(ctx context.Context, integrationID string) error

DeleteIntegration deletes an integration

func (*IntegrationManager) GetConfig

func (im *IntegrationManager) GetConfig() *IntegrationConfig

GetConfig returns the current integration manager configuration

func (*IntegrationManager) GetIntegration

func (im *IntegrationManager) GetIntegration(ctx context.Context, integrationID string) (*Integration, error)

GetIntegration retrieves an integration

func (*IntegrationManager) GetIntegrationStatus

func (im *IntegrationManager) GetIntegrationStatus(ctx context.Context) (*IntegrationStatus, error)

GetIntegrationStatus returns the status of all integrations

func (*IntegrationManager) ListIntegrations

func (im *IntegrationManager) ListIntegrations(ctx context.Context) ([]*Integration, error)

ListIntegrations lists all integrations

func (*IntegrationManager) SendEvent

func (im *IntegrationManager) SendEvent(ctx context.Context, integrationID string, event *IntegrationEvent) error

SendEvent sends an event to an integration

func (*IntegrationManager) SetConfig

func (im *IntegrationManager) SetConfig(config *IntegrationConfig)

SetConfig updates the integration manager configuration

func (*IntegrationManager) TestIntegration

func (im *IntegrationManager) TestIntegration(ctx context.Context, integrationID string) error

TestIntegration tests an integration

func (*IntegrationManager) UpdateIntegration

func (im *IntegrationManager) UpdateIntegration(ctx context.Context, integrationID string, updates *Integration) error

UpdateIntegration updates an integration

type IntegrationStatus

type IntegrationStatus struct {
	TotalIntegrations      int                    `json:"total_integrations"`
	ActiveIntegrations     int                    `json:"active_integrations"`
	InactiveIntegrations   int                    `json:"inactive_integrations"`
	ErrorIntegrations      int                    `json:"error_integrations"`
	IntegrationsByType     map[string]int         `json:"integrations_by_type"`
	IntegrationsByProvider map[string]int         `json:"integrations_by_provider"`
	LastSync               time.Time              `json:"last_sync"`
	Metadata               map[string]interface{} `json:"metadata,omitempty"`
}

IntegrationStatus represents the status of integrations

type PagerDutyWebhookProcessor

type PagerDutyWebhookProcessor struct{}

PagerDutyWebhookProcessor processes PagerDuty webhooks

func (*PagerDutyWebhookProcessor) ProcessWebhook

func (pdwp *PagerDutyWebhookProcessor) ProcessWebhook(ctx context.Context, payload []byte, headers map[string]string) (*WebhookResult, error)

ProcessWebhook processes a PagerDuty webhook

type SlackWebhookProcessor

type SlackWebhookProcessor struct{}

SlackWebhookProcessor processes Slack webhooks

func (*SlackWebhookProcessor) ProcessWebhook

func (swp *SlackWebhookProcessor) ProcessWebhook(ctx context.Context, payload []byte, headers map[string]string) (*WebhookResult, error)

ProcessWebhook processes a Slack webhook

type TeamsWebhookProcessor

type TeamsWebhookProcessor struct{}

TeamsWebhookProcessor processes Microsoft Teams webhooks

func (*TeamsWebhookProcessor) ProcessWebhook

func (twp *TeamsWebhookProcessor) ProcessWebhook(ctx context.Context, payload []byte, headers map[string]string) (*WebhookResult, error)

ProcessWebhook processes a Teams webhook

type WebhookConfig

type WebhookConfig struct {
	MaxHandlers       int           `json:"max_handlers"`
	Timeout           time.Duration `json:"timeout"`
	RetryAttempts     int           `json:"retry_attempts"`
	RetryDelay        time.Duration `json:"retry_delay"`
	ValidationEnabled bool          `json:"validation_enabled"`
	LoggingEnabled    bool          `json:"logging_enabled"`
}

WebhookConfig represents configuration for webhook handling

type WebhookHandler

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

WebhookHandler handles incoming webhooks

func NewWebhookHandler

func NewWebhookHandler() *WebhookHandler

NewWebhookHandler creates a new webhook handler

func (*WebhookHandler) GetConfig

func (wh *WebhookHandler) GetConfig() *WebhookConfig

GetConfig returns the current webhook handler configuration

func (*WebhookHandler) HandleHTTP

func (wh *WebhookHandler) HandleHTTP(w http.ResponseWriter, r *http.Request)

HandleHTTP handles HTTP webhook requests

func (*WebhookHandler) ProcessWebhook

func (wh *WebhookHandler) ProcessWebhook(ctx context.Context, webhookType string, payload []byte, headers map[string]string) (*WebhookResult, error)

ProcessWebhook processes an incoming webhook

func (*WebhookHandler) RegisterHandler

func (wh *WebhookHandler) RegisterHandler(webhookType string, processor WebhookProcessor) error

RegisterHandler registers a webhook processor

func (*WebhookHandler) SetConfig

func (wh *WebhookHandler) SetConfig(config *WebhookConfig)

SetConfig updates the webhook handler configuration

type WebhookProcessor

type WebhookProcessor interface {
	ProcessWebhook(ctx context.Context, payload []byte, headers map[string]string) (*WebhookResult, error)
}

WebhookProcessor represents a webhook processor

type WebhookResult

type WebhookResult struct {
	ID        string                 `json:"id"`
	Status    string                 `json:"status"` // success, error, ignored
	Message   string                 `json:"message"`
	Data      map[string]interface{} `json:"data,omitempty"`
	Timestamp time.Time              `json:"timestamp"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

WebhookResult represents the result of webhook processing

Jump to

Keyboard shortcuts

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