rest

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2026 License: Apache-2.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterPDFGenerationRoutes

func RegisterPDFGenerationRoutes(r chi.Router, api *PDFGenerationAPI)

RegisterPDFGenerationRoutes registers all PDF generation routes with the main router

func RegisterPDFGenerationRoutesWithDefaults

func RegisterPDFGenerationRoutesWithDefaults(r chi.Router)

RegisterPDFGenerationRoutesWithDefaults registers PDF generation routes with default configuration

func RegisterSimpleStructConverterRoutes

func RegisterSimpleStructConverterRoutes(mux *http.ServeMux, api *SimpleStructConverterAPI)

RegisterSimpleStructConverterRoutes registers all simple struct converter routes with the main router

func RegisterSimpleStructConverterRoutesWithDefaults

func RegisterSimpleStructConverterRoutesWithDefaults(mux *http.ServeMux)

RegisterSimpleStructConverterRoutesWithDefaults registers simple struct converter routes with default configuration

func RegisterStructConverterRoutes

func RegisterStructConverterRoutes(r chi.Router, api *StructConverterAPI)

RegisterStructConverterRoutes registers all struct converter routes with the main router

func RegisterStructConverterRoutesWithDefaults

func RegisterStructConverterRoutesWithDefaults(r chi.Router)

RegisterStructConverterRoutesWithDefaults registers struct converter routes with default configuration

Types

type AsyncPDFGenerationResponse

type AsyncPDFGenerationResponse struct {
	Success   bool   `json:"success"`
	RequestID string `json:"request_id"`
	Message   string `json:"message,omitempty"`
	StatusURL string `json:"status_url"`
	WatchMode bool   `json:"watch_mode,omitempty"` // Indicates if watch mode is active
}

AsyncPDFGenerationResponse represents the response for async PDF generation

type ConversionOptions

type ConversionOptions struct {
	TagName        string `json:"tag_name,omitempty"`
	DefaultFlatten bool   `json:"default_flatten,omitempty"`
	OmitEmpty      bool   `json:"omit_empty,omitempty"`
	TimeFormat     string `json:"time_format,omitempty"`
	DurationFormat string `json:"duration_format,omitempty"`
	SliceSeparator string `json:"slice_separator,omitempty"`
}

ConversionOptions represents conversion options

type ConvertStructRequest

type ConvertStructRequest struct {
	Data     interface{}            `json:"data"`
	Options  *ConversionOptions     `json:"options,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

ConvertStructRequest represents a request to convert a struct

type ConvertStructResponse

type ConvertStructResponse struct {
	Variables map[string]interface{} `json:"variables"`
	Metadata  map[string]interface{} `json:"metadata"`
	Success   bool                   `json:"success"`
	Message   string                 `json:"message,omitempty"`
}

ConvertStructResponse represents the response from struct conversion

type ConverterConfigResponse

type ConverterConfigResponse struct {
	TagName         string   `json:"tag_name"`
	DefaultFlatten  bool     `json:"default_flatten"`
	OmitEmpty       bool     `json:"omit_empty"`
	TimeFormat      string   `json:"time_format"`
	DurationFormat  string   `json:"duration_format"`
	SliceSeparator  string   `json:"slice_separator"`
	RegisteredTypes []string `json:"registered_types"`
	ConverterCount  int      `json:"converter_count"`
}

ConverterConfigResponse represents the current converter configuration

type ConverterInfo

type ConverterInfo struct {
	Type        string `json:"type"`
	CanConvert  bool   `json:"can_convert"`
	Description string `json:"description,omitempty"`
}

ConverterInfo represents information about a registered converter

type ConvertersListResponse

type ConvertersListResponse struct {
	Converters []ConverterInfo `json:"converters"`
	Count      int             `json:"count"`
}

ConvertersListResponse represents the list of registered converters

type EnginesResponse

type EnginesResponse struct {
	Engines []string `json:"engines"`
	Default string   `json:"default"`
}

EnginesResponse represents supported LaTeX engines

type FormatsResponse

type FormatsResponse struct {
	Formats []string `json:"formats"`
	Default string   `json:"default"`
}

FormatsResponse represents supported output formats

type GeneratedFile

type GeneratedFile struct {
	Type        string `json:"type"` // pdf, png, jpeg, svg
	Size        int64  `json:"size"`
	DownloadURL string `json:"download_url"`
	ExpiresAt   string `json:"expires_at,omitempty"`
}

GeneratedFile represents a generated file

type GenerationStatusResponse

type GenerationStatusResponse struct {
	RequestID string          `json:"request_id"`
	Status    string          `json:"status"`             // pending, processing, completed, failed
	Progress  int             `json:"progress,omitempty"` // 0-100
	Message   string          `json:"message,omitempty"`
	Files     []GeneratedFile `json:"files,omitempty"`
	Error     string          `json:"error,omitempty"`
}

GenerationStatusResponse represents the status of an async generation

type HealthResponse

type HealthResponse struct {
	Status    string `json:"status"`
	Timestamp string `json:"timestamp"`
	Version   string `json:"version"`
}

HealthResponse represents the health check response

type PDFGenerationAPI

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

PDFGenerationAPI provides REST endpoints for PDF generation functionality

func NewPDFGenerationAPI

func NewPDFGenerationAPI(cfg *config.Config) *PDFGenerationAPI

NewPDFGenerationAPI creates a new PDFGenerationAPI instance

func (*PDFGenerationAPI) DownloadFile

func (api *PDFGenerationAPI) DownloadFile(w http.ResponseWriter, r *http.Request)

DownloadFile downloads a generated file GET /api/v1/pdf/download/{requestId}

func (*PDFGenerationAPI) DownloadFileFormat

func (api *PDFGenerationAPI) DownloadFileFormat(w http.ResponseWriter, r *http.Request)

DownloadFileFormat downloads a generated file in specific format GET /api/v1/pdf/download/{requestId}/{format}

func (*PDFGenerationAPI) GeneratePDF

func (api *PDFGenerationAPI) GeneratePDF(w http.ResponseWriter, r *http.Request)

GeneratePDF generates a PDF synchronously POST /api/v1/pdf/generate

func (*PDFGenerationAPI) GeneratePDFAsync

func (api *PDFGenerationAPI) GeneratePDFAsync(w http.ResponseWriter, r *http.Request)

GeneratePDFAsync generates a PDF asynchronously POST /api/v1/pdf/generate/async

func (*PDFGenerationAPI) GeneratePDFFromStruct

func (api *PDFGenerationAPI) GeneratePDFFromStruct(w http.ResponseWriter, r *http.Request)

GeneratePDFFromStruct generates a PDF from a struct (converts struct to variables automatically) POST /api/v1/pdf/generate/from-struct

func (*PDFGenerationAPI) GetActiveWatchModes

func (api *PDFGenerationAPI) GetActiveWatchModes(w http.ResponseWriter, r *http.Request)

GetActiveWatchModes returns information about active watch modes GET /api/v1/pdf/watch

func (*PDFGenerationAPI) GetGenerationStatus

func (api *PDFGenerationAPI) GetGenerationStatus(w http.ResponseWriter, r *http.Request)

GetGenerationStatus gets the status of an async generation GET /api/v1/pdf/status/{requestId}

func (*PDFGenerationAPI) GetSupportedEngines

func (api *PDFGenerationAPI) GetSupportedEngines(w http.ResponseWriter, r *http.Request)

GetSupportedEngines returns supported LaTeX engines GET /api/v1/pdf/engines

func (*PDFGenerationAPI) GetSupportedFormats

func (api *PDFGenerationAPI) GetSupportedFormats(w http.ResponseWriter, r *http.Request)

GetSupportedFormats returns supported output formats GET /api/v1/pdf/formats

func (*PDFGenerationAPI) GetTemplateVariables

func (api *PDFGenerationAPI) GetTemplateVariables(w http.ResponseWriter, r *http.Request)

GetTemplateVariables extracts variables from a template GET /api/v1/pdf/templates/variables?template_path=...

func (*PDFGenerationAPI) HealthCheck

func (api *PDFGenerationAPI) HealthCheck(w http.ResponseWriter, r *http.Request)

HealthCheck provides a health check endpoint GET /api/v1/pdf/health

func (*PDFGenerationAPI) Routes

func (api *PDFGenerationAPI) Routes() chi.Router

Routes returns the chi router with all PDF generation endpoints

func (*PDFGenerationAPI) StopAllWatchModes

func (api *PDFGenerationAPI) StopAllWatchModes(w http.ResponseWriter, r *http.Request)

StopAllWatchModes stops all active watch modes DELETE /api/v1/pdf/watch

func (*PDFGenerationAPI) StopWatchMode

func (api *PDFGenerationAPI) StopWatchMode(w http.ResponseWriter, r *http.Request)

StopWatchMode stops a specific watch mode DELETE /api/v1/pdf/watch/{watchId}

func (*PDFGenerationAPI) ValidateTemplate

func (api *PDFGenerationAPI) ValidateTemplate(w http.ResponseWriter, r *http.Request)

ValidateTemplate validates a LaTeX template POST /api/v1/pdf/templates/validate

type PDFGenerationOptions

type PDFGenerationOptions struct {
	Engine       string                `json:"engine,omitempty"`        // pdflatex, xelatex, lualatex
	OutputFormat string                `json:"output_format,omitempty"` // pdf, png, jpeg, svg
	Conversion   RESTConversionOptions `json:"conversion,omitempty"`
	Debug        bool                  `json:"debug,omitempty"`
	Cleanup      bool                  `json:"cleanup,omitempty"`
	Timeout      int                   `json:"timeout,omitempty"`     // seconds
	WatchMode    bool                  `json:"watch_mode,omitempty"`  // Enable file watching
	Passes       int                   `json:"passes,omitempty"`      // Number of compilation passes (1-10)
	UseLatexmk   bool                  `json:"use_latexmk,omitempty"` // Whether to use latexmk
}

PDFGenerationOptions represents PDF generation options

type PDFGenerationRequest

type PDFGenerationRequest struct {
	TemplatePath string                 `json:"template_path"`
	Variables    map[string]interface{} `json:"variables"`
	Options      *PDFGenerationOptions  `json:"options,omitempty"`
}

PDFGenerationRequest represents a request to generate a PDF

type PDFGenerationResponse

type PDFGenerationResponse struct {
	Success     bool              `json:"success"`
	RequestID   string            `json:"request_id"`
	Message     string            `json:"message,omitempty"`
	Files       []GeneratedFile   `json:"files,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
	DownloadURL string            `json:"download_url,omitempty"`
	WatchMode   bool              `json:"watch_mode,omitempty"` // Indicates if watch mode is active
}

PDFGenerationResponse represents the response from PDF generation

type PDFGenerationStructRequest

type PDFGenerationStructRequest struct {
	TemplatePath string                `json:"template_path"`
	Data         interface{}           `json:"data"` // Struct to convert to variables
	Options      *PDFGenerationOptions `json:"options,omitempty"`
}

PDFGenerationStructRequest represents a request to generate a PDF from a struct

type PDFHealthResponse

type PDFHealthResponse struct {
	Status    string `json:"status"`
	Timestamp string `json:"timestamp"`
	Version   string `json:"version"`
}

PDFHealthResponse represents the health check response for PDF API

type PreviewRequest

type PreviewRequest struct {
	Data    interface{}        `json:"data"`
	Options *ConversionOptions `json:"options,omitempty"`
	Limit   int                `json:"limit,omitempty"`
}

PreviewRequest represents a request to preview conversion

type PreviewResponse

type PreviewResponse struct {
	Variables map[string]interface{} `json:"variables"`
	Count     int                    `json:"count"`
	Truncated bool                   `json:"truncated"`
	Message   string                 `json:"message,omitempty"`
}

PreviewResponse represents the response from preview conversion

type RESTConversionOptions

type RESTConversionOptions struct {
	DoConvert bool    `json:"do_convert,omitempty"`
	Format    string  `json:"format,omitempty"`  // png, jpeg, svg
	Quality   int     `json:"quality,omitempty"` // 1-100
	DPI       int     `json:"dpi,omitempty"`     // dots per inch
	Scale     float64 `json:"scale,omitempty"`   // scale factor
}

RESTConversionOptions represents conversion options for images in REST API

type SimpleConversionOptions

type SimpleConversionOptions struct {
	TagName        string `json:"tag_name,omitempty"`
	DefaultFlatten bool   `json:"default_flatten,omitempty"`
	OmitEmpty      bool   `json:"omit_empty,omitempty"`
	TimeFormat     string `json:"time_format,omitempty"`
	DurationFormat string `json:"duration_format,omitempty"`
	SliceSeparator string `json:"slice_separator,omitempty"`
}

SimpleConversionOptions represents conversion options

type SimpleConvertStructRequest

type SimpleConvertStructRequest struct {
	Data     interface{}              `json:"data"`
	Options  *SimpleConversionOptions `json:"options,omitempty"`
	Metadata map[string]interface{}   `json:"metadata,omitempty"`
}

SimpleConvertStructRequest represents a request to convert a struct

type SimpleConvertStructResponse

type SimpleConvertStructResponse struct {
	Variables map[string]interface{} `json:"variables"`
	Metadata  map[string]interface{} `json:"metadata"`
	Success   bool                   `json:"success"`
	Message   string                 `json:"message,omitempty"`
}

SimpleConvertStructResponse represents the response from struct conversion

type SimpleConverterConfigResponse

type SimpleConverterConfigResponse struct {
	TagName         string   `json:"tag_name"`
	DefaultFlatten  bool     `json:"default_flatten"`
	OmitEmpty       bool     `json:"omit_empty"`
	TimeFormat      string   `json:"time_format"`
	DurationFormat  string   `json:"duration_format"`
	SliceSeparator  string   `json:"slice_separator"`
	RegisteredTypes []string `json:"registered_types"`
	ConverterCount  int      `json:"converter_count"`
}

SimpleConverterConfigResponse represents the current converter configuration

type SimpleHealthResponse

type SimpleHealthResponse struct {
	Status    string `json:"status"`
	Timestamp string `json:"timestamp"`
	Version   string `json:"version"`
}

SimpleHealthResponse represents the health check response

type SimplePreviewRequest

type SimplePreviewRequest struct {
	Data    interface{}              `json:"data"`
	Options *SimpleConversionOptions `json:"options,omitempty"`
	Limit   int                      `json:"limit,omitempty"`
}

SimplePreviewRequest represents a request to preview conversion

type SimplePreviewResponse

type SimplePreviewResponse struct {
	Variables map[string]interface{} `json:"variables"`
	Count     int                    `json:"count"`
	Truncated bool                   `json:"truncated"`
	Message   string                 `json:"message,omitempty"`
}

SimplePreviewResponse represents the response from preview conversion

type SimpleStructConverterAPI

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

SimpleStructConverterAPI provides REST endpoints for struct conversion functionality using http.ServeMux

func NewSimpleStructConverterAPI

func NewSimpleStructConverterAPI() *SimpleStructConverterAPI

NewSimpleStructConverterAPI creates a new SimpleStructConverterAPI instance

func NewSimpleStructConverterAPIWithConverter

func NewSimpleStructConverterAPIWithConverter(conv *converter.StructConverter) *SimpleStructConverterAPI

NewSimpleStructConverterAPIWithConverter creates a new SimpleStructConverterAPI with a custom converter

func (*SimpleStructConverterAPI) ConvertStruct

func (api *SimpleStructConverterAPI) ConvertStruct(w http.ResponseWriter, r *http.Request)

ConvertStruct converts a struct to AutoPDF variables POST /api/v1/struct-converter/convert

func (*SimpleStructConverterAPI) ConvertStructFlattened

func (api *SimpleStructConverterAPI) ConvertStructFlattened(w http.ResponseWriter, r *http.Request)

ConvertStructFlattened converts a struct to flattened AutoPDF variables POST /api/v1/struct-converter/convert/flattened

func (*SimpleStructConverterAPI) ConvertStructForTemplate

func (api *SimpleStructConverterAPI) ConvertStructForTemplate(w http.ResponseWriter, r *http.Request)

ConvertStructForTemplate converts a struct optimized for template usage POST /api/v1/struct-converter/convert/template

func (*SimpleStructConverterAPI) GetConverterConfig

func (api *SimpleStructConverterAPI) GetConverterConfig(w http.ResponseWriter, r *http.Request)

GetConverterConfig returns the current converter configuration GET /api/v1/struct-converter/config

func (*SimpleStructConverterAPI) HealthCheck

func (api *SimpleStructConverterAPI) HealthCheck(w http.ResponseWriter, r *http.Request)

HealthCheck provides a health check endpoint GET /api/v1/struct-converter/health

func (*SimpleStructConverterAPI) PreviewConversion

func (api *SimpleStructConverterAPI) PreviewConversion(w http.ResponseWriter, r *http.Request)

PreviewConversion provides a preview of struct conversion with limited output POST /api/v1/struct-converter/preview

func (*SimpleStructConverterAPI) ValidateStruct

func (api *SimpleStructConverterAPI) ValidateStruct(w http.ResponseWriter, r *http.Request)

ValidateStruct validates a struct for conversion POST /api/v1/struct-converter/validate

type SimpleValidationRequest

type SimpleValidationRequest struct {
	Data interface{} `json:"data"`
}

SimpleValidationRequest represents a request to validate a struct

type SimpleValidationResponse

type SimpleValidationResponse struct {
	Valid    bool     `json:"valid"`
	Errors   []string `json:"errors,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
}

SimpleValidationResponse represents the response from struct validation

type StructConverterAPI

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

StructConverterAPI provides REST endpoints for struct conversion functionality

func NewStructConverterAPI

func NewStructConverterAPI() *StructConverterAPI

NewStructConverterAPI creates a new StructConverterAPI instance

func NewStructConverterAPIWithConverter

func NewStructConverterAPIWithConverter(conv *converter.StructConverter) *StructConverterAPI

NewStructConverterAPIWithConverter creates a new StructConverterAPI with a custom converter

func (*StructConverterAPI) ConvertStruct

func (api *StructConverterAPI) ConvertStruct(w http.ResponseWriter, r *http.Request)

ConvertStruct converts a struct to AutoPDF variables POST /api/v1/struct-converter/convert

func (*StructConverterAPI) ConvertStructFlattened

func (api *StructConverterAPI) ConvertStructFlattened(w http.ResponseWriter, r *http.Request)

ConvertStructFlattened converts a struct to flattened AutoPDF variables POST /api/v1/struct-converter/convert/flattened

func (*StructConverterAPI) ConvertStructForTemplate

func (api *StructConverterAPI) ConvertStructForTemplate(w http.ResponseWriter, r *http.Request)

ConvertStructForTemplate converts a struct optimized for template usage POST /api/v1/struct-converter/convert/template

func (*StructConverterAPI) GetConverterConfig

func (api *StructConverterAPI) GetConverterConfig(w http.ResponseWriter, r *http.Request)

GetConverterConfig returns the current converter configuration GET /api/v1/struct-converter/config

func (*StructConverterAPI) HealthCheck

func (api *StructConverterAPI) HealthCheck(w http.ResponseWriter, r *http.Request)

HealthCheck provides a health check endpoint GET /api/v1/struct-converter/health

func (*StructConverterAPI) ListConverters

func (api *StructConverterAPI) ListConverters(w http.ResponseWriter, r *http.Request)

ListConverters returns the list of registered converters GET /api/v1/struct-converter/converters

func (*StructConverterAPI) PreviewConversion

func (api *StructConverterAPI) PreviewConversion(w http.ResponseWriter, r *http.Request)

PreviewConversion provides a preview of struct conversion with limited output POST /api/v1/struct-converter/preview

func (*StructConverterAPI) RegisterConverter

func (api *StructConverterAPI) RegisterConverter(w http.ResponseWriter, r *http.Request)

RegisterConverter registers a new converter (placeholder - would need custom converter types) POST /api/v1/struct-converter/converters

func (*StructConverterAPI) Routes

func (api *StructConverterAPI) Routes() chi.Router

Routes returns the chi router with all struct converter endpoints

func (*StructConverterAPI) UnregisterConverter

func (api *StructConverterAPI) UnregisterConverter(w http.ResponseWriter, r *http.Request)

UnregisterConverter unregisters a converter DELETE /api/v1/struct-converter/converters/{type}

func (*StructConverterAPI) UpdateConverterConfig

func (api *StructConverterAPI) UpdateConverterConfig(w http.ResponseWriter, r *http.Request)

UpdateConverterConfig updates the converter configuration PUT /api/v1/struct-converter/config

func (*StructConverterAPI) ValidateStruct

func (api *StructConverterAPI) ValidateStruct(w http.ResponseWriter, r *http.Request)

ValidateStruct validates a struct for conversion POST /api/v1/struct-converter/validate

type TemplateValidationRequest

type TemplateValidationRequest struct {
	TemplatePath string `json:"template_path"`
}

TemplateValidationRequest represents a request to validate a template

type TemplateValidationResponse

type TemplateValidationResponse struct {
	Valid    bool     `json:"valid"`
	Errors   []string `json:"errors,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
}

TemplateValidationResponse represents the response from template validation

type TemplateVariablesResponse

type TemplateVariablesResponse struct {
	Variables []string `json:"variables"`
	Count     int      `json:"count"`
}

TemplateVariablesResponse represents template variables

type ValidationRequest

type ValidationRequest struct {
	Data interface{} `json:"data"`
}

ValidationRequest represents a request to validate a struct

type ValidationResponse

type ValidationResponse struct {
	Valid    bool     `json:"valid"`
	Errors   []string `json:"errors,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
}

ValidationResponse represents the response from struct validation

Jump to

Keyboard shortcuts

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