Documentation
¶
Overview ¶
Package workflow provides HTTP handlers for workflow operations.
Index ¶
- func ToPipelineInput(req StartWorkflowRequest) (definitions.PipelineInput, error)
- func ToTestSuiteInput(req StartWorkflowRequest) (definitions.TestSuiteInput, error)
- type CancelWorkflowRequest
- type CancelWorkflowResponse
- type ErrorResponse
- type Handler
- func (h *Handler) CancelWorkflow(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetWorkflowHistory(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetWorkflowStatus(w http.ResponseWriter, r *http.Request)
- func (h *Handler) ListWorkflows(w http.ResponseWriter, r *http.Request)
- func (h *Handler) RegisterRoutes(r chi.Router)
- func (h *Handler) StartWorkflow(w http.ResponseWriter, r *http.Request)
- type HistoryEvent
- type ListWorkflowsRequest
- type ListWorkflowsResponse
- type StartWorkflowRequest
- type StartWorkflowResponse
- type WorkflowHistoryResponse
- type WorkflowStatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ToPipelineInput ¶
func ToPipelineInput(req StartWorkflowRequest) (definitions.PipelineInput, error)
ToPipelineInput converts a StartWorkflowRequest to definitions.PipelineInput.
func ToTestSuiteInput ¶
func ToTestSuiteInput(req StartWorkflowRequest) (definitions.TestSuiteInput, error)
ToTestSuiteInput converts a StartWorkflowRequest to definitions.TestSuiteInput.
Types ¶
type CancelWorkflowRequest ¶
type CancelWorkflowRequest struct {
Reason string `json:"reason,omitempty"`
}
CancelWorkflowRequest represents a request to cancel a workflow.
type CancelWorkflowResponse ¶
type CancelWorkflowResponse struct {
WorkflowID string `json:"workflowId"`
Status string `json:"status"`
}
CancelWorkflowResponse represents the response after canceling a workflow.
type ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
Details map[string]string `json:"details,omitempty"`
}
ErrorResponse represents an API error response.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler provides HTTP handlers for workflow operations.
func NewHandler ¶
func NewHandler(eng *engine.Engine, repo repository.WorkflowRepository) *Handler
NewHandler creates a new workflow Handler.
func (*Handler) CancelWorkflow ¶
func (h *Handler) CancelWorkflow(w http.ResponseWriter, r *http.Request)
CancelWorkflow handles POST /api/v1/workflows/{id}/cancel
func (*Handler) GetWorkflowHistory ¶
func (h *Handler) GetWorkflowHistory(w http.ResponseWriter, r *http.Request)
GetWorkflowHistory handles GET /api/v1/workflows/{id}/history
func (*Handler) GetWorkflowStatus ¶
func (h *Handler) GetWorkflowStatus(w http.ResponseWriter, r *http.Request)
GetWorkflowStatus handles GET /api/v1/workflows/{id}
func (*Handler) ListWorkflows ¶
func (h *Handler) ListWorkflows(w http.ResponseWriter, r *http.Request)
ListWorkflows handles GET /api/v1/workflows
func (*Handler) RegisterRoutes ¶
RegisterRoutes registers the workflow routes with the given router.
func (*Handler) StartWorkflow ¶
func (h *Handler) StartWorkflow(w http.ResponseWriter, r *http.Request)
StartWorkflow handles POST /api/v1/workflows
type HistoryEvent ¶
type HistoryEvent struct {
EventID int64 `json:"eventId"`
EventType string `json:"eventType"`
Timestamp time.Time `json:"timestamp"`
Details string `json:"details,omitempty"`
}
HistoryEvent represents a single event in workflow history.
type ListWorkflowsRequest ¶
type ListWorkflowsRequest struct {
WorkflowType string `json:"workflowType,omitempty"`
Status string `json:"status,omitempty"`
Limit int `json:"limit,omitempty"`
Offset int `json:"offset,omitempty"`
}
ListWorkflowsRequest represents parameters for listing workflows.
type ListWorkflowsResponse ¶
type ListWorkflowsResponse struct {
Workflows []WorkflowStatusResponse `json:"workflows"`
Total int `json:"total"`
Limit int `json:"limit"`
Offset int `json:"offset"`
}
ListWorkflowsResponse represents a list of workflows.
type StartWorkflowRequest ¶
type StartWorkflowRequest struct {
WorkflowID string `json:"workflowId" validate:"required"`
WorkflowType string `json:"workflowType" validate:"required,oneof=ai-pipeline test-suite"`
Input json.RawMessage `json:"input" validate:"required"`
Metadata map[string]string `json:"metadata,omitempty"`
}
StartWorkflowRequest represents a request to start a new workflow.
type StartWorkflowResponse ¶
type StartWorkflowResponse struct {
WorkflowID string `json:"workflowId"`
RunID string `json:"runId"`
Status string `json:"status"`
}
StartWorkflowResponse represents the response after starting a workflow.
type WorkflowHistoryResponse ¶
type WorkflowHistoryResponse struct {
WorkflowID string `json:"workflowId"`
RunID string `json:"runId"`
Events []HistoryEvent `json:"events"`
}
WorkflowHistoryResponse represents the history of a workflow.
type WorkflowStatusResponse ¶
type WorkflowStatusResponse struct {
WorkflowID string `json:"workflowId"`
WorkflowType string `json:"workflowType"`
RunID string `json:"runId,omitempty"`
Status string `json:"status"`
Input json.RawMessage `json:"input,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"startedAt"`
CompletedAt *time.Time `json:"completedAt,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
WorkflowStatusResponse represents the status of a workflow.
func ToWorkflowStatusResponse ¶
func ToWorkflowStatusResponse(exec *repository.WorkflowExecution) WorkflowStatusResponse
ToWorkflowStatusResponse converts a repository.WorkflowExecution to WorkflowStatusResponse.