MCPcopy
hub / github.com/the-open-agent/openagent / GetTask

Method GetTask

controllers/task.go:108–133  ·  view source on GitHub ↗

GetTask @Title GetTask @Tag Task API @Description get task @Param id query string true "The id (owner/name) of task" @Success 200 {object} object.Task The Response object @router /get-task [get]

()

Source from the content-addressed store, hash-verified

106// @Success 200 {object} object.Task The Response object
107// @router /get-task [get]
108func (c *ApiController) GetTask() {
109 id := c.Input().Get("id")
110
111 task, err := object.GetTask(id)
112 if err != nil {
113 c.ResponseError(err.Error())
114 return
115 }
116
117 // Check if task exists
118 if task == nil {
119 c.ResponseError(c.T("general:The task does not exist"))
120 return
121 }
122
123 // Check ownership for non-admins
124 if !c.IsAdmin() {
125 username := c.GetSessionUsername()
126 if task.Owner != username {
127 c.ResponseError(c.T("auth:Unauthorized operation"))
128 return
129 }
130 }
131
132 c.ResponseOk(task)
133}
134
135// UpdateTask
136// @Title UpdateTask

Callers

nothing calls this directly

Calls 7

ResponseErrorMethod · 0.95
TMethod · 0.95
IsAdminMethod · 0.95
GetSessionUsernameMethod · 0.95
ResponseOkMethod · 0.95
GetTaskFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected