mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-22 00:00:42 +01:00
commit
27f51db09c
13
api-docs.yml
13
api-docs.yml
@ -923,6 +923,19 @@ paths:
|
||||
description: Task queued
|
||||
schema:
|
||||
$ref: "#/definitions/Task"
|
||||
/project/{project_id}/tasks/{task_id}:
|
||||
parameters:
|
||||
- $ref: "#/parameters/project_id"
|
||||
- $ref: "#/parameters/task_id"
|
||||
get:
|
||||
tags:
|
||||
- project
|
||||
summary: Get a single task
|
||||
responses:
|
||||
200:
|
||||
description: Task
|
||||
schema:
|
||||
$ref: "#/definitions/Task"
|
||||
/project/{project_id}/tasks/{task_id}/output:
|
||||
parameters:
|
||||
- $ref: '#/parameters/project_id'
|
||||
|
@ -99,6 +99,7 @@ func Route() mulekick.Router {
|
||||
api.Get("/tasks", tasks.GetAll)
|
||||
api.Post("/tasks", tasks.AddTask)
|
||||
api.Get("/tasks/{task_id}/output", tasks.GetTaskMiddleware, tasks.GetTaskOutput)
|
||||
api.Get("/tasks/{task_id}", tasks.GetTaskMiddleware, tasks.GetTask)
|
||||
api.Delete("/tasks/{task_id}", tasks.GetTaskMiddleware, tasks.RemoveTask)
|
||||
}(api.Group("/project/{project_id}"))
|
||||
|
||||
|
@ -73,6 +73,11 @@ func GetAll(w http.ResponseWriter, r *http.Request) {
|
||||
mulekick.WriteJSON(w, http.StatusOK, tasks)
|
||||
}
|
||||
|
||||
func GetTask(w http.ResponseWriter, r *http.Request) {
|
||||
task := context.Get(r, "task").(db.Task)
|
||||
mulekick.WriteJSON(w, http.StatusOK, task)
|
||||
}
|
||||
|
||||
func GetTaskMiddleware(w http.ResponseWriter, r *http.Request) {
|
||||
taskID, err := util.GetIntParam("task_id", w, r)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user