handler

package
v0.0.0-...-72cc51b Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 46 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIKeyHandler

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

APIKeyHandler handles CRUD operations for API keys.

func NewAPIKeyHandler

func NewAPIKeyHandler(svc *service.APIKeyService, ts port.TenantStore, ws port.WorkspaceStore) *APIKeyHandler

NewAPIKeyHandler creates a new APIKeyHandler.

func (*APIKeyHandler) Create

func (h *APIKeyHandler) Create(c *echo.Context) error

Create handles POST /tenants/:tenant_code/workspaces/:workspace_code/api-keys. Returns the full key ONLY on creation (never again).

func (*APIKeyHandler) List

func (h *APIKeyHandler) List(c *echo.Context) error

List handles GET /tenants/:tenant_code/workspaces/:workspace_code/api-keys. Paginated, NEVER shows key hash or full key.

func (*APIKeyHandler) Revoke

func (h *APIKeyHandler) Revoke(c *echo.Context) error

Revoke handles DELETE /tenants/:tenant_code/workspaces/:workspace_code/api-keys/:id.

type AdapterHandler

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

AdapterHandler handles CRUD operations for email adapters.

func NewAdapterHandler

NewAdapterHandler creates a new AdapterHandler.

func (*AdapterHandler) Create

func (h *AdapterHandler) Create(c *echo.Context) error

Create handles POST /tenants/:tenant_code/workspaces/:workspace_code/adapters.

func (*AdapterHandler) CreateGlobal

func (h *AdapterHandler) CreateGlobal(c *echo.Context) error

CreateGlobal handles POST /global/adapters.

func (*AdapterHandler) Get

func (h *AdapterHandler) Get(c *echo.Context) error

Get handles GET /tenants/:tenant_code/workspaces/:workspace_code/adapters/:id.

func (*AdapterHandler) GetGlobal

func (h *AdapterHandler) GetGlobal(c *echo.Context) error

GetGlobal handles GET /global/adapters/:id.

func (*AdapterHandler) GetWorkspaceAccess

func (h *AdapterHandler) GetWorkspaceAccess(c *echo.Context) error

GetWorkspaceAccess handles GET .../adapters/:id/workspace-access (workspace scope). Only tenant _system may manage shared access.

func (*AdapterHandler) List

func (h *AdapterHandler) List(c *echo.Context) error

List handles GET /tenants/:tenant_code/workspaces/:workspace_code/adapters.

func (*AdapterHandler) ListGlobal

func (h *AdapterHandler) ListGlobal(c *echo.Context) error

ListGlobal handles GET /global/adapters.

func (*AdapterHandler) SetAdapterAccessService

func (h *AdapterHandler) SetAdapterAccessService(accessSvc *service.AdapterAccessService)

SetAdapterAccessService wires adapter sharing rules without widening constructor churn.

func (*AdapterHandler) SetAuditStore

func (h *AdapterHandler) SetAuditStore(auditStore port.AuditLogStore)

SetAuditStore wires audit logging for shared-access mutations.

func (*AdapterHandler) SoftDelete

func (h *AdapterHandler) SoftDelete(c *echo.Context) error

SoftDelete handles DELETE /tenants/:tenant_code/workspaces/:workspace_code/adapters/:id.

func (*AdapterHandler) SoftDeleteGlobal

func (h *AdapterHandler) SoftDeleteGlobal(c *echo.Context) error

SoftDeleteGlobal handles DELETE /global/adapters/:id.

func (*AdapterHandler) TestConnection

func (h *AdapterHandler) TestConnection(c *echo.Context) error

TestConnection handles POST .../adapters/:id/test (workspace scope).

func (*AdapterHandler) TestConnectionGlobal

func (h *AdapterHandler) TestConnectionGlobal(c *echo.Context) error

TestConnectionGlobal handles POST /global/adapters/:id/test.

func (*AdapterHandler) Update

func (h *AdapterHandler) Update(c *echo.Context) error

Update handles PUT /tenants/:tenant_code/workspaces/:workspace_code/adapters/:id.

func (*AdapterHandler) UpdateGlobal

func (h *AdapterHandler) UpdateGlobal(c *echo.Context) error

UpdateGlobal handles PUT /global/adapters/:id.

func (*AdapterHandler) UpdateWorkspaceAccess

func (h *AdapterHandler) UpdateWorkspaceAccess(c *echo.Context) error

UpdateWorkspaceAccess handles PUT .../adapters/:id/workspace-access (workspace scope). Only tenant _system may manage shared access.

func (*AdapterHandler) ValidateSES

func (h *AdapterHandler) ValidateSES(c *echo.Context) error

ValidateSES handles POST .../adapters/validate-ses. Tests AWS credentials and checks permissions without creating any resources.

type AdapterSetupHandler

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

AdapterSetupHandler serves tracking setup guides and auto-provisioning for adapters.

func NewAdapterSetupHandler

func NewAdapterSetupHandler(as port.AdapterStore, ts port.TenantStore, ws port.WorkspaceStore, webhookURL string, provisioner *sesadapter.TrackingProvisioner, stepStore port.ProvisioningStepStore) *AdapterSetupHandler

NewAdapterSetupHandler creates a new AdapterSetupHandler.

func (*AdapterSetupHandler) AutoProvision

func (h *AdapterSetupHandler) AutoProvision(c *echo.Context) error

AutoProvision handles POST /adapters/:id/auto-provision-tracking (workspace scope).

func (*AdapterSetupHandler) AutoProvisionGlobal

func (h *AdapterSetupHandler) AutoProvisionGlobal(c *echo.Context) error

AutoProvisionGlobal handles POST /global/adapters/:id/auto-provision-tracking.

func (*AdapterSetupHandler) ProvisioningStatus

func (h *AdapterSetupHandler) ProvisioningStatus(c *echo.Context) error

ProvisioningStatus handles GET /adapters/:id/provisioning-status (workspace scope).

func (*AdapterSetupHandler) ProvisioningStatusGlobal

func (h *AdapterSetupHandler) ProvisioningStatusGlobal(c *echo.Context) error

ProvisioningStatusGlobal handles GET /global/adapters/:id/provisioning-status.

func (*AdapterSetupHandler) SetupGuide

func (h *AdapterSetupHandler) SetupGuide(c *echo.Context) error

SetupGuide handles GET /adapters/:id/setup-guide (workspace scope).

func (*AdapterSetupHandler) SetupGuideGlobal

func (h *AdapterSetupHandler) SetupGuideGlobal(c *echo.Context) error

SetupGuideGlobal handles GET /global/adapters/:id/setup-guide.

type AuditHandler

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

AuditHandler handles audit log query endpoints (OIDC management auth).

func NewAuditHandler

func NewAuditHandler(als port.AuditLogStore, ts port.TenantStore, ws port.WorkspaceStore) *AuditHandler

NewAuditHandler creates a new AuditHandler.

func (*AuditHandler) Query

func (h *AuditHandler) Query(c *echo.Context) error

Query handles GET /tenants/:tenant_code/workspaces/:workspace_code/audit-log.

func (*AuditHandler) QueryGlobal

func (h *AuditHandler) QueryGlobal(c *echo.Context) error

QueryGlobal handles GET /global/audit-log.

type ConfigHandler

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

ConfigHandler handles operations on the global configuration.

func NewConfigHandler

func NewConfigHandler(cs port.GlobalConfigStore, oidc OIDCInfo) *ConfigHandler

NewConfigHandler creates a new ConfigHandler.

func (*ConfigHandler) Get

func (h *ConfigHandler) Get(c *echo.Context) error

Get handles GET /api/v1/manage/config.

func (*ConfigHandler) Update

func (h *ConfigHandler) Update(c *echo.Context) error

Update handles PUT /api/v1/manage/config (partial update, nested format).

type DashboardHandler

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

DashboardHandler handles dashboard statistics endpoints (OIDC management auth).

func NewDashboardHandler

NewDashboardHandler creates a new DashboardHandler.

func (*DashboardHandler) Stats

func (h *DashboardHandler) Stats(c *echo.Context) error

Stats handles GET /tenants/:tenant_code/workspaces/:workspace_code/dashboard-stats.

func (*DashboardHandler) StatsGlobal

func (h *DashboardHandler) StatsGlobal(c *echo.Context) error

StatsGlobal handles GET /global/dashboard-stats.

func (*DashboardHandler) StatsTenant

func (h *DashboardHandler) StatsTenant(c *echo.Context) error

StatsTenant handles GET /tenants/:tenant_code/dashboard-stats.

type DataPlaneEmailHandler

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

DataPlaneEmailHandler handles API-key-scoped email query endpoints.

func NewDataPlaneEmailHandler

func NewDataPlaneEmailHandler(store port.EmailStore) *DataPlaneEmailHandler

NewDataPlaneEmailHandler creates a new DataPlaneEmailHandler.

func (*DataPlaneEmailHandler) Export

func (h *DataPlaneEmailHandler) Export(c *echo.Context) error

Export handles GET /api/v1/emails/export as CSV stream.

func (*DataPlaneEmailHandler) GetByTrackingID

func (h *DataPlaneEmailHandler) GetByTrackingID(c *echo.Context) error

GetByTrackingID handles GET /api/v1/emails/:tracking_id.

func (*DataPlaneEmailHandler) GetEvents

func (h *DataPlaneEmailHandler) GetEvents(c *echo.Context) error

GetEvents handles GET /api/v1/emails/:tracking_id/events.

func (*DataPlaneEmailHandler) List

List handles GET /api/v1/emails.

type EmailHandler

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

EmailHandler handles email query endpoints (OIDC management auth).

func NewEmailHandler

func NewEmailHandler(es port.EmailStore, ts port.TenantStore, ws port.WorkspaceStore) *EmailHandler

NewEmailHandler creates a new EmailHandler.

func (*EmailHandler) GetByTrackingID

func (h *EmailHandler) GetByTrackingID(c *echo.Context) error

GetByTrackingID handles GET /tenants/:tenant_code/workspaces/:workspace_code/emails/:tracking_id.

func (*EmailHandler) GetEvents

func (h *EmailHandler) GetEvents(c *echo.Context) error

GetEvents handles GET /tenants/:tenant_code/workspaces/:workspace_code/emails/:tracking_id/events.

func (*EmailHandler) List

func (h *EmailHandler) List(c *echo.Context) error

List handles GET /tenants/:tenant_code/workspaces/:workspace_code/emails.

type ExternalIntegrationHandler

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

ExternalIntegrationHandler exposes the bootstrap surface for embeddable external integrations.

func NewExternalIntegrationHandler

func NewExternalIntegrationHandler(
	store port.GlobalConfigStore,
	authMethods []port.ExternalAuthMethod,
	resolvers []port.ExternalWorkspaceResolver,
) *ExternalIntegrationHandler

NewExternalIntegrationHandler creates a new handler for the external surface.

func (*ExternalIntegrationHandler) AuthMethodByName

func (h *ExternalIntegrationHandler) AuthMethodByName(name string) (port.ExternalAuthMethod, bool)

AuthMethodByName returns a registered auth method by name.

func (*ExternalIntegrationHandler) Bootstrap

func (h *ExternalIntegrationHandler) Bootstrap(c *echo.Context) error

Bootstrap handles GET /api/v1/external/:profile_slug/bootstrap.

func (*ExternalIntegrationHandler) LoadProfileBySlug

LoadProfileBySlug returns an enabled external integration profile by slug.

func (*ExternalIntegrationHandler) ResolverByName

ResolverByName returns a registered workspace resolver by name.

func (*ExternalIntegrationHandler) Session

Session exposes the authenticated external embed runtime state so the UI can render the effective permissions and fallback mode without relying on management-only endpoints.

type HTTPSubscriptionConfirmer

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

HTTPSubscriptionConfirmer confirms SNS subscriptions by making an HTTP GET to the SubscribeURL.

func NewHTTPSubscriptionConfirmer

func NewHTTPSubscriptionConfirmer(client *http.Client) *HTTPSubscriptionConfirmer

NewHTTPSubscriptionConfirmer creates a new confirmer with the given HTTP client.

func (*HTTPSubscriptionConfirmer) ConfirmSubscription

func (c *HTTPSubscriptionConfirmer) ConfirmSubscription(ctx context.Context, subscribeURL string) error

ConfirmSubscription fetches the SubscribeURL to confirm the SNS subscription.

type HealthHandler

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

HealthHandler serves health check endpoints.

func NewHealthHandler

func NewHealthHandler(pinger Pinger, opts ...HealthOption) *HealthHandler

NewHealthHandler creates a HealthHandler. If pinger is nil, the DB check is skipped.

func (*HealthHandler) Health

func (h *HealthHandler) Health(c *echo.Context) error

Health handles GET /healthz. It checks DB connectivity and River queue status.

type HealthOption

type HealthOption func(*HealthHandler)

HealthOption configures optional HealthHandler dependencies.

func WithRiverChecker

func WithRiverChecker(rc RiverChecker) HealthOption

WithRiverChecker sets the River health checker.

type IdentityHandler

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

IdentityHandler handles adapter identity management endpoints.

func NewIdentityHandler

NewIdentityHandler creates a new IdentityHandler.

func (*IdentityHandler) Create

func (h *IdentityHandler) Create(c *echo.Context) error

Create handles POST .../adapters/:id/identities (workspace scope).

func (*IdentityHandler) CreateGlobal

func (h *IdentityHandler) CreateGlobal(c *echo.Context) error

CreateGlobal handles POST /global/adapters/:id/identities.

func (*IdentityHandler) Delete

func (h *IdentityHandler) Delete(c *echo.Context) error

Delete handles DELETE .../adapters/:id/identities/:identity_id (workspace scope).

func (*IdentityHandler) DeleteGlobal

func (h *IdentityHandler) DeleteGlobal(c *echo.Context) error

DeleteGlobal handles DELETE /global/adapters/:id/identities/:identity_id.

func (*IdentityHandler) GetWorkspaceAccess

func (h *IdentityHandler) GetWorkspaceAccess(c *echo.Context) error

GetWorkspaceAccess handles GET .../identities/:identity_id/workspace-access (workspace scope). Only tenant _system may manage SES identity sharing.

func (*IdentityHandler) List

func (h *IdentityHandler) List(c *echo.Context) error

List handles GET .../adapters/:id/identities (workspace scope).

func (*IdentityHandler) ListGlobal

func (h *IdentityHandler) ListGlobal(c *echo.Context) error

ListGlobal handles GET /global/adapters/:id/identities.

func (*IdentityHandler) SetAdapterAccessService

func (h *IdentityHandler) SetAdapterAccessService(accessSvc *service.AdapterAccessService)

SetAdapterAccessService wires workspace adapter/identity sharing behavior without widening constructor churn.

func (*IdentityHandler) SetAuditStore

func (h *IdentityHandler) SetAuditStore(auditStore port.AuditLogStore)

SetAuditStore wires audit logging for shared SES identity access mutations.

func (*IdentityHandler) SetDefault

func (h *IdentityHandler) SetDefault(c *echo.Context) error

SetDefault handles POST .../adapters/:id/identities/:identity_id/set-default (workspace scope).

func (*IdentityHandler) SetDefaultGlobal

func (h *IdentityHandler) SetDefaultGlobal(c *echo.Context) error

SetDefaultGlobal handles POST /global/adapters/:id/identities/:identity_id/set-default.

func (*IdentityHandler) Sync

func (h *IdentityHandler) Sync(c *echo.Context) error

Sync handles POST .../adapters/:id/identities/sync (workspace scope).

func (*IdentityHandler) SyncGlobal

func (h *IdentityHandler) SyncGlobal(c *echo.Context) error

SyncGlobal handles POST /global/adapters/:id/identities/sync.

func (*IdentityHandler) UpdateWorkspaceAccess

func (h *IdentityHandler) UpdateWorkspaceAccess(c *echo.Context) error

UpdateWorkspaceAccess handles PUT .../identities/:identity_id/workspace-access (workspace scope). Only tenant _system may manage SES identity sharing.

type InjectorHandler

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

InjectorHandler handles CRUD operations for injector definitions and values.

func NewInjectorHandler

NewInjectorHandler creates a new InjectorHandler.

func (*InjectorHandler) Create

func (h *InjectorHandler) Create(c *echo.Context) error

Create handles POST /tenants/:tenant_code/workspaces/:workspace_code/injectors.

func (*InjectorHandler) CreateGlobal

func (h *InjectorHandler) CreateGlobal(c *echo.Context) error

CreateGlobal handles POST /global/injectors.

func (*InjectorHandler) Delete

func (h *InjectorHandler) Delete(c *echo.Context) error

Delete handles DELETE /tenants/:tenant_code/workspaces/:workspace_code/injectors/:name.

func (*InjectorHandler) DeleteGlobal

func (h *InjectorHandler) DeleteGlobal(c *echo.Context) error

DeleteGlobal handles DELETE /global/injectors/:name.

func (*InjectorHandler) Get

func (h *InjectorHandler) Get(c *echo.Context) error

Get handles GET /tenants/:tenant_code/workspaces/:workspace_code/injectors/:name.

func (*InjectorHandler) GetGlobal

func (h *InjectorHandler) GetGlobal(c *echo.Context) error

GetGlobal handles GET /global/injectors/:name.

func (*InjectorHandler) List

func (h *InjectorHandler) List(c *echo.Context) error

List handles GET /tenants/:tenant_code/workspaces/:workspace_code/injectors.

func (*InjectorHandler) ListGlobal

func (h *InjectorHandler) ListGlobal(c *echo.Context) error

ListGlobal handles GET /global/injectors.

func (*InjectorHandler) SetValues

func (h *InjectorHandler) SetValues(c *echo.Context) error

SetValues handles PUT /tenants/:tenant_code/workspaces/:workspace_code/injectors/:name/values.

func (*InjectorHandler) Update

func (h *InjectorHandler) Update(c *echo.Context) error

Update handles PUT /tenants/:tenant_code/workspaces/:workspace_code/injectors/:name.

func (*InjectorHandler) UpdateField

func (h *InjectorHandler) UpdateField(c *echo.Context) error

UpdateField handles PUT /tenants/:tenant_code/workspaces/:workspace_code/injectors/:name/fields/:field_name.

func (*InjectorHandler) UpdateFieldGlobal

func (h *InjectorHandler) UpdateFieldGlobal(c *echo.Context) error

UpdateFieldGlobal handles PUT /global/injectors/:name/fields/:field_name.

func (*InjectorHandler) UpdateGlobal

func (h *InjectorHandler) UpdateGlobal(c *echo.Context) error

UpdateGlobal handles PUT /global/injectors/:name.

type MediaHandler

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

MediaHandler serves public media utility endpoints.

func NewMediaHandler

func NewMediaHandler(logger *slog.Logger, opts ...MediaHandlerOption) *MediaHandler

NewMediaHandler creates a new MediaHandler.

func (*MediaHandler) HandleVideoThumbnail

func (h *MediaHandler) HandleVideoThumbnail(c *echo.Context) error

HandleVideoThumbnail serves GET /public/video-thumbnail?url=<encoded-thumbnail-url>. It downloads the thumbnail, composites a play-button overlay, and returns a PNG. The result is cached in memory keyed by the raw thumbnail URL.

type MediaHandlerOption

type MediaHandlerOption func(*MediaHandler)

MediaHandlerOption configures optional MediaHandler settings.

func WithSkipSSRF

func WithSkipSSRF() MediaHandlerOption

WithSkipSSRF disables SSRF validation (for testing only).

type MemberHandler

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

MemberHandler handles CRUD operations for members and their roles.

func NewMemberHandler

func NewMemberHandler(ms port.MemberStore, ts port.TenantStore, ws port.WorkspaceStore) *MemberHandler

NewMemberHandler creates a new MemberHandler.

func (*MemberHandler) AddRole

func (h *MemberHandler) AddRole(c *echo.Context) error

AddRole handles POST /api/v1/manage/members/:member_id/roles.

func (*MemberHandler) AddRoleTenant

func (h *MemberHandler) AddRoleTenant(c *echo.Context) error

AddRoleTenant handles POST /api/v1/manage/tenants/:tenant_code/members/:member_id/roles.

func (*MemberHandler) AddRoleWorkspace

func (h *MemberHandler) AddRoleWorkspace(c *echo.Context) error

AddRoleWorkspace handles POST /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code/members/:member_id/roles.

func (*MemberHandler) Create

func (h *MemberHandler) Create(c *echo.Context) error

Create handles POST /api/v1/manage/members.

func (*MemberHandler) Get

func (h *MemberHandler) Get(c *echo.Context) error

Get handles GET /api/v1/manage/members/:member_id.

func (*MemberHandler) GetTenant

func (h *MemberHandler) GetTenant(c *echo.Context) error

GetTenant handles GET /api/v1/manage/tenants/:tenant_code/members/:member_id.

func (*MemberHandler) GetWorkspace

func (h *MemberHandler) GetWorkspace(c *echo.Context) error

GetWorkspace handles GET /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code/members/:member_id.

func (*MemberHandler) List

func (h *MemberHandler) List(c *echo.Context) error

List handles GET /api/v1/manage/members (paginated, with roles).

func (*MemberHandler) ListTenant

func (h *MemberHandler) ListTenant(c *echo.Context) error

ListTenant handles GET /api/v1/manage/tenants/:tenant_code/members.

func (*MemberHandler) ListWorkspace

func (h *MemberHandler) ListWorkspace(c *echo.Context) error

ListWorkspace handles GET /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code/members.

func (*MemberHandler) Me

func (h *MemberHandler) Me(c *echo.Context) error

Me handles GET /api/v1/members/me.

func (*MemberHandler) RemoveRole

func (h *MemberHandler) RemoveRole(c *echo.Context) error

RemoveRole handles DELETE /api/v1/manage/members/:member_id/roles/:role_id.

func (*MemberHandler) RemoveRoleTenant

func (h *MemberHandler) RemoveRoleTenant(c *echo.Context) error

RemoveRoleTenant handles DELETE /api/v1/manage/tenants/:tenant_code/members/:member_id/roles/:role_id.

func (*MemberHandler) RemoveRoleWorkspace

func (h *MemberHandler) RemoveRoleWorkspace(c *echo.Context) error

RemoveRoleWorkspace handles DELETE /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code/members/:member_id/roles/:role_id.

type OIDCInfo

type OIDCInfo struct {
	DiscoveryURL    string
	ClientID        string
	ClientSecretSet bool
}

OIDCInfo holds read-only OIDC configuration exposed in the config response.

type OnboardingHandler

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

OnboardingHandler handles the first-use onboarding endpoints.

func NewOnboardingHandler

func NewOnboardingHandler(svc *service.OnboardingService, verifier port.OIDCVerifier) *OnboardingHandler

NewOnboardingHandler creates a new OnboardingHandler.

func (*OnboardingHandler) Setup

func (h *OnboardingHandler) Setup(c *echo.Context) error

Setup handles POST /api/v1/onboarding/setup. Requires an OIDC bearer token but NOT an existing member record.

func (*OnboardingHandler) Status

func (h *OnboardingHandler) Status(c *echo.Context) error

Status handles GET /api/v1/onboarding/status (PUBLIC - no auth).

type Pinger

type Pinger interface {
	Ping(ctx context.Context) error
}

Pinger is satisfied by *pgxpool.Pool and allows testing without a real DB.

type RiverChecker

type RiverChecker interface {
	Healthy(ctx context.Context) error
}

RiverChecker exposes a method to verify the River job queue is operational. Satisfied by the river adapter Client (non-nil check + pool ping).

type SESWebhookHandler

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

SESWebhookHandler handles incoming SES event notifications via SNS. Route: POST /api/v1/webhooks/ses/inbound (NO AUTH — uses SNS signature verification).

func NewSESWebhookHandler

func NewSESWebhookHandler(
	processor *service.EventProcessor,
	verifier SNSVerifier,
	confirmer SubscriptionConfirmer,
	logger *slog.Logger,
	opts ...SESWebhookHandlerOption,
) *SESWebhookHandler

NewSESWebhookHandler creates a new SES webhook handler.

func (*SESWebhookHandler) HandleInbound

func (h *SESWebhookHandler) HandleInbound(c *echo.Context) error

HandleInbound processes incoming SNS messages for SES events.

type SESWebhookHandlerOption

type SESWebhookHandlerOption func(*SESWebhookHandler)

SESWebhookHandlerOption configures optional behavior for the SES webhook handler.

func WithSkipSignatureVerification

func WithSkipSignatureVerification(skip bool) SESWebhookHandlerOption

WithSkipSignatureVerification disables SNS signature verification. Intended only for isolated test harnesses that replay trusted envelopes.

type SNSVerifier

type SNSVerifier interface {
	Verify(message []byte) error
}

SNSVerifier verifies the authenticity of SNS messages.

type SendHandler

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

SendHandler handles the data-plane send endpoint (API Key auth).

func NewSendHandler

func NewSendHandler(ss sendService, batchMaxItems int) *SendHandler

NewSendHandler creates a new SendHandler.

func (*SendHandler) Send

func (h *SendHandler) Send(c *echo.Context) error

Send handles POST /api/v1/send. Accepts API Key auth -- workspace_id is resolved from the API key context.

func (*SendHandler) SendBatch

func (h *SendHandler) SendBatch(c *echo.Context) error

SendBatch handles POST /api/v1/send/batch. Accepts API Key auth -- workspace_id is resolved from the API key context.

type SubscriptionConfirmer

type SubscriptionConfirmer interface {
	ConfirmSubscription(ctx context.Context, subscribeURL string) error
}

SubscriptionConfirmer fetches a URL to confirm an SNS subscription. Abstracted for testability.

type SuppressionHandler

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

SuppressionHandler handles suppression list management (OIDC management auth).

func NewSuppressionHandler

func NewSuppressionHandler(ss port.SuppressionStore, ts port.TenantStore, ws port.WorkspaceStore) *SuppressionHandler

NewSuppressionHandler creates a new SuppressionHandler.

func (*SuppressionHandler) Add

func (h *SuppressionHandler) Add(c *echo.Context) error

Add handles POST /tenants/:tenant_code/workspaces/:workspace_code/suppression.

func (*SuppressionHandler) Check

func (h *SuppressionHandler) Check(c *echo.Context) error

Check handles GET /tenants/:tenant_code/workspaces/:workspace_code/suppression/:email.

func (*SuppressionHandler) Remove

func (h *SuppressionHandler) Remove(c *echo.Context) error

Remove handles DELETE /tenants/:tenant_code/workspaces/:workspace_code/suppression/:email.

IMPORTANT: SuppressionStore only has RemoveGlobal — no workspace-scoped remove. To prevent privilege escalation (workspace admin removing global suppressions), this endpoint requires superadmin role. When port.SuppressionStore gains a RemoveWorkspace method, this handler should be updated to use it for workspace-level callers.

type TemplateHandler

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

TemplateHandler handles template, version, locale CRUD, and MJML preview.

func NewTemplateHandler

func NewTemplateHandler(
	svc *service.TemplateService,
	store port.TemplateStore,
	ts port.TenantStore,
	ws port.WorkspaceStore,
	testSendSvc *service.TestSendService,
	sendSvc sendService,
	auditStore port.AuditLogStore,
	batchMaxItems int,
	injectorMerger *resolution.InjectorMerger,
	templateInvalidator resolvedTemplateInvalidator,
) *TemplateHandler

NewTemplateHandler creates a new TemplateHandler.

func (*TemplateHandler) BulkSend

func (h *TemplateHandler) BulkSend(c *echo.Context) error

BulkSend handles POST .../templates/:template_id/bulk-send.

func (*TemplateHandler) BulkSendConfig

func (h *TemplateHandler) BulkSendConfig(c *echo.Context) error

BulkSendConfig exposes server-side UI constraints for workspace-scoped template bulk sends.

func (*TemplateHandler) CloneVersion

func (h *TemplateHandler) CloneVersion(c *echo.Context) error

CloneVersion handles POST .../templates/:template_id/versions/:version_id/clone.

func (*TemplateHandler) CloneVersionGlobal

func (h *TemplateHandler) CloneVersionGlobal(c *echo.Context) error

CloneVersionGlobal handles POST /global/templates/:template_id/versions/:version_id/clone.

func (*TemplateHandler) CreateTemplate

func (h *TemplateHandler) CreateTemplate(c *echo.Context) error

CreateTemplate handles POST .../templates.

func (*TemplateHandler) CreateTemplateGlobal

func (h *TemplateHandler) CreateTemplateGlobal(c *echo.Context) error

CreateTemplateGlobal handles POST /global/templates.

func (*TemplateHandler) CreateVersion

func (h *TemplateHandler) CreateVersion(c *echo.Context) error

CreateVersion handles POST .../templates/:template_id/versions.

func (*TemplateHandler) DeleteLocale

func (h *TemplateHandler) DeleteLocale(c *echo.Context) error

DeleteLocale handles DELETE .../templates/:template_id/versions/:version_id/locales/:locale.

func (*TemplateHandler) DeleteTemplate

func (h *TemplateHandler) DeleteTemplate(c *echo.Context) error

DeleteTemplate handles DELETE .../templates/:template_id.

func (*TemplateHandler) DeleteVersion

func (h *TemplateHandler) DeleteVersion(c *echo.Context) error

DeleteVersion handles DELETE .../templates/:template_id/versions/:version_id.

func (*TemplateHandler) DisableTemplate

func (h *TemplateHandler) DisableTemplate(c *echo.Context) error

DisableTemplate handles POST .../templates/:template_id/disable.

func (*TemplateHandler) DisableTemplateGlobal

func (h *TemplateHandler) DisableTemplateGlobal(c *echo.Context) error

DisableTemplateGlobal handles POST /global/templates/:template_id/disable.

func (*TemplateHandler) EnableTemplate

func (h *TemplateHandler) EnableTemplate(c *echo.Context) error

EnableTemplate handles POST .../templates/:template_id/enable.

func (*TemplateHandler) EnableTemplateGlobal

func (h *TemplateHandler) EnableTemplateGlobal(c *echo.Context) error

EnableTemplateGlobal handles POST /global/templates/:template_id/enable.

func (*TemplateHandler) ForkTemplate

func (h *TemplateHandler) ForkTemplate(c *echo.Context) error

ForkTemplate handles POST .../templates/:template_id/fork.

func (*TemplateHandler) GetLocale

func (h *TemplateHandler) GetLocale(c *echo.Context) error

GetLocale handles GET .../templates/:template_id/versions/:version_id/locales/:locale.

func (*TemplateHandler) GetVersion

func (h *TemplateHandler) GetVersion(c *echo.Context) error

GetVersion handles GET .../templates/:template_id/versions/:version_id.

func (*TemplateHandler) ListByTemplateType

func (h *TemplateHandler) ListByTemplateType(c *echo.Context) error

ListByTemplateType handles GET .../template-types/:slug/templates.

func (*TemplateHandler) ListByTemplateTypeGlobal

func (h *TemplateHandler) ListByTemplateTypeGlobal(c *echo.Context) error

ListByTemplateTypeGlobal handles GET /global/template-types/:slug/templates.

func (*TemplateHandler) ListLocales

func (h *TemplateHandler) ListLocales(c *echo.Context) error

ListLocales handles GET .../templates/:template_id/versions/:version_id/locales.

func (*TemplateHandler) ListVersions

func (h *TemplateHandler) ListVersions(c *echo.Context) error

ListVersions handles GET .../templates/:template_id/versions.

func (*TemplateHandler) PreviewMJML

func (h *TemplateHandler) PreviewMJML(c *echo.Context) error

PreviewMJML handles POST .../templates/:template_id/preview-mjml.

func (*TemplateHandler) PublishVersion

func (h *TemplateHandler) PublishVersion(c *echo.Context) error

PublishVersion handles POST .../templates/:template_id/versions/:version_id/publish.

func (*TemplateHandler) SetLocale

func (h *TemplateHandler) SetLocale(c *echo.Context) error

SetLocale handles POST .../templates/:template_id/versions/:version_id/locales.

func (*TemplateHandler) TestSend

func (h *TemplateHandler) TestSend(c *echo.Context) error

TestSend handles POST .../templates/:template_id/test-send.

func (*TemplateHandler) UpdateLocale

func (h *TemplateHandler) UpdateLocale(c *echo.Context) error

UpdateLocale handles PUT .../templates/:template_id/versions/:version_id/locales/:locale.

func (*TemplateHandler) UpdateVersion

func (h *TemplateHandler) UpdateVersion(c *echo.Context) error

UpdateVersion handles PUT .../templates/:template_id/versions/:version_id.

type TemplateTypeHandler

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

TemplateTypeHandler handles CRUD operations for template types.

func NewTemplateTypeHandler

func NewTemplateTypeHandler(svc *service.TemplateTypeService, ts port.TenantStore, ws port.WorkspaceStore, invalidator templateTypeResolvedTemplateInvalidator) *TemplateTypeHandler

NewTemplateTypeHandler creates a new TemplateTypeHandler.

func (*TemplateTypeHandler) Create

func (h *TemplateTypeHandler) Create(c *echo.Context) error

Create handles POST /tenants/:tenant_code/workspaces/:workspace_code/template-types.

func (*TemplateTypeHandler) CreateGlobal

func (h *TemplateTypeHandler) CreateGlobal(c *echo.Context) error

CreateGlobal handles POST /global/template-types.

func (*TemplateTypeHandler) Delete

func (h *TemplateTypeHandler) Delete(c *echo.Context) error

Delete handles DELETE /tenants/:tenant_code/workspaces/:workspace_code/template-types/:slug.

func (*TemplateTypeHandler) DeleteGlobal

func (h *TemplateTypeHandler) DeleteGlobal(c *echo.Context) error

DeleteGlobal handles DELETE /global/template-types/:slug.

func (*TemplateTypeHandler) Get

Get handles GET /tenants/:tenant_code/workspaces/:workspace_code/template-types/:slug.

func (*TemplateTypeHandler) GetGlobal

func (h *TemplateTypeHandler) GetGlobal(c *echo.Context) error

GetGlobal handles GET /global/template-types/:slug.

func (*TemplateTypeHandler) List

func (h *TemplateTypeHandler) List(c *echo.Context) error

List handles GET /tenants/:tenant_code/workspaces/:workspace_code/template-types.

func (*TemplateTypeHandler) ListGlobal

func (h *TemplateTypeHandler) ListGlobal(c *echo.Context) error

ListGlobal handles GET /global/template-types.

func (*TemplateTypeHandler) SetAdapterAccessService

func (h *TemplateTypeHandler) SetAdapterAccessService(accessSvc *service.AdapterAccessService)

SetAdapterAccessService wires workspace adapter sharing validation without changing every constructor call site.

func (*TemplateTypeHandler) Update

func (h *TemplateTypeHandler) Update(c *echo.Context) error

Update handles PUT /tenants/:tenant_code/workspaces/:workspace_code/template-types/:slug.

func (*TemplateTypeHandler) UpdateGlobal

func (h *TemplateTypeHandler) UpdateGlobal(c *echo.Context) error

UpdateGlobal handles PUT /global/template-types/:slug.

type TenantHandler

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

TenantHandler handles CRUD operations for tenants.

func NewTenantHandler

func NewTenantHandler(ts port.TenantStore, ws port.WorkspaceStore, as port.AdapterStore) *TenantHandler

NewTenantHandler creates a new TenantHandler.

func (*TenantHandler) Create

func (h *TenantHandler) Create(c *echo.Context) error

Create handles POST /api/v1/manage/tenants.

func (*TenantHandler) GetByCode

func (h *TenantHandler) GetByCode(c *echo.Context) error

GetByCode handles GET /api/v1/manage/tenants/:tenant_code.

func (*TenantHandler) List

func (h *TenantHandler) List(c *echo.Context) error

List handles GET /api/v1/manage/tenants.

func (*TenantHandler) SoftDelete

func (h *TenantHandler) SoftDelete(c *echo.Context) error

SoftDelete handles DELETE /api/v1/manage/tenants/:tenant_code.

func (*TenantHandler) Update

func (h *TenantHandler) Update(c *echo.Context) error

Update handles PUT /api/v1/manage/tenants/:tenant_code.

type TrackingHandler

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

TrackingHandler serves the open-tracking pixel endpoint.

func NewTrackingHandler

func NewTrackingHandler(lifecycleCtx context.Context, es trackingEmailLookup, ep *service.EventProcessor, logger *slog.Logger) *TrackingHandler

NewTrackingHandler creates a new TrackingHandler. The lifecycleCtx should be the server's lifecycle context so background goroutines are cancelled on graceful shutdown rather than leaked.

func (*TrackingHandler) Drain

func (h *TrackingHandler) Drain()

Drain blocks until all in-flight open-tracking goroutines have finished. Call this during graceful shutdown after stopping new request acceptance.

func (*TrackingHandler) HandleOpen

func (h *TrackingHandler) HandleOpen(c *echo.Context) error

HandleOpen serves GET /t/o/:tracking_id — returns a 1x1 transparent GIF and records an "opened" event asynchronously.

Dedup: if the same tracking_id was already processed within the last 30 seconds, the goroutine is skipped to prevent goroutine floods from a single tracking_id. The pixel is always returned regardless.

type WebhookHandler

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

WebhookHandler handles CRUD operations for webhooks and test dispatch.

func NewWebhookHandler

NewWebhookHandler creates a new WebhookHandler.

func (*WebhookHandler) Create

func (h *WebhookHandler) Create(c *echo.Context) error

Create handles POST /tenants/:tenant_code/workspaces/:workspace_code/webhooks. Returns the secret ONLY on creation (never again).

func (*WebhookHandler) Delete

func (h *WebhookHandler) Delete(c *echo.Context) error

Delete handles DELETE /tenants/:tenant_code/workspaces/:workspace_code/webhooks/:id. Webhooks use hard delete (no hierarchy).

func (*WebhookHandler) Get

func (h *WebhookHandler) Get(c *echo.Context) error

Get handles GET /tenants/:tenant_code/workspaces/:workspace_code/webhooks/:id.

func (*WebhookHandler) List

func (h *WebhookHandler) List(c *echo.Context) error

List handles GET /tenants/:tenant_code/workspaces/:workspace_code/webhooks.

func (*WebhookHandler) Test

func (h *WebhookHandler) Test(c *echo.Context) error

Test handles POST /tenants/:tenant_code/workspaces/:workspace_code/webhooks/:id/test. Dispatches a webhook.test ping event to the specified webhook.

func (*WebhookHandler) Update

func (h *WebhookHandler) Update(c *echo.Context) error

Update handles PUT /tenants/:tenant_code/workspaces/:workspace_code/webhooks/:id.

type WorkspaceHandler

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

WorkspaceHandler handles CRUD operations for workspaces.

func NewWorkspaceHandler

func NewWorkspaceHandler(ts port.TenantStore, ws port.WorkspaceStore, emailStore port.EmailStore) *WorkspaceHandler

NewWorkspaceHandler creates a new WorkspaceHandler.

func (*WorkspaceHandler) Create

func (h *WorkspaceHandler) Create(c *echo.Context) error

Create handles POST /api/v1/manage/tenants/:tenant_code/workspaces.

func (*WorkspaceHandler) Get

func (h *WorkspaceHandler) Get(c *echo.Context) error

Get handles GET /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code.

func (*WorkspaceHandler) List

func (h *WorkspaceHandler) List(c *echo.Context) error

List handles GET /api/v1/manage/tenants/:tenant_code/workspaces.

func (*WorkspaceHandler) ResetRuntime

func (h *WorkspaceHandler) ResetRuntime(c *echo.Context) error

ResetRuntime handles POST /api/v1/manage/environments/:environment/tenants/:tenant_code/workspaces/:workspace_code/runtime/reset.

func (*WorkspaceHandler) SoftDelete

func (h *WorkspaceHandler) SoftDelete(c *echo.Context) error

SoftDelete handles DELETE /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code.

func (*WorkspaceHandler) Update

func (h *WorkspaceHandler) Update(c *echo.Context) error

Update handles PUT /api/v1/manage/tenants/:tenant_code/workspaces/:workspace_code.

type WorkspacePolicyHandler

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

func (*WorkspacePolicyHandler) Get

func (*WorkspacePolicyHandler) Update

func (h *WorkspacePolicyHandler) Update(c *echo.Context) error

type WorkspacePolicyResponse

type WorkspacePolicyResponse struct {
	AllowWorkspaceLocalTemplates         bool `json:"allow_workspace_local_templates"`
	AllowWorkspaceInheritedTemplateForks bool `json:"allow_workspace_inherited_template_forks"`
	AllowWorkspaceLocalInjectors         bool `json:"allow_workspace_local_injectors"`
}

WorkspacePolicyResponse exposes tenant-local workspace policies stored on the _system workspace.

Jump to

Keyboard shortcuts

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