api

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package api provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.7.0 DO NOT EDIT.

Index

Constants

View Source
const (
	DefaultLimit = 100
	MaxLimit     = 1000
)

Pagination defaults and limits.

View Source
const (
	BearerAuthScopes bearerAuthContextKey = "BearerAuth.Scopes"
)

Variables

This section is empty.

Functions

func AuthMiddleware deprecated

func AuthMiddleware(apiKey string, next http.Handler) http.Handler

AuthMiddleware returns an http.Handler that requires a valid API key in the Authorization header (Bearer token) for all endpoints except /health. If apiKey is empty, authentication is disabled (pass-through).

Deprecated: Use MultiKeyAuthMiddleware for new code. This remains for backward compatibility during transition.

func BodySizeLimitMiddleware

func BodySizeLimitMiddleware(next http.Handler) http.Handler

BodySizeLimitMiddleware limits request body size to prevent DoS via large payloads.

func CORSMiddleware

func CORSMiddleware(allowedOrigins string, next http.Handler) http.Handler

CORSMiddleware adds CORS headers. If allowedOrigins is empty, CORS headers are not set (pass-through). Supports preflight OPTIONS requests.

func GetSpec

func GetSpec() (swagger *openapi3.T, err error)

GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.

func GetSpecJSON

func GetSpecJSON() ([]byte, error)

GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.

func GetSwagger deprecated

func GetSwagger() (*openapi3.T, error)

GetSwagger returns the OpenAPI specification corresponding to the generated code in this file.

Deprecated: GetSwagger predates kin-openapi renaming openapi3.Swagger to openapi3.T. Use GetSpec instead. This wrapper is retained for backwards compatibility.

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func MultiKeyAuthMiddleware

func MultiKeyAuthMiddleware(
	ctx context.Context,
	keyRepo domain.APIKeyRepository,
	fallbackKey string,
	next http.Handler,
) http.Handler

MultiKeyAuthMiddleware performs multi-key authentication with SHA-256 lookup. It also supports the legacy single API_KEY env var as a fallback.

  • Exempt paths: /health, /mcp (SSE transport, future use)
  • If a matching key is found via the repository, the key's namespace is injected into the request context.
  • If the legacy fallbackKey matches, namespace "default" is used.
  • If neither matches, 401 is returned.
  • last_used_at is tracked with in-process debounce (dirty map + background flush).

func NamespaceRateLimitMiddleware

func NamespaceRateLimitMiddleware(ratePerSecond int, next http.Handler) http.Handler

NamespaceRateLimitMiddleware limits requests per namespace using a token bucket. ratePerSecond is the sustained request rate per namespace. Requests without a namespace in context (exempt paths) pass through. Health and metrics endpoints are exempt.

func PathToRawSpec

func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)

Constructs a synthetic filesystem for resolving external references when loading openapi specifications.

func RateLimitMiddleware

func RateLimitMiddleware(ratePerSecond int, next http.Handler) http.Handler

RateLimitMiddleware limits requests per IP using a simple token bucket. ratePerSecond is the sustained request rate; burst allows short spikes. Health checks (/health) are exempt from rate limiting.

Types

type APIKeyId

type APIKeyId = openapi_types.UUID

APIKeyId defines model for APIKeyId.

type APIKeyInfo

type APIKeyInfo struct {
	CreatedAt  time.Time          `json:"created_at"`
	Enabled    bool               `json:"enabled"`
	Id         openapi_types.UUID `json:"id"`
	Label      string             `json:"label"`
	LastUsedAt *time.Time         `json:"last_used_at,omitempty"`
	Namespace  string             `json:"namespace"`
}

APIKeyInfo defines model for APIKeyInfo.

type AckExecution204Response

type AckExecution204Response struct {
}

func (AckExecution204Response) VisitAckExecutionResponse

func (response AckExecution204Response) VisitAckExecutionResponse(w http.ResponseWriter) error

type AckExecution404JSONResponse

type AckExecution404JSONResponse Error

func (AckExecution404JSONResponse) VisitAckExecutionResponse

func (response AckExecution404JSONResponse) VisitAckExecutionResponse(w http.ResponseWriter) error

type AckExecutionRequestObject

type AckExecutionRequestObject struct {
	Id ExecutionId `json:"id"`
}

type AckExecutionResponseObject

type AckExecutionResponseObject interface {
	VisitAckExecutionResponse(w http.ResponseWriter) error
}

type CreateAPIKey201JSONResponse

type CreateAPIKey201JSONResponse CreateAPIKeyResponse

func (CreateAPIKey201JSONResponse) VisitCreateAPIKeyResponse

func (response CreateAPIKey201JSONResponse) VisitCreateAPIKeyResponse(w http.ResponseWriter) error

type CreateAPIKeyJSONRequestBody

type CreateAPIKeyJSONRequestBody = CreateAPIKeyRequest

CreateAPIKeyJSONRequestBody defines body for CreateAPIKey for application/json ContentType.

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	Label     string `json:"label"`
	Namespace string `json:"namespace"`
}

CreateAPIKeyRequest defines model for CreateAPIKeyRequest.

type CreateAPIKeyRequestObject

type CreateAPIKeyRequestObject struct {
	Body *CreateAPIKeyJSONRequestBody
}

type CreateAPIKeyResponse

type CreateAPIKeyResponse struct {
	CreatedAt time.Time          `json:"created_at"`
	Id        openapi_types.UUID `json:"id"`
	Label     string             `json:"label"`
	Namespace string             `json:"namespace"`

	// Token Plaintext token. Only returned on creation.
	Token string `json:"token"`
}

CreateAPIKeyResponse defines model for CreateAPIKeyResponse.

type CreateAPIKeyResponseObject

type CreateAPIKeyResponseObject interface {
	VisitCreateAPIKeyResponse(w http.ResponseWriter) error
}

type CreateJob201JSONResponse

type CreateJob201JSONResponse JobDetail

func (CreateJob201JSONResponse) VisitCreateJobResponse

func (response CreateJob201JSONResponse) VisitCreateJobResponse(w http.ResponseWriter) error

type CreateJob422JSONResponse

type CreateJob422JSONResponse Error

func (CreateJob422JSONResponse) VisitCreateJobResponse

func (response CreateJob422JSONResponse) VisitCreateJobResponse(w http.ResponseWriter) error

type CreateJobJSONRequestBody

type CreateJobJSONRequestBody = CreateJobRequest

CreateJobJSONRequestBody defines body for CreateJob for application/json ContentType.

type CreateJobRequest

type CreateJobRequest struct {
	Analytics *struct {
		RetentionSeconds *int `json:"retention_seconds,omitempty"`
	} `json:"analytics,omitempty"`
	CronExpression string `json:"cron_expression"`
	Name           string `json:"name"`

	// Tags Key-value tag pairs
	Tags                  *Tag    `json:"tags,omitempty"`
	Timezone              string  `json:"timezone"`
	WebhookSecret         *string `json:"webhook_secret,omitempty"`
	WebhookTimeoutSeconds *int    `json:"webhook_timeout_seconds,omitempty"`
	WebhookUrl            string  `json:"webhook_url"`
}

CreateJobRequest defines model for CreateJobRequest.

type CreateJobRequestObject

type CreateJobRequestObject struct {
	Body *CreateJobJSONRequestBody
}

type CreateJobResponseObject

type CreateJobResponseObject interface {
	VisitCreateJobResponse(w http.ResponseWriter) error
}

type DeleteAPIKey204Response

type DeleteAPIKey204Response struct {
}

func (DeleteAPIKey204Response) VisitDeleteAPIKeyResponse

func (response DeleteAPIKey204Response) VisitDeleteAPIKeyResponse(w http.ResponseWriter) error

type DeleteAPIKey404JSONResponse

type DeleteAPIKey404JSONResponse Error

func (DeleteAPIKey404JSONResponse) VisitDeleteAPIKeyResponse

func (response DeleteAPIKey404JSONResponse) VisitDeleteAPIKeyResponse(w http.ResponseWriter) error

type DeleteAPIKeyRequestObject

type DeleteAPIKeyRequestObject struct {
	Id APIKeyId `json:"id"`
}

type DeleteAPIKeyResponseObject

type DeleteAPIKeyResponseObject interface {
	VisitDeleteAPIKeyResponse(w http.ResponseWriter) error
}

type DeleteJob204Response

type DeleteJob204Response struct {
}

func (DeleteJob204Response) VisitDeleteJobResponse

func (response DeleteJob204Response) VisitDeleteJobResponse(w http.ResponseWriter) error

type DeleteJob404JSONResponse

type DeleteJob404JSONResponse Error

func (DeleteJob404JSONResponse) VisitDeleteJobResponse

func (response DeleteJob404JSONResponse) VisitDeleteJobResponse(w http.ResponseWriter) error

type DeleteJobRequestObject

type DeleteJobRequestObject struct {
	Id JobId `json:"id"`
}

type DeleteJobResponseObject

type DeleteJobResponseObject interface {
	VisitDeleteJobResponse(w http.ResponseWriter) error
}

type Error

type Error struct {
	Error struct {
		Code    string                  `json:"code"`
		Details *map[string]interface{} `json:"details,omitempty"`
		Message string                  `json:"message"`
	} `json:"error"`
}

Error defines model for Error.

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse is used by writeError for middleware error responses.

type Execution

type Execution struct {
	AcknowledgedAt *time.Time           `json:"acknowledged_at,omitempty"`
	CreatedAt      time.Time            `json:"created_at"`
	FiredAt        time.Time            `json:"fired_at"`
	Id             openapi_types.UUID   `json:"id"`
	JobId          openapi_types.UUID   `json:"job_id"`
	ScheduledAt    time.Time            `json:"scheduled_at"`
	Status         ExecutionStatus      `json:"status"`
	TriggerType    ExecutionTriggerType `json:"trigger_type"`
}

Execution defines model for Execution.

type ExecutionId

type ExecutionId = openapi_types.UUID

ExecutionId defines model for ExecutionId.

type ExecutionStatus

type ExecutionStatus string

ExecutionStatus defines model for Execution.Status.

const (
	ExecutionStatusDelivered  ExecutionStatus = "delivered"
	ExecutionStatusEmitted    ExecutionStatus = "emitted"
	ExecutionStatusFailed     ExecutionStatus = "failed"
	ExecutionStatusInProgress ExecutionStatus = "in_progress"
)

Defines values for ExecutionStatus.

func (ExecutionStatus) Valid

func (e ExecutionStatus) Valid() bool

Valid indicates whether the value is a known member of the ExecutionStatus enum.

type ExecutionTriggerType

type ExecutionTriggerType string

ExecutionTriggerType defines model for Execution.TriggerType.

const (
	ExecutionTriggerTypeManual    ExecutionTriggerType = "manual"
	ExecutionTriggerTypeScheduled ExecutionTriggerType = "scheduled"
)

Defines values for ExecutionTriggerType.

func (ExecutionTriggerType) Valid

func (e ExecutionTriggerType) Valid() bool

Valid indicates whether the value is a known member of the ExecutionTriggerType enum.

type GetExecution200JSONResponse

type GetExecution200JSONResponse Execution

func (GetExecution200JSONResponse) VisitGetExecutionResponse

func (response GetExecution200JSONResponse) VisitGetExecutionResponse(w http.ResponseWriter) error

type GetExecution404JSONResponse

type GetExecution404JSONResponse Error

func (GetExecution404JSONResponse) VisitGetExecutionResponse

func (response GetExecution404JSONResponse) VisitGetExecutionResponse(w http.ResponseWriter) error

type GetExecutionRequestObject

type GetExecutionRequestObject struct {
	Id ExecutionId `json:"id"`
}

type GetExecutionResponseObject

type GetExecutionResponseObject interface {
	VisitGetExecutionResponse(w http.ResponseWriter) error
}

type GetHealth200JSONResponse

type GetHealth200JSONResponse HealthResponse

func (GetHealth200JSONResponse) VisitGetHealthResponse

func (response GetHealth200JSONResponse) VisitGetHealthResponse(w http.ResponseWriter) error

type GetHealth503JSONResponse

type GetHealth503JSONResponse HealthResponse

func (GetHealth503JSONResponse) VisitGetHealthResponse

func (response GetHealth503JSONResponse) VisitGetHealthResponse(w http.ResponseWriter) error

type GetHealthParams

type GetHealthParams struct {
	Verbose *bool `form:"verbose,omitempty" json:"verbose,omitempty"`
}

GetHealthParams defines parameters for GetHealth.

type GetHealthRequestObject

type GetHealthRequestObject struct {
	Params GetHealthParams
}

type GetHealthResponseObject

type GetHealthResponseObject interface {
	VisitGetHealthResponse(w http.ResponseWriter) error
}

type GetJob200JSONResponse

type GetJob200JSONResponse JobDetail

func (GetJob200JSONResponse) VisitGetJobResponse

func (response GetJob200JSONResponse) VisitGetJobResponse(w http.ResponseWriter) error

type GetJob404JSONResponse

type GetJob404JSONResponse Error

func (GetJob404JSONResponse) VisitGetJobResponse

func (response GetJob404JSONResponse) VisitGetJobResponse(w http.ResponseWriter) error

type GetJobRequestObject

type GetJobRequestObject struct {
	Id JobId `json:"id"`
}

type GetJobResponseObject

type GetJobResponseObject interface {
	VisitGetJobResponse(w http.ResponseWriter) error
}

type GetNextRun200JSONResponse

type GetNextRun200JSONResponse NextRunResponse

func (GetNextRun200JSONResponse) VisitGetNextRunResponse

func (response GetNextRun200JSONResponse) VisitGetNextRunResponse(w http.ResponseWriter) error

type GetNextRun404JSONResponse

type GetNextRun404JSONResponse Error

func (GetNextRun404JSONResponse) VisitGetNextRunResponse

func (response GetNextRun404JSONResponse) VisitGetNextRunResponse(w http.ResponseWriter) error

type GetNextRunRequestObject

type GetNextRunRequestObject struct {
	Id JobId `json:"id"`
}

type GetNextRunResponseObject

type GetNextRunResponseObject interface {
	VisitGetNextRunResponse(w http.ResponseWriter) error
}

type HealthChecker

type HealthChecker interface {
	PingContext(ctx context.Context) error
}

HealthChecker provides database health status for the /health endpoint.

type HealthResponse

type HealthResponse struct {
	Database *string `json:"database,omitempty"`
	Status   string  `json:"status"`
}

HealthResponse defines model for HealthResponse.

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type Job

type Job struct {
	CreatedAt      time.Time          `json:"created_at"`
	CronExpression string             `json:"cron_expression"`
	Enabled        bool               `json:"enabled"`
	Id             openapi_types.UUID `json:"id"`
	Name           string             `json:"name"`
	Namespace      string             `json:"namespace"`

	// Tags Key-value tag pairs
	Tags       *Tag      `json:"tags,omitempty"`
	Timezone   string    `json:"timezone"`
	UpdatedAt  time.Time `json:"updated_at"`
	WebhookUrl string    `json:"webhook_url"`
}

Job defines model for Job.

type JobDetail

type JobDetail struct {
	CreatedAt        time.Time          `json:"created_at"`
	CronExpression   string             `json:"cron_expression"`
	Enabled          bool               `json:"enabled"`
	Id               openapi_types.UUID `json:"id"`
	Name             string             `json:"name"`
	Namespace        string             `json:"namespace"`
	RecentExecutions *[]Execution       `json:"recent_executions,omitempty"`

	// Tags Key-value tag pairs
	Tags       *Tag      `json:"tags,omitempty"`
	Timezone   string    `json:"timezone"`
	UpdatedAt  time.Time `json:"updated_at"`
	WebhookUrl string    `json:"webhook_url"`
}

JobDetail defines model for JobDetail.

type JobId

type JobId = openapi_types.UUID

JobId defines model for JobId.

type LimitParam

type LimitParam = int

LimitParam defines model for LimitParam.

type ListAPIKeys200JSONResponse

type ListAPIKeys200JSONResponse struct {
	Keys []APIKeyInfo `json:"keys"`
}

func (ListAPIKeys200JSONResponse) VisitListAPIKeysResponse

func (response ListAPIKeys200JSONResponse) VisitListAPIKeysResponse(w http.ResponseWriter) error

type ListAPIKeysParams

type ListAPIKeysParams struct {
	Limit  *LimitParam  `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *OffsetParam `form:"offset,omitempty" json:"offset,omitempty"`
}

ListAPIKeysParams defines parameters for ListAPIKeys.

type ListAPIKeysRequestObject

type ListAPIKeysRequestObject struct {
	Params ListAPIKeysParams
}

type ListAPIKeysResponseObject

type ListAPIKeysResponseObject interface {
	VisitListAPIKeysResponse(w http.ResponseWriter) error
}

type ListExecutions200JSONResponse

type ListExecutions200JSONResponse struct {
	Executions []Execution `json:"executions"`
}

func (ListExecutions200JSONResponse) VisitListExecutionsResponse

func (response ListExecutions200JSONResponse) VisitListExecutionsResponse(w http.ResponseWriter) error

type ListExecutionsParams

type ListExecutionsParams struct {
	Limit       *LimitParam                      `form:"limit,omitempty" json:"limit,omitempty"`
	Offset      *OffsetParam                     `form:"offset,omitempty" json:"offset,omitempty"`
	Status      *ListExecutionsParamsStatus      `form:"status,omitempty" json:"status,omitempty"`
	TriggerType *ListExecutionsParamsTriggerType `form:"trigger_type,omitempty" json:"trigger_type,omitempty"`
	Since       *time.Time                       `form:"since,omitempty" json:"since,omitempty"`
	Until       *time.Time                       `form:"until,omitempty" json:"until,omitempty"`
}

ListExecutionsParams defines parameters for ListExecutions.

type ListExecutionsParamsStatus

type ListExecutionsParamsStatus string

ListExecutionsParamsStatus defines parameters for ListExecutions.

const (
	ListExecutionsParamsStatusDelivered  ListExecutionsParamsStatus = "delivered"
	ListExecutionsParamsStatusEmitted    ListExecutionsParamsStatus = "emitted"
	ListExecutionsParamsStatusFailed     ListExecutionsParamsStatus = "failed"
	ListExecutionsParamsStatusInProgress ListExecutionsParamsStatus = "in_progress"
)

Defines values for ListExecutionsParamsStatus.

func (ListExecutionsParamsStatus) Valid

func (e ListExecutionsParamsStatus) Valid() bool

Valid indicates whether the value is a known member of the ListExecutionsParamsStatus enum.

type ListExecutionsParamsTriggerType

type ListExecutionsParamsTriggerType string

ListExecutionsParamsTriggerType defines parameters for ListExecutions.

const (
	ListExecutionsParamsTriggerTypeManual    ListExecutionsParamsTriggerType = "manual"
	ListExecutionsParamsTriggerTypeScheduled ListExecutionsParamsTriggerType = "scheduled"
)

Defines values for ListExecutionsParamsTriggerType.

func (ListExecutionsParamsTriggerType) Valid

Valid indicates whether the value is a known member of the ListExecutionsParamsTriggerType enum.

type ListExecutionsRequestObject

type ListExecutionsRequestObject struct {
	Id     JobId `json:"id"`
	Params ListExecutionsParams
}

type ListExecutionsResponseObject

type ListExecutionsResponseObject interface {
	VisitListExecutionsResponse(w http.ResponseWriter) error
}

type ListJobs200JSONResponse

type ListJobs200JSONResponse struct {
	Jobs []Job `json:"jobs"`
}

func (ListJobs200JSONResponse) VisitListJobsResponse

func (response ListJobs200JSONResponse) VisitListJobsResponse(w http.ResponseWriter) error

type ListJobsParams

type ListJobsParams struct {
	Limit  *LimitParam  `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *OffsetParam `form:"offset,omitempty" json:"offset,omitempty"`

	// Tag Filter by tag (key:value format, repeatable, AND semantics)
	Tag     *[]string `form:"tag,omitempty" json:"tag,omitempty"`
	Enabled *bool     `form:"enabled,omitempty" json:"enabled,omitempty"`

	// Name Substring match on job name
	Name *string `form:"name,omitempty" json:"name,omitempty"`
}

ListJobsParams defines parameters for ListJobs.

type ListJobsRequestObject

type ListJobsRequestObject struct {
	Params ListJobsParams
}

type ListJobsResponseObject

type ListJobsResponseObject interface {
	VisitListJobsResponse(w http.ResponseWriter) error
}

type ListPendingAck200JSONResponse

type ListPendingAck200JSONResponse struct {
	Executions []Execution `json:"executions"`
}

func (ListPendingAck200JSONResponse) VisitListPendingAckResponse

func (response ListPendingAck200JSONResponse) VisitListPendingAckResponse(w http.ResponseWriter) error

type ListPendingAckParams

type ListPendingAckParams struct {
	Limit *LimitParam         `form:"limit,omitempty" json:"limit,omitempty"`
	JobId *openapi_types.UUID `form:"job_id,omitempty" json:"job_id,omitempty"`
}

ListPendingAckParams defines parameters for ListPendingAck.

type ListPendingAckRequestObject

type ListPendingAckRequestObject struct {
	Params ListPendingAckParams
}

type ListPendingAckResponseObject

type ListPendingAckResponseObject interface {
	VisitListPendingAckResponse(w http.ResponseWriter) error
}

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type NextRunResponse

type NextRunResponse struct {
	CronExpression string      `json:"cron_expression"`
	NextRunAt      time.Time   `json:"next_run_at"`
	NextRuns       []time.Time `json:"next_runs"`
	Timezone       string      `json:"timezone"`
}

NextRunResponse defines model for NextRunResponse.

type OffsetParam

type OffsetParam = int

OffsetParam defines model for OffsetParam.

type PauseJob200JSONResponse

type PauseJob200JSONResponse Job

func (PauseJob200JSONResponse) VisitPauseJobResponse

func (response PauseJob200JSONResponse) VisitPauseJobResponse(w http.ResponseWriter) error

type PauseJob404JSONResponse

type PauseJob404JSONResponse Error

func (PauseJob404JSONResponse) VisitPauseJobResponse

func (response PauseJob404JSONResponse) VisitPauseJobResponse(w http.ResponseWriter) error

type PauseJobRequestObject

type PauseJobRequestObject struct {
	Id JobId `json:"id"`
}

type PauseJobResponseObject

type PauseJobResponseObject interface {
	VisitPauseJobResponse(w http.ResponseWriter) error
}

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type ResolveSchedule200JSONResponse

type ResolveSchedule200JSONResponse ResolveScheduleResponse

func (ResolveSchedule200JSONResponse) VisitResolveScheduleResponse

func (response ResolveSchedule200JSONResponse) VisitResolveScheduleResponse(w http.ResponseWriter) error

type ResolveSchedule422JSONResponse

type ResolveSchedule422JSONResponse Error

func (ResolveSchedule422JSONResponse) VisitResolveScheduleResponse

func (response ResolveSchedule422JSONResponse) VisitResolveScheduleResponse(w http.ResponseWriter) error

type ResolveScheduleJSONRequestBody

type ResolveScheduleJSONRequestBody = ResolveScheduleRequest

ResolveScheduleJSONRequestBody defines body for ResolveSchedule for application/json ContentType.

type ResolveScheduleRequest

type ResolveScheduleRequest struct {
	// Description Natural language schedule or cron expression
	Description string  `json:"description"`
	Timezone    *string `json:"timezone,omitempty"`
}

ResolveScheduleRequest defines model for ResolveScheduleRequest.

type ResolveScheduleRequestObject

type ResolveScheduleRequestObject struct {
	Body *ResolveScheduleJSONRequestBody
}

type ResolveScheduleResponse

type ResolveScheduleResponse struct {
	CronExpression string      `json:"cron_expression"`
	Description    string      `json:"description"`
	NextRuns       []time.Time `json:"next_runs"`
	Timezone       string      `json:"timezone"`
}

ResolveScheduleResponse defines model for ResolveScheduleResponse.

type ResolveScheduleResponseObject

type ResolveScheduleResponseObject interface {
	VisitResolveScheduleResponse(w http.ResponseWriter) error
}

type ResumeJob200JSONResponse

type ResumeJob200JSONResponse Job

func (ResumeJob200JSONResponse) VisitResumeJobResponse

func (response ResumeJob200JSONResponse) VisitResumeJobResponse(w http.ResponseWriter) error

type ResumeJob404JSONResponse

type ResumeJob404JSONResponse Error

func (ResumeJob404JSONResponse) VisitResumeJobResponse

func (response ResumeJob404JSONResponse) VisitResumeJobResponse(w http.ResponseWriter) error

type ResumeJobRequestObject

type ResumeJobRequestObject struct {
	Id JobId `json:"id"`
}

type ResumeJobResponseObject

type ResumeJobResponseObject interface {
	VisitResumeJobResponse(w http.ResponseWriter) error
}

type ServeMux

type ServeMux interface {
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
	http.Handler
}

ServeMux is an abstraction of http.ServeMux.

type ServerImpl

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

ServerImpl implements StrictServerInterface by delegating to the service layer.

func NewServerImpl

func NewServerImpl(svc *service.JobService) *ServerImpl

NewServerImpl creates a new ServerImpl backed by the given service.

func (*ServerImpl) AckExecution

func (*ServerImpl) CreateAPIKey

func (*ServerImpl) CreateJob

func (*ServerImpl) DeleteAPIKey

func (*ServerImpl) DeleteJob

func (*ServerImpl) GetExecution

func (*ServerImpl) GetHealth

func (*ServerImpl) GetJob

func (*ServerImpl) GetNextRun

func (*ServerImpl) ListAPIKeys

func (*ServerImpl) ListExecutions

func (*ServerImpl) ListJobs

func (*ServerImpl) ListPendingAck

func (*ServerImpl) PauseJob

func (*ServerImpl) ResolveSchedule

func (*ServerImpl) ResumeJob

func (*ServerImpl) TriggerJob

func (*ServerImpl) UpdateJob

func (*ServerImpl) WithHealthChecker

func (s *ServerImpl) WithHealthChecker(db HealthChecker) *ServerImpl

WithHealthChecker sets the database health checker for verbose /health responses.

type ServerInterface

type ServerInterface interface {
	// List API keys in caller's namespace
	// (GET /api-keys)
	ListAPIKeys(w http.ResponseWriter, r *http.Request, params ListAPIKeysParams)
	// Create a new API key
	// (POST /api-keys)
	CreateAPIKey(w http.ResponseWriter, r *http.Request)
	// Revoke an API key
	// (DELETE /api-keys/{id})
	DeleteAPIKey(w http.ResponseWriter, r *http.Request, id APIKeyId)
	// List unacknowledged completed/failed executions
	// (GET /executions/pending-ack)
	ListPendingAck(w http.ResponseWriter, r *http.Request, params ListPendingAckParams)
	// Get execution detail with delivery attempts
	// (GET /executions/{id})
	GetExecution(w http.ResponseWriter, r *http.Request, id ExecutionId)
	// Acknowledge an execution result
	// (POST /executions/{id}/ack)
	AckExecution(w http.ResponseWriter, r *http.Request, id ExecutionId)
	// Health check
	// (GET /health)
	GetHealth(w http.ResponseWriter, r *http.Request, params GetHealthParams)
	// List jobs in caller's namespace
	// (GET /jobs)
	ListJobs(w http.ResponseWriter, r *http.Request, params ListJobsParams)
	// Create a new cron job
	// (POST /jobs)
	CreateJob(w http.ResponseWriter, r *http.Request)
	// Delete a job and its data
	// (DELETE /jobs/{id})
	DeleteJob(w http.ResponseWriter, r *http.Request, id JobId)
	// Get job detail with recent executions
	// (GET /jobs/{id})
	GetJob(w http.ResponseWriter, r *http.Request, id JobId)
	// Partial update a job
	// (PATCH /jobs/{id})
	UpdateJob(w http.ResponseWriter, r *http.Request, id JobId)
	// List executions for a job
	// (GET /jobs/{id}/executions)
	ListExecutions(w http.ResponseWriter, r *http.Request, id JobId, params ListExecutionsParams)
	// Get next scheduled run time
	// (GET /jobs/{id}/next-run)
	GetNextRun(w http.ResponseWriter, r *http.Request, id JobId)
	// Pause a job (set enabled=false)
	// (POST /jobs/{id}/pause)
	PauseJob(w http.ResponseWriter, r *http.Request, id JobId)
	// Resume a paused job (set enabled=true)
	// (POST /jobs/{id}/resume)
	ResumeJob(w http.ResponseWriter, r *http.Request, id JobId)
	// Trigger immediate execution
	// (POST /jobs/{id}/trigger)
	TriggerJob(w http.ResponseWriter, r *http.Request, id JobId)
	// Resolve natural language to cron expression
	// (POST /schedules/resolve)
	ResolveSchedule(w http.ResponseWriter, r *http.Request)
}

ServerInterface represents all server handlers.

func NewStrictHandler

func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface

func NewStrictHandlerWithOptions

func NewStrictHandlerWithOptions(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc, options StrictHTTPServerOptions) ServerInterface

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) AckExecution

func (siw *ServerInterfaceWrapper) AckExecution(w http.ResponseWriter, r *http.Request)

AckExecution operation middleware

func (*ServerInterfaceWrapper) CreateAPIKey

func (siw *ServerInterfaceWrapper) CreateAPIKey(w http.ResponseWriter, r *http.Request)

CreateAPIKey operation middleware

func (*ServerInterfaceWrapper) CreateJob

func (siw *ServerInterfaceWrapper) CreateJob(w http.ResponseWriter, r *http.Request)

CreateJob operation middleware

func (*ServerInterfaceWrapper) DeleteAPIKey

func (siw *ServerInterfaceWrapper) DeleteAPIKey(w http.ResponseWriter, r *http.Request)

DeleteAPIKey operation middleware

func (*ServerInterfaceWrapper) DeleteJob

func (siw *ServerInterfaceWrapper) DeleteJob(w http.ResponseWriter, r *http.Request)

DeleteJob operation middleware

func (*ServerInterfaceWrapper) GetExecution

func (siw *ServerInterfaceWrapper) GetExecution(w http.ResponseWriter, r *http.Request)

GetExecution operation middleware

func (*ServerInterfaceWrapper) GetHealth

func (siw *ServerInterfaceWrapper) GetHealth(w http.ResponseWriter, r *http.Request)

GetHealth operation middleware

func (*ServerInterfaceWrapper) GetJob

GetJob operation middleware

func (*ServerInterfaceWrapper) GetNextRun

func (siw *ServerInterfaceWrapper) GetNextRun(w http.ResponseWriter, r *http.Request)

GetNextRun operation middleware

func (*ServerInterfaceWrapper) ListAPIKeys

func (siw *ServerInterfaceWrapper) ListAPIKeys(w http.ResponseWriter, r *http.Request)

ListAPIKeys operation middleware

func (*ServerInterfaceWrapper) ListExecutions

func (siw *ServerInterfaceWrapper) ListExecutions(w http.ResponseWriter, r *http.Request)

ListExecutions operation middleware

func (*ServerInterfaceWrapper) ListJobs

func (siw *ServerInterfaceWrapper) ListJobs(w http.ResponseWriter, r *http.Request)

ListJobs operation middleware

func (*ServerInterfaceWrapper) ListPendingAck

func (siw *ServerInterfaceWrapper) ListPendingAck(w http.ResponseWriter, r *http.Request)

ListPendingAck operation middleware

func (*ServerInterfaceWrapper) PauseJob

func (siw *ServerInterfaceWrapper) PauseJob(w http.ResponseWriter, r *http.Request)

PauseJob operation middleware

func (*ServerInterfaceWrapper) ResolveSchedule

func (siw *ServerInterfaceWrapper) ResolveSchedule(w http.ResponseWriter, r *http.Request)

ResolveSchedule operation middleware

func (*ServerInterfaceWrapper) ResumeJob

func (siw *ServerInterfaceWrapper) ResumeJob(w http.ResponseWriter, r *http.Request)

ResumeJob operation middleware

func (*ServerInterfaceWrapper) TriggerJob

func (siw *ServerInterfaceWrapper) TriggerJob(w http.ResponseWriter, r *http.Request)

TriggerJob operation middleware

func (*ServerInterfaceWrapper) UpdateJob

func (siw *ServerInterfaceWrapper) UpdateJob(w http.ResponseWriter, r *http.Request)

UpdateJob operation middleware

type StdHTTPServerOptions

type StdHTTPServerOptions struct {
	BaseURL          string
	BaseRouter       ServeMux
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictHTTPServerOptions

type StrictHTTPServerOptions struct {
	RequestErrorHandlerFunc  func(w http.ResponseWriter, r *http.Request, err error)
	ResponseErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type StrictHandlerFunc

type StrictHandlerFunc func(ctx context.Context, w http.ResponseWriter, r *http.Request, request any) (any, error)

type StrictMiddlewareFunc

type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc

type StrictServerInterface

type StrictServerInterface interface {
	// List API keys in caller's namespace
	// (GET /api-keys)
	ListAPIKeys(ctx context.Context, request ListAPIKeysRequestObject) (ListAPIKeysResponseObject, error)
	// Create a new API key
	// (POST /api-keys)
	CreateAPIKey(ctx context.Context, request CreateAPIKeyRequestObject) (CreateAPIKeyResponseObject, error)
	// Revoke an API key
	// (DELETE /api-keys/{id})
	DeleteAPIKey(ctx context.Context, request DeleteAPIKeyRequestObject) (DeleteAPIKeyResponseObject, error)
	// List unacknowledged completed/failed executions
	// (GET /executions/pending-ack)
	ListPendingAck(ctx context.Context, request ListPendingAckRequestObject) (ListPendingAckResponseObject, error)
	// Get execution detail with delivery attempts
	// (GET /executions/{id})
	GetExecution(ctx context.Context, request GetExecutionRequestObject) (GetExecutionResponseObject, error)
	// Acknowledge an execution result
	// (POST /executions/{id}/ack)
	AckExecution(ctx context.Context, request AckExecutionRequestObject) (AckExecutionResponseObject, error)
	// Health check
	// (GET /health)
	GetHealth(ctx context.Context, request GetHealthRequestObject) (GetHealthResponseObject, error)
	// List jobs in caller's namespace
	// (GET /jobs)
	ListJobs(ctx context.Context, request ListJobsRequestObject) (ListJobsResponseObject, error)
	// Create a new cron job
	// (POST /jobs)
	CreateJob(ctx context.Context, request CreateJobRequestObject) (CreateJobResponseObject, error)
	// Delete a job and its data
	// (DELETE /jobs/{id})
	DeleteJob(ctx context.Context, request DeleteJobRequestObject) (DeleteJobResponseObject, error)
	// Get job detail with recent executions
	// (GET /jobs/{id})
	GetJob(ctx context.Context, request GetJobRequestObject) (GetJobResponseObject, error)
	// Partial update a job
	// (PATCH /jobs/{id})
	UpdateJob(ctx context.Context, request UpdateJobRequestObject) (UpdateJobResponseObject, error)
	// List executions for a job
	// (GET /jobs/{id}/executions)
	ListExecutions(ctx context.Context, request ListExecutionsRequestObject) (ListExecutionsResponseObject, error)
	// Get next scheduled run time
	// (GET /jobs/{id}/next-run)
	GetNextRun(ctx context.Context, request GetNextRunRequestObject) (GetNextRunResponseObject, error)
	// Pause a job (set enabled=false)
	// (POST /jobs/{id}/pause)
	PauseJob(ctx context.Context, request PauseJobRequestObject) (PauseJobResponseObject, error)
	// Resume a paused job (set enabled=true)
	// (POST /jobs/{id}/resume)
	ResumeJob(ctx context.Context, request ResumeJobRequestObject) (ResumeJobResponseObject, error)
	// Trigger immediate execution
	// (POST /jobs/{id}/trigger)
	TriggerJob(ctx context.Context, request TriggerJobRequestObject) (TriggerJobResponseObject, error)
	// Resolve natural language to cron expression
	// (POST /schedules/resolve)
	ResolveSchedule(ctx context.Context, request ResolveScheduleRequestObject) (ResolveScheduleResponseObject, error)
}

StrictServerInterface represents all server handlers.

type Tag

type Tag map[string]string

Tag Key-value tag pairs

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type TriggerJob201JSONResponse

type TriggerJob201JSONResponse Execution

func (TriggerJob201JSONResponse) VisitTriggerJobResponse

func (response TriggerJob201JSONResponse) VisitTriggerJobResponse(w http.ResponseWriter) error

type TriggerJob404JSONResponse

type TriggerJob404JSONResponse Error

func (TriggerJob404JSONResponse) VisitTriggerJobResponse

func (response TriggerJob404JSONResponse) VisitTriggerJobResponse(w http.ResponseWriter) error

type TriggerJob409JSONResponse

type TriggerJob409JSONResponse Error

func (TriggerJob409JSONResponse) VisitTriggerJobResponse

func (response TriggerJob409JSONResponse) VisitTriggerJobResponse(w http.ResponseWriter) error

type TriggerJobRequestObject

type TriggerJobRequestObject struct {
	Id JobId `json:"id"`
}

type TriggerJobResponseObject

type TriggerJobResponseObject interface {
	VisitTriggerJobResponse(w http.ResponseWriter) error
}

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateJob200JSONResponse

type UpdateJob200JSONResponse JobDetail

func (UpdateJob200JSONResponse) VisitUpdateJobResponse

func (response UpdateJob200JSONResponse) VisitUpdateJobResponse(w http.ResponseWriter) error

type UpdateJob404JSONResponse

type UpdateJob404JSONResponse Error

func (UpdateJob404JSONResponse) VisitUpdateJobResponse

func (response UpdateJob404JSONResponse) VisitUpdateJobResponse(w http.ResponseWriter) error

type UpdateJob422JSONResponse

type UpdateJob422JSONResponse Error

func (UpdateJob422JSONResponse) VisitUpdateJobResponse

func (response UpdateJob422JSONResponse) VisitUpdateJobResponse(w http.ResponseWriter) error

type UpdateJobJSONRequestBody

type UpdateJobJSONRequestBody = UpdateJobRequest

UpdateJobJSONRequestBody defines body for UpdateJob for application/json ContentType.

type UpdateJobRequest

type UpdateJobRequest struct {
	CronExpression *string `json:"cron_expression,omitempty"`
	Enabled        *bool   `json:"enabled,omitempty"`
	Name           *string `json:"name,omitempty"`

	// Tags Key-value tag pairs
	Tags                  *Tag    `json:"tags,omitempty"`
	Timezone              *string `json:"timezone,omitempty"`
	WebhookSecret         *string `json:"webhook_secret,omitempty"`
	WebhookTimeoutSeconds *int    `json:"webhook_timeout_seconds,omitempty"`
	WebhookUrl            *string `json:"webhook_url,omitempty"`
}

UpdateJobRequest defines model for UpdateJobRequest.

type UpdateJobRequestObject

type UpdateJobRequestObject struct {
	Id   JobId `json:"id"`
	Body *UpdateJobJSONRequestBody
}

type UpdateJobResponseObject

type UpdateJobResponseObject interface {
	VisitUpdateJobResponse(w http.ResponseWriter) error
}

Jump to

Keyboard shortcuts

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