MCPcopy Index your code
hub / github.com/aptly-dev/aptly / apiTasksDelete

Function apiTasksDelete

api/task.go:187–203  ·  view source on GitHub ↗

@Summary Delete Task @Description **Delete completed task by given ID. Does not stop task execution** @Tags Tasks @Produce json @Param id path int true "Task ID" @Success 200 {object} task.Task @Failure 500 {object} Error "invalid syntax, bad ID?" @Failure 400 {object} Error "Task in progress or not

(c *gin.Context)

Source from the content-addressed store, hash-verified

185// @Failure 400 {object} Error "Task in progress or not found"
186// @Router /api/tasks/{id} [delete]
187func apiTasksDelete(c *gin.Context) {
188 list := context.TaskList()
189 id, err := strconv.ParseInt(c.Params.ByName("id"), 10, 0)
190 if err != nil {
191 AbortWithJSONError(c, 500, err)
192 return
193 }
194
195 var delTask task.Task
196 delTask, err = list.DeleteTaskByID(int(id))
197 if err != nil {
198 AbortWithJSONError(c, 400, err)
199 return
200 }
201
202 c.JSON(200, delTask)
203}

Callers

nothing calls this directly

Calls 4

AbortWithJSONErrorFunction · 0.85
TaskListMethod · 0.80
DeleteTaskByIDMethod · 0.80
ByNameMethod · 0.45

Tested by

no test coverage detected