MCPcopy Create free account
hub / github.com/astercloud/aster / Get

Method Get

server/handlers/workflow.go:179–209  ·  view source on GitHub ↗

Get retrieves a single workflow

(c *gin.Context)

Source from the content-addressed store, hash-verified

177
178// Get retrieves a single workflow
179func (h *WorkflowHandler) Get(c *gin.Context) {
180 ctx := c.Request.Context()
181 id := c.Param("id")
182
183 var workflow WorkflowRecord
184 if err := (*h.store).Get(ctx, "workflows", id, &workflow); err != nil {
185 if errors.Is(err, store.ErrNotFound) {
186 c.JSON(http.StatusNotFound, gin.H{
187 "success": false,
188 "error": gin.H{
189 "code": "not_found",
190 "message": "Workflow not found",
191 },
192 })
193 return
194 }
195 c.JSON(http.StatusInternalServerError, gin.H{
196 "success": false,
197 "error": gin.H{
198 "code": "internal_error",
199 "message": "Failed to get workflow: " + err.Error(),
200 },
201 })
202 return
203 }
204
205 c.JSON(http.StatusOK, gin.H{
206 "success": true,
207 "data": &workflow,
208 })
209}
210
211// Update updates a workflow
212func (h *WorkflowHandler) Update(c *gin.Context) {

Callers

nothing calls this directly

Calls 4

JSONMethod · 0.80
ContextMethod · 0.65
GetMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected