api

package
v0.0.0-...-48d4ea4 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: GPL-3.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccountID

func GetAccountID(c *fiber.Ctx) (string, error)

GetAccountID extracts account ID from request context or user's account

func GetClientIP

func GetClientIP(c *fiber.Ctx) string

GetClientIP extracts the real client IP address from the request It checks X-Forwarded-For, X-Real-IP headers first, then falls back to c.IP()

func GetOrganizationID

func GetOrganizationID(c *fiber.Ctx) (string, error)

GetOrganizationID extracts organization ID from request context

func GetUserID

func GetUserID(c *fiber.Ctx) (string, error)

GetUserID extracts user ID from request context

Types

type APIKeyHandler

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

APIKeyHandler handles API key operations

func NewAPIKeyHandler

func NewAPIKeyHandler(service *services.APIKeyService) *APIKeyHandler

NewAPIKeyHandler creates new API key handler

func (*APIKeyHandler) Create

func (h *APIKeyHandler) Create(c *fiber.Ctx) error

Create creates new API key @Summary Create API key @Description Create a new API key for the authenticated account @Tags apikeys @Accept json @Produce json @Param request body CreateRequest true "API key creation request" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Security BearerAuth @Security ApiKeyAuth @Router /api/v1/apikeys [post]

func (*APIKeyHandler) Delete

func (h *APIKeyHandler) Delete(c *fiber.Ctx) error

Delete deletes API key @Summary Delete API key @Description Delete an API key permanently @Tags apikeys @Accept json @Produce json @Param id path string true "API key ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Security BearerAuth @Security ApiKeyAuth @Router /api/v1/apikeys/{id} [delete]

func (*APIKeyHandler) Disable

func (h *APIKeyHandler) Disable(c *fiber.Ctx) error

Disable disables API key @Summary Disable API key @Description Disable an active API key @Tags apikeys @Accept json @Produce json @Param id path string true "API key ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Security BearerAuth @Security ApiKeyAuth @Router /api/v1/apikeys/{id}/disable [put]

func (*APIKeyHandler) Enable

func (h *APIKeyHandler) Enable(c *fiber.Ctx) error

Enable enables API key @Summary Enable API key @Description Enable a disabled API key @Tags apikeys @Accept json @Produce json @Param id path string true "API key ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Security BearerAuth @Security ApiKeyAuth @Router /api/v1/apikeys/{id}/enable [put]

func (*APIKeyHandler) List

func (h *APIKeyHandler) List(c *fiber.Ctx) error

List lists all API keys for authenticated account @Summary List API keys @Description Get all API keys for the authenticated account @Tags apikeys @Accept json @Produce json @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Security BearerAuth @Security ApiKeyAuth @Router /api/v1/apikeys [get]

func (*APIKeyHandler) RegisterRoutes

func (h *APIKeyHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers API key routes

type AddCustomDomainRequest

type AddCustomDomainRequest struct {
	Domain string `json:"domain" validate:"required"`
}

AddCustomDomainRequest request body for adding custom domain

type AttachFileToTemplateRequest

type AttachFileToTemplateRequest struct {
	Type       string `json:"type" validate:"required,oneof=pdf"`
	FileBase64 string `json:"file_base64" validate:"required"`
	Append     bool   `json:"append,omitempty"`
}

AttachFileToTemplateRequest request body for attaching a file to an existing template

type AvailableLocales

type AvailableLocales struct {
	UILocales      map[string]string `json:"ui_locales"`      // 7 UI languages
	SigningLocales map[string]string `json:"signing_locales"` // 14 signing languages
}

AvailableLocales represents available locales

type BrandingHandler

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

BrandingHandler handles branding-related API requests

func NewBrandingHandler

func NewBrandingHandler(accountQueries *queries.AccountQueries, userQueries *queries.UserQueries, storage interface{}) *BrandingHandler

NewBrandingHandler creates a new branding handler

func (*BrandingHandler) AddCustomDomain

func (h *BrandingHandler) AddCustomDomain(c *fiber.Ctx) error

AddCustomDomain adds a custom domain @Summary Add custom domain @Description Adds a custom domain for white-label branding @Tags branding @Accept json @Produce json @Param body body AddCustomDomainRequest true "Domain configuration" @Success 200 {object} models.CustomDomain @Router /api/v1/branding/domain [post]

func (*BrandingHandler) DeleteAsset

func (h *BrandingHandler) DeleteAsset(c *fiber.Ctx) error

DeleteAsset deletes a branding asset @Summary Delete branding asset @Description Deletes a branding asset by ID @Tags branding @Produce json @Param id path string true "Asset ID" @Success 200 {object} map[string]any @Router /api/v1/branding/assets/:id [delete]

func (*BrandingHandler) GetBranding

func (h *BrandingHandler) GetBranding(c *fiber.Ctx) error

GetBranding returns current branding settings @Summary Get branding settings @Description Returns current account branding configuration @Tags branding @Produce json @Success 200 {object} models.BrandingSettings @Router /api/v1/branding [get]

func (*BrandingHandler) PreviewBranding

func (h *BrandingHandler) PreviewBranding(c *fiber.Ctx) error

PreviewBranding returns branding preview @Summary Preview branding @Description Returns preview of branding settings @Tags branding @Produce json @Success 200 {object} map[string]any @Router /api/v1/branding/preview [get]

func (*BrandingHandler) RegisterRoutes

func (h *BrandingHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all branding routes

func (*BrandingHandler) UpdateBranding

func (h *BrandingHandler) UpdateBranding(c *fiber.Ctx) error

UpdateBranding updates branding settings @Summary Update branding settings @Description Updates account branding configuration @Tags branding @Accept json @Produce json @Param body body UpdateBrandingSettingsRequest true "Branding settings" @Success 200 {object} map[string]any @Router /api/v1/branding [put]

func (*BrandingHandler) UploadAsset

func (h *BrandingHandler) UploadAsset(c *fiber.Ctx) error

UploadAsset uploads a branding asset @Summary Upload branding asset @Description Uploads logo, favicon, or other branding assets @Tags branding @Accept multipart/form-data @Produce json @Param type formData string true "Asset type (logo, favicon, email_header, watermark)" @Param file formData file true "Asset file" @Success 200 {object} models.BrandingAsset @Router /api/v1/branding/assets [post]

func (*BrandingHandler) VerifyCustomDomain

func (h *BrandingHandler) VerifyCustomDomain(c *fiber.Ctx) error

VerifyCustomDomain verifies a custom domain @Summary Verify custom domain @Description Verifies ownership of a custom domain @Tags branding @Produce json @Param domain_id path string true "Domain ID" @Success 200 {object} models.CustomDomain @Router /api/v1/branding/domain/:domain_id/verify [post]

type BulkCreateRequest

type BulkCreateRequest struct {
	TemplateID  string              `json:"template_id" validate:"required"`
	SigningMode models.SigningMode  `json:"signing_mode,omitempty"`
	Submitters  []SubmitterBulkData `json:"submitters" validate:"required,min=1"`
}

BulkCreateRequest request body for bulk creation

type BulkHandler

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

BulkHandler handles bulk operations

func NewBulkHandler

func NewBulkHandler(submissionSvc *submission.Service) *BulkHandler

NewBulkHandler creates a new bulk handler

func (*BulkHandler) BulkCreateSubmissions

func (h *BulkHandler) BulkCreateSubmissions(c *fiber.Ctx) error

BulkCreateSubmissions bulk creates submissions from CSV/XLSX @Summary Bulk create submissions @Description Create multiple submissions from CSV file @Tags Submissions @Accept multipart/form-data @Produce json @Param file formData file true "CSV file with submissions" @Param template_id formData string true "Template ID" @Param send_immediately formData boolean false "Send immediately after creation" @Success 200 {object} map[string]any "Success response with results" @Failure 400 {object} map[string]any "Bad request" @Failure 500 {object} map[string]any "Internal server error" @Router /api/v1/submissions/bulk [post]

func (*BulkHandler) RegisterRoutes

func (h *BulkHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers bulk operations routes

type BulkItemResult

type BulkItemResult struct {
	Row          int    `json:"row"`
	SubmissionID string `json:"submission_id,omitempty"`
	Status       string `json:"status"` // "success" or "failed"
	Error        string `json:"error,omitempty"`
}

BulkItemResult represents the result for a single record

type BulkResult

type BulkResult struct {
	Total   int              `json:"total"`
	Success int              `json:"success"`
	Failed  int              `json:"failed"`
	Results []BulkItemResult `json:"results"`
}

BulkResult represents the result of a bulk operation

type CloneRequest

type CloneRequest struct {
	TemplateID string `json:"template_id" validate:"required"`
	Name       string `json:"name,omitempty"`
}

CloneRequest request body for cloning template

type CompleteRequest

type CompleteRequest struct {
	SubmitterID string         `json:"submitter_id" validate:"required"`
	Fields      map[string]any `json:"fields" validate:"required"`
	Signature   SignatureData  `json:"signature,omitempty"`
}

CompleteRequest request body for completing signing

type CreateEmptyTemplateRequest

type CreateEmptyTemplateRequest struct {
	Name        string  `json:"name" validate:"required"`
	Description string  `json:"description,omitempty"`
	Category    *string `json:"category,omitempty"`
}

CreateEmptyTemplateRequest request body for creating empty template

type CreateFromTypeRequest

type CreateFromTypeRequest struct {
	Name        string         `json:"name" validate:"required"`
	Type        string         `json:"type" validate:"required,oneof=pdf html docx"`
	FileBase64  string         `json:"file_base64,omitempty"`
	FileURL     string         `json:"file_url,omitempty"`
	Description string         `json:"description,omitempty"`
	Category    *string        `json:"category,omitempty"`
	Settings    map[string]any `json:"settings,omitempty"`
}

CreateFromTypeRequest request body for creating template from file

type CreateRequest

type CreateRequest struct {
	Name      string `json:"name" validate:"required"`
	ExpiresAt *int64 `json:"expires_at,omitempty"` // Unix timestamp
}

CreateRequest represents API key creation request

type CreateSigningLinkRequest

type CreateSigningLinkRequest struct {
	TemplateID string `json:"template_id" validate:"required"`

	// Submitters count must match template submitters count.
	Submitters []SubmitterInput `json:"submitters" validate:"required,min=1"`

	// SigningMode: "sequential" or "parallel". Default "sequential".
	SigningMode string `json:"signing_mode,omitempty"`

	// Optional locale for the submission (used by i18n).
	Locale string `json:"locale,omitempty"`
}

type CreateSigningLinkResponse

type CreateSigningLinkResponse struct {
	SubmissionID string                 `json:"submission_id"`
	TemplateID   string                 `json:"template_id"`
	Links        []CreatedSubmitterLink `json:"links"`
}
type CreatedSubmitterLink struct {
	SubmitterID string `json:"submitter_id"`
	Slug        string `json:"slug"`
	DirectURL   string `json:"direct_url"` // "/s/:slug"
}

type DeclineRequest

type DeclineRequest struct {
	SubmitterID string `json:"submitter_id" validate:"required"`
	Reason      string `json:"reason,omitempty"`
}

DeclineRequest request body for declining

type DownloadGeoLite2FromMaxMindRequest

type DownloadGeoLite2FromMaxMindRequest struct {
	LicenseKey string `json:"license_key,omitempty"` // Optional: use from database if not provided
	Force      bool   `json:"force,omitempty"`
}

DownloadGeoLite2FromMaxMindRequest request body for downloading GeoLite2 from MaxMind

type DownloadGeoLite2FromURLRequest

type DownloadGeoLite2FromURLRequest struct {
	URL   string `json:"url" validate:"required,url"`
	Force bool   `json:"force,omitempty"`
}

DownloadGeoLite2FromURLRequest request body for downloading GeoLite2 from URL

type EmailTemplateHandler

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

EmailTemplateHandler handles email template API requests

func NewEmailTemplateHandler

func NewEmailTemplateHandler(emailTemplateQueries *queries.EmailTemplateQueries, userQueries *queries.UserQueries) *EmailTemplateHandler

NewEmailTemplateHandler creates a new email template handler

func (*EmailTemplateHandler) CreateEmailTemplate

func (h *EmailTemplateHandler) CreateEmailTemplate(c *fiber.Ctx) error

CreateEmailTemplate creates a new email template for the current organization or account @Summary Create email template @Description Creates a new email template for the current organization or account @Tags email-templates @Accept json @Produce json @Param body body models.EmailTemplateRequest true "Email template data" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/email-templates [post]

func (*EmailTemplateHandler) DeleteEmailTemplate

func (h *EmailTemplateHandler) DeleteEmailTemplate(c *fiber.Ctx) error

DeleteEmailTemplate deletes an email template @Summary Delete email template @Description Deletes an email template (non-system templates only) @Tags email-templates @Produce json @Param id path string true "Template ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/email-templates/{id} [delete]

func (*EmailTemplateHandler) GetAllEmailTemplates

func (h *EmailTemplateHandler) GetAllEmailTemplates(c *fiber.Ctx) error

GetAllEmailTemplates retrieves all email templates for the current scope (organization or account) @Summary Get all email templates @Description Returns all email templates for the current organization or account (and system templates) @Tags email-templates @Produce json @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/email-templates [get]

func (*EmailTemplateHandler) GetEmailTemplate

func (h *EmailTemplateHandler) GetEmailTemplate(c *fiber.Ctx) error

GetEmailTemplate retrieves a specific email template by name @Summary Get email template @Description Returns a specific email template by name for current organization or account @Tags email-templates @Produce json @Param name path string true "Template name" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/email-templates/{name} [get]

func (*EmailTemplateHandler) RegisterRoutes

func (h *EmailTemplateHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers email template routes

func (*EmailTemplateHandler) UpdateEmailTemplate

func (h *EmailTemplateHandler) UpdateEmailTemplate(c *fiber.Ctx) error

UpdateEmailTemplate updates an existing email template @Summary Update email template @Description Updates an existing email template (non-system templates only) @Tags email-templates @Accept json @Produce json @Param id path string true "Template ID" @Param body body models.EmailTemplateRequest true "Email template data" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/email-templates/{id} [put]

type EventHandler

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

EventHandler handles event requests

func NewEventHandler

func NewEventHandler(pool *pgxpool.Pool) *EventHandler

NewEventHandler creates new event handler

func (*EventHandler) List

func (h *EventHandler) List(c *fiber.Ctx) error

List returns paginated list of events @Summary List events @Tags events @Param limit query int false "Limit" default(10) @Param sort query string false "Sort" default(created_at:desc) @Produce json @Success 200 {object} map[string]any @Router /api/v1/events [get]

func (*EventHandler) RegisterRoutes

func (h *EventHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers event routes

type EventItem

type EventItem struct {
	ID           string `json:"id"`
	Type         string `json:"type"`
	Message      string `json:"message"`
	DocumentName string `json:"document_name,omitempty"`
	CreatedAt    string `json:"created_at"`
	IP           string `json:"ip,omitempty"`
	Location     string `json:"location,omitempty"`
	Reason       string `json:"reason,omitempty"`
}

type ExpireRequest

type ExpireRequest struct {
	SubmissionID string `json:"submission_id" validate:"required"`
}

ExpireRequest request body for expiring submission

type I18nHandler

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

I18nHandler handles i18n-related API requests

func NewI18nHandler

func NewI18nHandler(userQueries *queries.UserQueries, accountQueries *queries.AccountQueries) *I18nHandler

NewI18nHandler creates a new i18n handler

func (*I18nHandler) GetLocales

func (h *I18nHandler) GetLocales(c *fiber.Ctx) error

GetLocales returns available locales @Summary Get available locales @Description Returns list of available UI and signing portal locales @Tags i18n @Produce json @Success 200 {object} AvailableLocales @Router /api/v1/i18n/locales [get]

func (*I18nHandler) RegisterRoutes

func (h *I18nHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers i18n routes

func (*I18nHandler) UpdateAccountLocale

func (h *I18nHandler) UpdateAccountLocale(c *fiber.Ctx) error

UpdateAccountLocale updates account locale @Summary Update account locale @Description Updates the locale for the current account @Tags i18n @Accept json @Produce json @Param body body UpdateAccountLocaleRequest true "Locale update request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/account/locale [put]

func (*I18nHandler) UpdateUserLocale

func (h *I18nHandler) UpdateUserLocale(c *fiber.Ctx) error

UpdateUserLocale updates user's preferred locale @Summary Update user locale @Description Updates the preferred locale for the current user @Tags i18n @Accept json @Produce json @Param body body UpdateUserLocaleRequest true "Locale update request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/user/locale [put]

type InvitationHandler

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

InvitationHandler handles organization invitation-related requests

func NewInvitationHandler

func NewInvitationHandler(organizationQueries *queries.OrganizationQueries) *InvitationHandler

NewInvitationHandler creates a new invitation handler

func (*InvitationHandler) AcceptInvitation

func (h *InvitationHandler) AcceptInvitation(c *fiber.Ctx) error

AcceptInvitation accepts an organization invitation @Summary Accept invitation @Description Accept invitation to join organization using token @Tags organizations @Accept json @Produce json @Param token path string true "Invitation token" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Failure 409 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/invitations/{token}/accept [post]

func (*InvitationHandler) GetInvitationDetails

func (h *InvitationHandler) GetInvitationDetails(c *fiber.Ctx) error

GetInvitationDetails gets invitation details without accepting @Summary Get invitation details @Description Get invitation details using token (for preview before accepting) @Tags organizations @Produce json @Param token path string true "Invitation token" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/invitations/{token} [get]

func (*InvitationHandler) RegisterRoutes

func (h *InvitationHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all invitation routes

func (*InvitationHandler) RevokeInvitation

func (h *InvitationHandler) RevokeInvitation(c *fiber.Ctx) error

RevokeInvitation revokes an invitation (admin/owner only) @Summary Revoke invitation @Description Revoke pending invitation (admin/owner permissions required) @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Param invitation_id path string true "Invitation ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/invitations/{invitation_id} [delete]

type ListSigningLinksItem

type ListSigningLinksItem struct {
	SubmissionID   string                 `json:"submission_id"`
	TemplateID     string                 `json:"template_id"`
	TemplateName   string                 `json:"template_name"`
	CreatedAt      string                 `json:"created_at"`
	Status         string                 `json:"status"`
	CompletedCount int                    `json:"completed_count"`
	TotalCount     int                    `json:"total_count"`
	Submitters     []map[string]any       `json:"submitters"`
	Links          []CreatedSubmitterLink `json:"links"`
}

type MemberHandler

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

MemberHandler handles organization member-related requests

func NewMemberHandler

func NewMemberHandler(organizationQueries *queries.OrganizationQueries, userQueries *queries.UserQueries) *MemberHandler

NewMemberHandler creates a new member handler

func (*MemberHandler) GetOrganizationInvitations

func (h *MemberHandler) GetOrganizationInvitations(c *fiber.Ctx) error

GetOrganizationInvitations returns pending invitations for an organization @Summary Get invitations @Description Get pending invitations for organization @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/invitations [get]

func (*MemberHandler) GetOrganizationMembers

func (h *MemberHandler) GetOrganizationMembers(c *fiber.Ctx) error

GetOrganizationMembers returns all members of an organization @Summary Get organization members @Description Get all members of an organization @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/members [get]

func (*MemberHandler) InviteMember

func (h *MemberHandler) InviteMember(c *fiber.Ctx) error

InviteMember sends an invitation to join the organization @Summary Invite member @Description Send invitation to join organization @Tags organizations @Accept json @Produce json @Param organization_id path string true "Organization ID" @Param request body map[string]string true "Invitation data" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/members/invite [post]

func (*MemberHandler) RegisterRoutes

func (h *MemberHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all member routes

func (*MemberHandler) RemoveOrganizationMember

func (h *MemberHandler) RemoveOrganizationMember(c *fiber.Ctx) error

RemoveOrganizationMember removes a member from an organization @Summary Remove member @Description Remove a member from organization (admin/owner permissions required) @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Param member_id path string true "Member ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/members/{member_id} [delete]

func (*MemberHandler) RevokeInvitation

func (h *MemberHandler) RevokeInvitation(c *fiber.Ctx) error

RevokeInvitation revokes an invitation (admin/owner only) @Summary Revoke invitation @Description Revoke pending invitation (admin/owner permissions required) @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Param invitation_id path string true "Invitation ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/invitations/{invitation_id} [delete]

func (*MemberHandler) UpdateMemberRole

func (h *MemberHandler) UpdateMemberRole(c *fiber.Ctx) error

UpdateMemberRole updates a member's role in an organization @Summary Update member role @Description Update a member's role (admin/owner permissions required) @Tags organizations @Accept json @Produce json @Param organization_id path string true "Organization ID" @Param member_id path string true "Member ID" @Param request body map[string]string true "Role update data" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/members/{member_id}/role [put]

type OrganizationHandler

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

OrganizationHandler handles organization-related requests

func NewOrganizationHandler

func NewOrganizationHandler(organizationQueries *queries.OrganizationQueries, userQueries *queries.UserQueries) *OrganizationHandler

NewOrganizationHandler creates a new organization handler

func (*OrganizationHandler) CreateOrganization

func (h *OrganizationHandler) CreateOrganization(c *fiber.Ctx) error

CreateOrganization creates a new organization @Summary Create organization @Description Create a new organization and make the current user its owner @Tags organizations @Accept json @Produce json @Param request body models.Organization true "Organization data" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations [post]

func (*OrganizationHandler) DeleteOrganization

func (h *OrganizationHandler) DeleteOrganization(c *fiber.Ctx) error

DeleteOrganization deletes an organization (owner only) @Summary Delete organization @Description Delete organization (only owner can perform this action) @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id} [delete]

func (*OrganizationHandler) ExitOrganization

func (h *OrganizationHandler) ExitOrganization(c *fiber.Ctx) error

ExitOrganization switches the current user's context to personal account (no organization). Admin only. @Summary Exit organization context @Description Switch to personal account and get new access tokens (administrators only) @Tags organizations @Produce json @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/switch [post]

func (*OrganizationHandler) GetOrganization

func (h *OrganizationHandler) GetOrganization(c *fiber.Ctx) error

GetOrganization returns organization details @Summary Get organization @Description Get organization details by ID @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id} [get]

func (*OrganizationHandler) GetUserOrganizations

func (h *OrganizationHandler) GetUserOrganizations(c *fiber.Ctx) error

GetUserOrganizations returns organizations where the user is a member @Summary Get user organizations @Description Get all organizations where the current user is a member @Tags organizations @Produce json @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations [get]

func (*OrganizationHandler) RegisterRoutes

func (h *OrganizationHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all organization routes

func (*OrganizationHandler) SwitchOrganization

func (h *OrganizationHandler) SwitchOrganization(c *fiber.Ctx) error

SwitchOrganization switches the current user's context to a different organization. Admin only. @Summary Switch organization context @Description Switch to a different organization and get new access tokens (administrators only) @Tags organizations @Produce json @Param organization_id path string true "Organization ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id}/switch [post]

func (*OrganizationHandler) UpdateOrganization

func (h *OrganizationHandler) UpdateOrganization(c *fiber.Ctx) error

UpdateOrganization updates organization details @Summary Update organization @Description Update organization name and description @Tags organizations @Accept json @Produce json @Param organization_id path string true "Organization ID" @Param request body map[string]string true "Update data" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/organizations/{organization_id} [put]

type ResendRequest

type ResendRequest struct {
	SubmitterID string `json:"submitter_id" validate:"required"`
}

ResendRequest request body for resending

type ResourceHandler

type ResourceHandler[T any] struct {
	// contains filtered or unexported fields
}

ResourceHandler generic CRUD handler for resources

func NewResourceHandler

func NewResourceHandler[T any](resourceName string, repo ResourceRepository[T]) *ResourceHandler[T]

NewResourceHandler creates new generic handler

func (*ResourceHandler[T]) Create

func (h *ResourceHandler[T]) Create(c *fiber.Ctx) error

Create creates new resource @Summary Create resource @Tags {resourceName} @Accept json @Param body body T true "Resource data" @Success 201 {object} T @Failure 400 {object} map[string]any @Router /{resourceName} [post]

func (*ResourceHandler[T]) Delete

func (h *ResourceHandler[T]) Delete(c *fiber.Ctx) error

Delete deletes resource @Summary Delete resource @Tags {resourceName} @Param id path string true "Resource ID" @Success 204 "No content" @Failure 404 {object} map[string]any @Router /{resourceName}/{id} [delete]

func (*ResourceHandler[T]) Get

func (h *ResourceHandler[T]) Get(c *fiber.Ctx) error

Get returns resource by ID @Summary Get resource by ID @Tags {resourceName} @Param id path string true "Resource ID" @Success 200 {object} T @Failure 404 {object} map[string]any @Router /{resourceName}/{id} [get]

func (*ResourceHandler[T]) List

func (h *ResourceHandler[T]) List(c *fiber.Ctx) error

List returns paginated list of resources @Summary List resources @Tags {resourceName} @Param page query int false "Page number" default(1) @Param page_size query int false "Page size" default(20) @Success 200 {object} map[string]any @Router /{resourceName} [get]

func (*ResourceHandler[T]) RegisterRoutes

func (h *ResourceHandler[T]) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all CRUD routes for resource

func (*ResourceHandler[T]) Update

func (h *ResourceHandler[T]) Update(c *fiber.Ctx) error

Update updates resource @Summary Update resource @Tags {resourceName} @Accept json @Param id path string true "Resource ID" @Param body body T true "Resource data" @Success 200 {object} T @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /{resourceName}/{id} [put]

type ResourceRepository

type ResourceRepository[T any] interface {
	List(page, pageSize int, filters map[string]string) ([]T, int, error)
	Get(id string) (*T, error)
	Create(item *T) error
	Update(id string, item *T) error
	Delete(id string) error
}

ResourceRepository interface for working with resources

type SendRequest

type SendRequest struct {
	SubmissionID string `json:"submission_id" validate:"required"`
}

SendRequest request body for sending submission

type SettingsHandler

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

SettingsHandler handles requests to settings

func NewSettingsHandler

func NewSettingsHandler(notificationSvc *notification.Service, accountQueries *queries.AccountQueries, userQueries *queries.UserQueries, geolocationSvc *geolocation.Service, settingQueries *queries.SettingQueries) *SettingsHandler

NewSettingsHandler creates new handler

func (*SettingsHandler) DeleteGeolocationMaxMindKey

func (h *SettingsHandler) DeleteGeolocationMaxMindKey(c *fiber.Ctx) error

DeleteGeolocationMaxMindKey removes the saved MaxMind license key from account settings.

func (*SettingsHandler) DownloadGeoLite2FromMaxMind

func (h *SettingsHandler) DownloadGeoLite2FromMaxMind(c *fiber.Ctx) error

DownloadGeoLite2FromMaxMind downloads GeoLite2 database from MaxMind API @Summary Download GeoLite2 database from MaxMind @Description Downloads GeoLite2-City.mmdb from MaxMind using license key from database or request @Tags settings @Accept json @Produce json @Param body body DownloadGeoLite2FromMaxMindRequest false "Download request (license_key optional, uses saved key if not provided)" @Success 200 {object} map[string]any @Router /api/settings/geolocation/download-maxmind [post]

func (*SettingsHandler) DownloadGeoLite2FromURL

func (h *SettingsHandler) DownloadGeoLite2FromURL(c *fiber.Ctx) error

DownloadGeoLite2FromURL downloads GeoLite2 database from URL @Summary Download GeoLite2 database from URL @Description Downloads GeoLite2-City.mmdb from provided URL @Tags settings @Accept json @Produce json @Param body body DownloadGeoLite2FromURLRequest true "Download request" @Success 200 {object} map[string]any @Router /api/settings/geolocation/download [post]

func (*SettingsHandler) Get

func (h *SettingsHandler) Get(c *fiber.Ctx) error

Get returns current settings @Summary Get settings @Description Returns current application settings (global settings from DB, organization settings from account.settings) @Tags settings @Produce json @Success 200 {object} map[string]any @Router /api/settings [get]

func (*SettingsHandler) RegisterRoutes

func (h *SettingsHandler) RegisterRoutes(router fiber.Router)

func (*SettingsHandler) TestEmail

func (h *SettingsHandler) TestEmail(c *fiber.Ctx) error

TestEmail sends test email to verify SMTP settings @Summary Test email settings @Description Sends a test email to verify SMTP configuration @Tags settings @Accept json @Produce json @Param body body TestEmailRequest true "Email settings to test" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/settings/email/test [post]

func (*SettingsHandler) TestSMS

func (h *SettingsHandler) TestSMS(c *fiber.Ctx) error

func (*SettingsHandler) TestStorage

func (h *SettingsHandler) TestStorage(c *fiber.Ctx) error

TestStorage tests storage configuration @Summary Test storage settings @Description Tests storage configuration by creating, reading, and deleting a test file @Tags settings @Accept json @Produce json @Param body body TestStorageRequest true "Storage settings to test" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/settings/storage/test [post]

func (*SettingsHandler) UpdateBranding

func (h *SettingsHandler) UpdateBranding(c *fiber.Ctx) error

UpdateBranding updates branding settings (organization settings in account.settings) @Summary Update branding settings @Description Updates company branding configuration (organization-level settings) @Tags settings @Accept json @Produce json @Param body body UpdateBrandingRequest true "Branding settings" @Success 200 {object} map[string]any @Router /api/settings/branding [put]

func (*SettingsHandler) UpdateEmail

func (h *SettingsHandler) UpdateEmail(c *fiber.Ctx) error

UpdateEmail updates email settings (global settings in DB) @Summary Update email settings @Description Updates email/SMTP configuration (global settings) @Tags settings @Accept json @Produce json @Param body body UpdateEmailRequest true "Email settings" @Success 200 {object} map[string]any @Router /api/settings/email [put]

func (*SettingsHandler) UpdateGeolocation

func (h *SettingsHandler) UpdateGeolocation(c *fiber.Ctx) error

UpdateGeolocation updates geolocation settings (global settings in DB) @Summary Update geolocation settings @Description Updates geolocation download method and credentials - global settings @Tags settings @Accept json @Produce json @Param body body UpdateGeolocationRequest true "Geolocation settings" @Success 200 {object} map[string]any @Router /api/settings/geolocation [put]

func (*SettingsHandler) UpdateSMS

func (h *SettingsHandler) UpdateSMS(c *fiber.Ctx) error

func (*SettingsHandler) UpdateStorage

func (h *SettingsHandler) UpdateStorage(c *fiber.Ctx) error

UpdateStorage updates storage settings (global settings in DB) @Summary Update storage settings @Description Updates storage configuration (local, S3, GCS, Azure) - global settings @Tags settings @Accept json @Produce json @Param body body UpdateStorageRequest true "Storage settings" @Success 200 {object} map[string]any @Router /api/settings/storage [put]

type SignatureData

type SignatureData struct {
	ImageBase64 string  `json:"image_base64"` // Base64 encoded signature image
	X           float64 `json:"x"`
	Y           float64 `json:"y"`
	Width       float64 `json:"width"`
	Height      float64 `json:"height"`
	Page        int     `json:"page"`
}

SignatureData signature data

type SigningLinkDetail

type SigningLinkDetail struct {
	SubmissionID    string                 `json:"submission_id"`
	TemplateID      string                 `json:"template_id"`
	TemplateName    string                 `json:"template_name"`
	CreatedAt       string                 `json:"created_at"`
	CreatedIP       string                 `json:"created_ip,omitempty"`
	Status          string                 `json:"status"`
	CompletedCount  int                    `json:"completed_count"`
	TotalCount      int                    `json:"total_count"`
	Submitters      []map[string]any       `json:"submitters"`
	Links           []CreatedSubmitterLink `json:"links"`
	DeclineEvents   []map[string]any       `json:"decline_events,omitempty"`
	OpenedEvents    []map[string]any       `json:"opened_events,omitempty"`
	CompletedEvents []map[string]any       `json:"completed_events,omitempty"`
}

type SigningLinkHandler

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

SigningLinkHandler creates "direct link" signing flows (no email required). It is intentionally separate from generic CRUD because it needs to create both a submission and its submitter(s) and return the public signing URL.

func NewSigningLinkHandler

func NewSigningLinkHandler(pool *pgxpool.Pool, templateQueries *queries.TemplateQueries, completedDoc *services.CompletedDocumentBuilder) *SigningLinkHandler

func (*SigningLinkHandler) Create

func (h *SigningLinkHandler) Create(c *fiber.Ctx) error

Create creates a new submission and N submitters (defined by template), and returns public signing URLs.

@Summary Create direct signing link @Description Creates a submission without sending email and returns a unique signing link @Tags signing-links @Accept json @Produce json @Param body body CreateSigningLinkRequest true "Create signing link request" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/signing-links [post]

func (*SigningLinkHandler) DownloadCompletedDocument

func (h *SigningLinkHandler) DownloadCompletedDocument(c *fiber.Ctx) error

DownloadCompletedDocument downloads the final PDF for a completed submission. Only the creator of the submission can download it.

@Summary Download completed document @Tags signing-links @Produce application/pdf @Param submission_id path string true "Submission ID" @Success 200 {file} file @Failure 403 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/v1/signing-links/{submission_id}/document [get]

func (*SigningLinkHandler) Get

func (h *SigningLinkHandler) Get(c *fiber.Ctx) error

Get returns a single signing (submission) with signer details. It is used by the UI when opening a "status history" page.

Access control: - If user is in organization context -> allow access to submissions created from org templates. - Otherwise -> allow access only to submissions created by the user.

@Summary Get direct-link signing details @Tags signing-links @Produce json @Param submission_id path string true "Submission ID" @Success 200 {object} map[string]any @Router /api/v1/signing-links/{submission_id} [get]

func (*SigningLinkHandler) List

func (h *SigningLinkHandler) List(c *fiber.Ctx) error

List returns submissions created via direct-link flow, including signer status and links. @Summary List direct-link signings @Tags signing-links @Produce json @Param page query int false "Page number" default(1) @Param page_size query int false "Page size" default(20) @Success 200 {object} map[string]any @Router /api/v1/signing-links [get]

type StatsHandler

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

StatsHandler handles statistics requests

func NewStatsHandler

func NewStatsHandler(pool *pgxpool.Pool) *StatsHandler

NewStatsHandler creates new stats handler

func (*StatsHandler) Get

func (h *StatsHandler) Get(c *fiber.Ctx) error

Get returns dashboard statistics @Summary Get dashboard statistics @Tags stats @Produce json @Success 200 {object} map[string]any @Router /api/v1/stats [get]

func (*StatsHandler) RegisterRoutes

func (h *StatsHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers stats routes

type SubmissionHandler

type SubmissionHandler struct {
	*ResourceHandler[models.Submission] // embed generic CRUD
	// contains filtered or unexported fields
}

SubmissionHandler handles requests to submissions

func NewSubmissionHandler

func NewSubmissionHandler(repo ResourceRepository[models.Submission], submissionService *submission.Service) *SubmissionHandler

NewSubmissionHandler creates new handler

func (*SubmissionHandler) BulkCreate

func (h *SubmissionHandler) BulkCreate(c *fiber.Ctx) error

BulkCreate bulk creation submissions @Summary Bulk create submissions @Description Creates multiple submissions from a single template @Tags submissions @Accept json @Produce json @Param body body BulkCreateRequest true "Bulk create request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/submissions/bulk [post]

func (*SubmissionHandler) Expire

func (h *SubmissionHandler) Expire(c *fiber.Ctx) error

Expire marks submission as expired @Summary Expire submission @Description Marks a submission as expired @Tags submissions @Accept json @Produce json @Param body body ExpireRequest true "Expire request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/submissions/expire [post]

func (*SubmissionHandler) RegisterRoutes

func (h *SubmissionHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all routes for submissions

func (*SubmissionHandler) Send

func (h *SubmissionHandler) Send(c *fiber.Ctx) error

Send sends invitations to submitters @Summary Send submission invitations @Description Sends invitations to all submitters and changes submission status to in_progress @Tags submissions @Accept json @Produce json @Param body body SendRequest true "Send request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/submissions/send [post]

type SubmitterBulkData

type SubmitterBulkData struct {
	Name  string            `json:"name" validate:"required"`
	Email string            `json:"email" validate:"required,email"`
	Phone string            `json:"phone,omitempty"`
	Data  map[string]string `json:"data,omitempty"` // additional data for filling
}

SubmitterBulkData submitter data for bulk operation

type SubmitterHandler

type SubmitterHandler struct {
	*ResourceHandler[models.Submitter] // embed generic CRUD
	// contains filtered or unexported fields
}

SubmitterHandler handles requests to submitters

func NewSubmitterHandler

func NewSubmitterHandler(repo ResourceRepository[models.Submitter], submissionService *submission.Service) *SubmitterHandler

NewSubmitterHandler creates new handler

func (*SubmitterHandler) Complete

func (h *SubmitterHandler) Complete(c *fiber.Ctx) error

Complete completes signing for submitter @Summary Complete signing @Description Marks a submitter as completed and saves their data @Tags submitters @Accept json @Produce json @Param body body CompleteRequest true "Complete request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/submitters/complete [post]

func (*SubmitterHandler) Decline

func (h *SubmitterHandler) Decline(c *fiber.Ctx) error

Decline declines signing @Summary Decline signing @Description Marks a submitter as declined with optional reason @Tags submitters @Accept json @Produce json @Param body body DeclineRequest true "Decline request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/submitters/decline [post]

func (*SubmitterHandler) RegisterRoutes

func (h *SubmitterHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all routes for submitters

func (*SubmitterHandler) Resend

func (h *SubmitterHandler) Resend(c *fiber.Ctx) error

Resend resends invitation to submitter @Summary Resend invitation @Description Resends invitation email to a submitter @Tags submitters @Accept json @Produce json @Param body body ResendRequest true "Resend request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/submitters/resend [post]

type SubmitterInput

type SubmitterInput struct {
	Name  string `json:"name,omitempty"`
	Email string `json:"email,omitempty"`
	Phone string `json:"phone,omitempty"`
}

type TemplateHandler

type TemplateHandler struct {
	*ResourceHandler[models.Template] // embed generic CRUD
	// contains filtered or unexported fields
}

TemplateHandler handles requests to templates

func NewTemplateHandler

func NewTemplateHandler(repo ResourceRepository[models.Template], templateQueries *queries.TemplateQueries) *TemplateHandler

NewTemplateHandler creates new handler

func (*TemplateHandler) AddToFavorites

func (h *TemplateHandler) AddToFavorites(c *fiber.Ctx) error

AddToFavorites adds template to user's favorites @Summary Add to favorites @Description Add template to user's favorites @Tags templates @Accept json @Produce json @Param template_id body string true "Template ID" @Success 201 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 409 {object} map[string]any @Router /api/v1/templates/favorites [post]

func (*TemplateHandler) AttachFileToTemplate

func (h *TemplateHandler) AttachFileToTemplate(c *fiber.Ctx) error

AttachFileToTemplate attaches a file to an existing template (e.g., import PDF pages). Intended for: - "empty template" flow (append=false): set initial pages - "add pages" flow (append=true): append new pages to existing schema

@Summary Attach file to template @Description Attaches a PDF file to an existing template and updates its schema/documents @Tags templates @Accept json @Produce json @Param template_id path string true "Template ID" @Param body body AttachFileToTemplateRequest true "Attach file request" @Success 200 {object} models.Template @Failure 400 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/templates/{template_id}/from-file [post]

func (*TemplateHandler) Clone

func (h *TemplateHandler) Clone(c *fiber.Ctx) error

Clone clones existing template @Summary Clone template @Description Creates a copy of an existing template @Tags templates @Accept json @Produce json @Param body body CloneRequest true "Clone request" @Success 201 {object} models.Template @Failure 400 {object} map[string]any @Router /api/templates/clone [post]

func (*TemplateHandler) CreateEmptyTemplate

func (h *TemplateHandler) CreateEmptyTemplate(c *fiber.Ctx) error

CreateEmptyTemplate creates an empty template @Summary Create empty template @Description Creates a new empty template with default structure @Tags templates @Accept json @Produce json @Param body body CreateEmptyTemplateRequest true "Create empty template request" @Success 201 {object} models.Template @Failure 400 {object} map[string]any @Router /api/templates/empty [post]

func (*TemplateHandler) CreateFolder

func (h *TemplateHandler) CreateFolder(c *fiber.Ctx) error

CreateFolder creates a new template folder @Summary Create template folder @Description Create a new folder for organizing templates @Tags templates @Accept json @Produce json @Param body body map[string]string true "Folder data (name, parent_id)" @Success 201 {object} models.TemplateFolder @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Router /api/v1/templates/folders [post]

func (*TemplateHandler) CreateFromType

func (h *TemplateHandler) CreateFromType(c *fiber.Ctx) error

CreateFromType creates template from file of specific type @Summary Create template from file @Description Creates a template from PDF, HTML, or DOCX file @Tags templates @Accept json @Produce json @Param body body CreateFromTypeRequest true "Create from type request" @Success 201 {object} models.Template @Failure 400 {object} map[string]any @Router /api/templates/from-file [post]

func (*TemplateHandler) DeleteFolder

func (h *TemplateHandler) DeleteFolder(c *fiber.Ctx) error

DeleteFolder deletes a template folder @Summary Delete template folder @Description Delete folder and move templates to root @Tags templates @Param folder_id path string true "Folder ID" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Router /api/v1/templates/folders/{folder_id} [delete]

func (*TemplateHandler) GetFolders

func (h *TemplateHandler) GetFolders(c *fiber.Ctx) error

GetFolders returns user's template folders @Summary Get template folders @Description Get all folders for organizing templates @Tags templates @Produce json @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Router /api/v1/templates/folders [get]

func (*TemplateHandler) GetUserFavorites

func (h *TemplateHandler) GetUserFavorites(c *fiber.Ctx) error

GetUserFavorites returns user's favorite templates @Summary Get user favorites @Description Get user's favorite templates with pagination @Tags templates @Produce json @Param limit query int false "Limit (default 20, max 100)" @Param offset query int false "Offset for pagination" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/templates/favorites [get]

func (*TemplateHandler) MoveTemplate

func (h *TemplateHandler) MoveTemplate(c *fiber.Ctx) error

MoveTemplate moves a template to a different folder @Summary Move template to folder @Description Move template to a different folder or root @Tags templates @Accept json @Produce json @Param template_id path string true "Template ID" @Param body body map[string]string true "Move data (folder_id)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Router /api/v1/templates/{template_id}/move [put]

func (*TemplateHandler) RegisterRoutes

func (h *TemplateHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all routes for templates

func (*TemplateHandler) RemoveFromFavorites

func (h *TemplateHandler) RemoveFromFavorites(c *fiber.Ctx) error

RemoveFromFavorites removes template from user's favorites @Summary Remove from favorites @Description Remove template from user's favorites @Tags templates @Param template_id path string true "Template ID" @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/templates/favorites/{template_id} [delete]

func (*TemplateHandler) SearchTemplates

func (h *TemplateHandler) SearchTemplates(c *fiber.Ctx) error

SearchTemplates searches templates with filters @Summary Search templates @Description Search templates with filters, pagination and sorting @Tags templates @Accept json @Produce json @Param query query string false "Search query" @Param category query string false "Category filter" @Param tags query []string false "Tags filter (comma-separated)" @Param favorites query bool false "Show only favorites" @Param limit query int false "Limit (default 20, max 100)" @Param offset query int false "Offset for pagination" @Param sort_by query string false "Sort by field (name, created_at, updated_at)" @Param sort_order query string false "Sort order (asc, desc)" @Success 200 {object} queries.TemplateSearchResult @Failure 400 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/templates/search [get]

func (*TemplateHandler) UpdateFolder

func (h *TemplateHandler) UpdateFolder(c *fiber.Ctx) error

UpdateFolder updates a template folder @Summary Update template folder @Description Update folder name or parent folder @Tags templates @Accept json @Produce json @Param folder_id path string true "Folder ID" @Param body body map[string]string true "Folder data (name, parent_id)" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Failure 401 {object} map[string]any @Failure 404 {object} map[string]any @Router /api/v1/templates/folders/{folder_id} [put]

func (*TemplateHandler) UpdateTemplate

func (h *TemplateHandler) UpdateTemplate(c *fiber.Ctx) error

UpdateTemplate handles partial updates for template editor. This endpoint exists because the generic CRUD update cannot distinguish between "field not provided" and "provided empty/null", which is required to safely persist editor changes (schema/fields/submitters) without wiping other columns unintentionally.

func (*TemplateHandler) ValidateConditions

func (h *TemplateHandler) ValidateConditions(c *fiber.Ctx) error

ValidateConditions validates field conditions @Summary Validate conditions @Description Validates field conditions for logical errors @Tags templates @Accept json @Produce json @Param body body ValidateConditionsRequest true "Fields with conditions" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/v1/templates/:id/conditions/validate [post]

func (*TemplateHandler) ValidateFormula

func (h *TemplateHandler) ValidateFormula(c *fiber.Ctx) error

ValidateFormula validates formula syntax @Summary Validate formula @Description Validates formula syntax and field references @Tags templates @Accept json @Produce json @Param body body ValidateFormulaRequest true "Formula validation request" @Success 200 {object} map[string]any @Failure 400 {object} map[string]any @Router /api/v1/formulas/validate [post]

type TestEmailRequest

type TestEmailRequest struct {
	Provider  string `json:"provider"`
	SMTPHost  string `json:"smtp_host" validate:"required"`
	SMTPPort  string `json:"smtp_port" validate:"required"`
	SMTPUser  string `json:"smtp_user" validate:"required"`
	SMTPPass  string `json:"smtp_pass" validate:"required"`
	FromEmail string `json:"from_email" validate:"required,email"`
	FromName  string `json:"from_name"`
	ToEmail   string `json:"to_email" validate:"required,email"`
}

TestEmailRequest request body for testing email

type TestSMSRequest

type TestSMSRequest struct {
	ToPhone string `json:"to_phone" validate:"required"`
	Message string `json:"message,omitempty"`
}

type TestStorageRequest

type TestStorageRequest struct {
	Provider        string `json:"provider" validate:"required,oneof=local s3"`
	Bucket          string `json:"bucket,omitempty"`
	Region          string `json:"region,omitempty"`
	BasePath        string `json:"base_path,omitempty"`
	Endpoint        string `json:"endpoint,omitempty"`
	AccessKeyID     string `json:"access_key_id,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
}

TestStorageRequest request body for testing storage

type UpdateAccountLocaleRequest

type UpdateAccountLocaleRequest struct {
	Locale string `json:"locale" validate:"required,oneof=en ru es fr de it pt"`
}

UpdateAccountLocaleRequest request body for updating account locale

type UpdateBrandingRequest

type UpdateBrandingRequest struct {
	CompanyName    string `json:"company_name"`
	LogoURL        string `json:"logo_url"`
	PrimaryColor   string `json:"primary_color"`
	SecondaryColor string `json:"secondary_color"`
}

UpdateBrandingRequest request body for updating branding settings

type UpdateBrandingSettingsRequest

type UpdateBrandingSettingsRequest struct {
	Branding models.BrandingSettings `json:"branding"`
}

UpdateBrandingSettingsRequest request body for updating branding

type UpdateEmailRequest

type UpdateEmailRequest struct {
	// Accept both old and UI-friendly shapes.
	Provider string `json:"provider"`

	SMTPHost string `json:"smtp_host"`
	SMTPPort string `json:"smtp_port"`
	SMTPUser string `json:"smtp_user"`
	SMTPPass string `json:"smtp_pass,omitempty"` // optional - only if changing

	Host     string `json:"host"`
	Port     any    `json:"port"` // number or string from UI
	Username string `json:"username"`
	Password string `json:"password,omitempty"` // optional - only if changing

	FromEmail string `json:"from_email"`
	FromName  string `json:"from_name"`
}

UpdateEmailRequest request body for updating email settings

type UpdateGeolocationRequest

type UpdateGeolocationRequest struct {
	MaxMindLicenseKey string `json:"maxmind_license_key,omitempty"` // Optional: MaxMind license key
	DownloadURL       string `json:"download_url,omitempty"`        // Optional: Download URL
	DownloadMethod    string `json:"download_method,omitempty"`     // Optional: "maxmind" or "url"
}

RegisterRoutes registers all routes for settings UpdateGeolocationRequest request body for updating geolocation settings

type UpdateSMSRequest

type UpdateSMSRequest struct {
	TwilioEnabled    bool   `json:"twilio_enabled"`
	TwilioAccountSID string `json:"twilio_account_sid,omitempty"`
	TwilioAuthToken  string `json:"twilio_auth_token,omitempty"` // write-only
	TwilioFromNumber string `json:"twilio_from_number,omitempty"`
}

type UpdateStorageRequest

type UpdateStorageRequest struct {
	Provider        string `json:"provider" validate:"required,oneof=local s3 gcs azure"`
	Bucket          string `json:"bucket,omitempty"`
	Region          string `json:"region,omitempty"`
	BasePath        string `json:"base_path,omitempty"`
	Endpoint        string `json:"endpoint,omitempty"`
	AccessKeyID     string `json:"access_key_id,omitempty"`
	SecretAccessKey string `json:"secret_access_key,omitempty"`
}

UpdateStorageRequest request body for updating storage settings

type UpdateUserLocaleRequest

type UpdateUserLocaleRequest struct {
	Locale string `json:"locale" validate:"required,oneof=en ru es fr de it pt"`
}

UpdateUserLocaleRequest request body for updating user locale

type UploadAssetRequest

type UploadAssetRequest struct {
	Type string `json:"type" validate:"required,oneof=logo favicon email_header watermark"`
}

UploadAssetRequest request body for uploading asset

type UserHandler

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

UserHandler handles user-related API requests

func NewUserHandler

func NewUserHandler(userQueries *queries.UserQueries) *UserHandler

NewUserHandler creates a new user handler

func (*UserHandler) GetCurrentUser

func (h *UserHandler) GetCurrentUser(c *fiber.Ctx) error

GetCurrentUser returns current authenticated user's information @Summary Get current user @Description Get current authenticated user's profile information @Tags users @Produce json @Success 200 {object} map[string]any @Failure 401 {object} map[string]any @Failure 500 {object} map[string]any @Router /api/v1/users/me [get]

func (*UserHandler) RegisterRoutes

func (h *UserHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers user routes

type ValidateConditionsRequest

type ValidateConditionsRequest struct {
	Fields []models.Field `json:"fields" validate:"required"`
}

ValidateConditionsRequest request body for validating conditions

type ValidateFormulaRequest

type ValidateFormulaRequest struct {
	Formula string         `json:"formula" validate:"required"`
	Fields  []models.Field `json:"fields" validate:"required"`
}

ValidateFormulaRequest request body for validating formula

type WebhookHandler

type WebhookHandler struct {
	*ResourceHandler[models.Webhook] // embed generic CRUD
}

WebhookHandler handles requests to webhooks

func NewWebhookHandler

func NewWebhookHandler(repo ResourceRepository[models.Webhook]) *WebhookHandler

NewWebhookHandler creates new handler

func (*WebhookHandler) RegisterRoutes

func (h *WebhookHandler) RegisterRoutes(router fiber.Router)

RegisterRoutes registers all routes for webhooks Using only generic CRUD - no specific logic needed

Jump to

Keyboard shortcuts

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